Groups | Blog | Home
all groups > dotnet faqs > march 2004 >

dotnet faqs : Why doesnt VB.Net allow semicolons at end of the statement?


Joel Moore
3/31/2004 12:46:29 AM
"Andrew Baker" <no@spam.com> wrote in
news:ebl16LrFEHA.3568@tk2msftngp13.phx.gbl:

[quoted text, click to view]

Hmmm...that's a pretty damn good idea. The semicolon could be just another
comment character. I can't think of any reason why it would break VB (of
course it is 3:45 AM here so I'm a little muddy).

Sadly it'll never happen though.
Andrew Baker
3/31/2004 9:52:49 AM
One of by biggest hassels in the past jumping from C++ to VB and back was
the forgetting or adding a semicolon at the end of a statement. (the other
was bracketing method calls in VB, but that is now fixed).

Why didnt Microsoft allow for the optional use of semicolons in VB, so the
code would be much closer? The compiler would just ignore it anyway.

Another is the difference between new and New. at least VB.Net changes
new -> New for me, but I would have thought it would have been better to
keep the same in both languages (particularly as VB.Net changes the
capitalisation for us anyway)

I know the syntax checking picks these up, but it is just my gripe for the
day.

Andrew

Al Manint
3/31/2004 10:43:07 AM
The main reason I think this is a bad idea is how you read code...

A semicolon is a statement terminator. In VB, the end of line is the
statement terminator unless you use a _ to continue to the next line.

I'm not saying you can't do it but I just think that it would make the code
harder to read...

Al Manint, MCSD (VB 6 ugh), MCSD.NET (C# MUCH BETTER - uses semicolons :)),
MCDBA

(now you know how I sit on this issue: I like semicolons - I just don't
want to have to describe why I have all these semicolons in my vb code if
they are unnecessary.)

[quoted text, click to view]

Michael Mayer [C# MVP]
4/10/2004 4:27:08 PM
You can always do this in your vb code:

If x > 10 Then
x = x * 15 ';
End If

;-)


mike


[quoted text, click to view]

Cristof Falk
4/11/2004 10:58:57 AM
To address your second question, if I'm not mistaken, VB has all
keywords as initial uppercase. If they would have used "new", that
would have been inconsistent.

[quoted text, click to view]
Andrew Baker
4/15/2004 11:18:16 AM
Thers lots of other little things that would also be nice, like autochanging
this to Me

At least ther is no ? : operator, eg (x>10? x; x*=15)

Also conditional short circuiting by default would be nice, with an option
to turn it off for backward compatability. I know you can use AndAlso and
OrElse, but these are pretty poxy.
for backward compatability:
option explicit off
option strict off
option usecrappyoldconditionalparsingandnotconditionalshortcurcuiting on

Andrew.

[quoted text, click to view]

AddThis Social Bookmark Button