Strongly-typed typo
-
return new Vector3(r * (float)Math.Cos(theta), r * (float)Math.Sign(theta), z);
And I thought I was safe from typos using a strongly-typed language.. :doh: Took me hours to figure this one out.
-
return new Vector3(r * (float)Math.Cos(theta), r * (float)Math.Sign(theta), z);
And I thought I was safe from typos using a strongly-typed language.. :doh: Took me hours to figure this one out.
Sin != Sign
"When did ignorance become a point of view" - Dilbert
-
return new Vector3(r * (float)Math.Cos(theta), r * (float)Math.Sign(theta), z);
And I thought I was safe from typos using a strongly-typed language.. :doh: Took me hours to figure this one out.
I haven't seen a language yet that imposes (or allows you to impose) a minimal Hamming distance[^] between identifier names. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
-
Sin != Sign
"When did ignorance become a point of view" - Dilbert
-
I haven't seen a language yet that imposes (or allows you to impose) a minimal Hamming distance[^] between identifier names. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
It threw you a curve eh?
Steve Wellens
-
return new Vector3(r * (float)Math.Cos(theta), r * (float)Math.Sign(theta), z);
And I thought I was safe from typos using a strongly-typed language.. :doh: Took me hours to figure this one out.
Shouldn't the compiler be a little more proactively smart enough to throw out a little warning at least w.r.t. context-sensitiveness?
Vasudevan Deepak Kumar Personal Homepage
Tech Gossips
The woods are lovely, dark and deep, But I have promises to keep, And miles to go before I sleep, And miles to go before I sleep! -
Shouldn't the compiler be a little more proactively smart enough to throw out a little warning at least w.r.t. context-sensitiveness?
Vasudevan Deepak Kumar Personal Homepage
Tech Gossips
The woods are lovely, dark and deep, But I have promises to keep, And miles to go before I sleep, And miles to go before I sleep!Vasudevan Deepak Kumar wrote:
Shouldn't the compiler be a little more proactively smart enough to throw out a little warning at least w.r.t. context-sensitiveness?
How should he possibly do that? Best solution I can come up with is providing a Math.PolarToCartesian function...
-
Vasudevan Deepak Kumar wrote:
Shouldn't the compiler be a little more proactively smart enough to throw out a little warning at least w.r.t. context-sensitiveness?
How should he possibly do that? Best solution I can come up with is providing a Math.PolarToCartesian function...
With other tan/cos being used in the same context it can alert if sign is being inadvertently used in lieu of sine?
Vasudevan Deepak Kumar Personal Homepage
Tech Gossips
The woods are lovely, dark and deep, But I have promises to keep, And miles to go before I sleep, And miles to go before I sleep! -
With other tan/cos being used in the same context it can alert if sign is being inadvertently used in lieu of sine?
Vasudevan Deepak Kumar Personal Homepage
Tech Gossips
The woods are lovely, dark and deep, But I have promises to keep, And miles to go before I sleep, And miles to go before I sleep!Well, the "compiler" knows only the language, not the libraries. There is no way it can possibly know beforehand about the existence of a Math class with two methods, Sign and Sine, much less associate Tan and Sine and figure out that the user probably wanted Sine instead of Sign. A source code analysis tool like FxCop could probably do a better job at this.
Regards Senthil _____________________________ My Home Page |My Blog | My Articles | My Flickr | WinMacro
-
return new Vector3(r * (float)Math.Cos(theta), r * (float)Math.Sign(theta), z);
And I thought I was safe from typos using a strongly-typed language.. :doh: Took me hours to figure this one out.
-
With other tan/cos being used in the same context it can alert if sign is being inadvertently used in lieu of sine?
Vasudevan Deepak Kumar Personal Homepage
Tech Gossips
The woods are lovely, dark and deep, But I have promises to keep, And miles to go before I sleep, And miles to go before I sleep!In Addition, even if the compiler knew the libraries, there's no distinct way to tell right from wrong -
Cos(x)*Sign(x)
is as valid an operation asCos(x)*Sin(x)
. The latter may be more common overall, but that doesn't mean it has to be for my application. (Besides, I don't believe much in the total greatness of "people who usedMath.Cos
also used the following functions...". Even if it's great for discovering things you might like, you'll have a hard time finding something special.)Agh! Reality! My Archnemesis![^]
| FoldWithUs! | sighist | µLaunch - program launcher for server core and hyper-v server. -
return new Vector3(r * (float)Math.Cos(theta), r * (float)Math.Sign(theta), z);
And I thought I was safe from typos using a strongly-typed language.. :doh: Took me hours to figure this one out.
As someone who started out coding with 'vi' I find it amusing what people find annoying in modern IDEs. Sad that you wasted so much time, but if you think about everything the IDE was doing to help you ... not a lot to complain about there.
-
As someone who started out coding with 'vi' I find it amusing what people find annoying in modern IDEs. Sad that you wasted so much time, but if you think about everything the IDE was doing to help you ... not a lot to complain about there.
He never said he found the IDE annoying: he was just saying that he mistakenly though that he could avoid typos by using a strongly typed language. Silly man :laugh: Typos are inveitable. Truly so. ;P
-
As someone who started out coding with 'vi' I find it amusing what people find annoying in modern IDEs. Sad that you wasted so much time, but if you think about everything the IDE was doing to help you ... not a lot to complain about there.
nothing to do with IDEs in this one. you could write that code in vi and have the same problem :)