Re: 'with' statement



"Peter Bromberg [C# MVP]" <pbromberg@xxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:D2C6048B-431E-4141-B215-62D31F5C3B90@xxxxxxxxxxxxxxxx
I've seen this particular question come up at least 4 or 5 times in the
last
year or so, and I have to agree. "With xyz ".... is simplyunnecessary in a
concise and elegant language like C#. Hard core classic VB programmers who
are resistant to change are usually the ones who harp on this (among other
silly issues).
Peter

What I'd much rather have is a concise notation for mathematics.
Programming as we know it originated with Fortran (Formula Translation),
which allowed you to write such things as:

Y = SIN(X)**2 + COS(Z)**2

In C#, if I'm not mistaken, we're now stuck with

y = Math.Pow(Math.Sin(x),2) + Math.Pow(Math.Sin(z),2)

which is a great deal farther from normal mathematical notation. I know
it's nice and object-oriented, but something valuable has been lost.

It could have been worse. They could have given us:

Object.Assign(ref y,
Math.Add(Math.Pow(Math.Sin(x),2),Math.Pow(Math.Sin(z),2)));

If + has special status as a math operator, then why not ** and the Math
functions?




.


Loading