Wednesday, June 11, 2008

Do you ever look at it...

And go, “Sweet cheese who came up with that syntax, I think if I could write a compiler I would come up with something more elegant than that load of crap.” I do.

For i As Integer = 0 To msgids.Length - 1

‘Do some crap


I hate the for loops in VB, they are something totally different and crappy than any other for loop I have crossed in my life. I was thinking about this while coding and just had to share and see if anyone else out there agrees. VB.NET For loops go like this:

For i As Integer = 0 To msgids.Length - 1
'Do some crap

The "To" is just so dumb, so assumptive and stupid! Now lets look at C++ derived for loops.

for(int i = 0; i < msgids.Length; i++)
//Do some crap

(In case it stays like that pretend < is actually a less than sign /shrug)

Is it just me or is the C++ style so much more elegant and so much more clear. You do not have to make assumptions you know that what we compare to each time is i but you also know you could change that at anytime to be j*i or whatever, robust and clear vs. odd and assumptive.

After programming in VB.NET for oever a Year (company forced) I have to say I missed the hell out of C++ based languages, luckily my current projects which I will reveal eventually have gotten me back into C#, Javascript, etc where the For loop actually seems logical again.

Rant over and out.

No comments: