One of the raps that VB sometimes gets is that we’re too “verbose.” There are a few things that we think might contribute to this perception that we’re looking at for the future, but I had an interesting flash the other day. I wonder how much the fact that we uppercase our keywords affects our perception? So I built a bootleg of the compiler and tried it out on some code of mine. Before:
Private Function ParseSimpleNameExpression() As SimpleNameExpression Dim start As Token = Peek() Dim name As SimpleName = ParseSimpleName(False) Dim typeArguments As TypeArgumentCollection = Nothing If Peek().Type = TokenType.LeftParenthesis Then Dim leftParenthesis As Token = Read() If Peek().Type = TokenType.Of Then typeArguments = ParseTypeArguments(leftParenthesis, False) Else Backtrack(leftParenthesis) End If End If Return New SimpleNameExpression(name, typeArguments, SpanFrom(start)) End Function
After:
private function ParseSimpleNameExpression() as SimpleNameExpression dim start as Token = Peek() dim name as SimpleName = ParseSimpleName(false) dim typeArguments as TypeArgumentCollection = nothing if Peek().Type = TokenType.LeftParenthesis then dim leftParenthesis as Token = Read() if Peek().Type = TokenType.Of then typeArguments = ParseTypeArguments(leftParenthesis, false) else Backtrack(leftParenthesis) end if end if return new SimpleNameExpression(name, typeArguments, SpanFrom(start)) end function
It’s a little frightening how much just changing the casing of our keywords makes us suddenly look like C#, at least to my eyes. I’m curious what people think of the idea? Would you like to see us switch to lowercase keywords? Provide an option?
(My replies to this entry maybe a bit slow–I’m going to be on vacation for a little while, but something to think about while I’m gone…)
As someone who codes in both VB .NET and C#, I like the lower-casing idea. I submit that it’s _more_ readable, similar to the way lower-case text is more readable than upper-case text because lower-case letters have ascenders and descenders. And I agree with those who say it makes the keywords stand out better in comparison to Pascal-cased class and variable names. I would love to lower-case keywords as an option.
And no, I don’t think it looks too much like C#. It’s the braces, more than anything, that make C# look like C#.
Lower case looks, feels and is undoubtedly better. Over capitalizing makes everything look to important and is less "readable". The general rule should be to capitalize as little as possible.
Automatic case of keywords is a dynamic feedback mechanism, with the Intelligent Thinking Machine working with you in real time to develop your program.
Very ’60s, instead of cleverness by obscurity.
If you have a different mechanism (highlighting, font, color) for letting the machine do what machines are still good at — basic systematic repetitive checks–, then you can use that instead of capitalization.
But I think that the only gain is to make it look more familiar by making it look like a case-sensitive language. Better to just drop ‘DIM’ and leave If Then Else capitalised. DIM is wasted space: If Then Else start sentences. Also, remember that Dim originally allowed multiple variable declaration DIM I,J,K; DIM R. The AS syntax broke that. A concise declaration syntax would be welcome, and not to much of a break with BASIC.
I like the lower casing a lot!
I’m a long time vb developer and would definately be in favor of this. I agree with previous post that stated :
"Over capitalizing makes everything look to important and is less ‘readable’"
Lower case keywords is a bad idea IMO. One thing I like about VB is the fact that I can buzz away in lower case and the IDE will auto-capitalize everything it recognizes. This gives me a visual indication that I haven’t mis-typed something as I work. For this reason I ALWAYS mix-case my definitions as well.
Pingback: Panopticon Central
I prefer the capitalizing of keywords, it makes it much easier to read.. But I guess it’s a matter of opinion as some peole here think clearly otherwise..
I also really hate the ‘pretty listing’ option of VB.NET and really would prefer it if there was an option to Disable this module/projectwise, and not developerwise.. I miss the VB6 prettylisting, because there you could at least indent/outline Dim’s and Cases, with the current prettylisting it completely makes any ‘Dim’ more than one line unreadable…
Want to get rid of some of the perceived amateurness of VB? How about a way to not have to use the stupid-sounding AndAlso and OrElse?
For example, you could provide unique bitwise operators and either:
* an option whether And and Or map to the shortcutting logical operators or the bit ones.
* an option that when And & Or are operating on two boolean vales they behave like AndAlso and OrElse, otherwise they behave like the bitwise operators
Visual Studio 2008 lets me get away with lower case keywords.
I mUch preFer
Using AllLowerCase words
since I think MixedCase Makes
The Code HardTo Read When YouAre
Trying to Scan it For AParticularLine of Code
I also prefer it when things are lined up like so
dim name as string = "Jon"
dim reallyLongVarName as string = "line it up"
but then again I was forced to switch from C# to VB at gunpoint.
Well, in the above the "as" keywords were supposed to line up but the web page stripped out the extra spaces. In 2008 go to Tools > Options > Basic > VB Specific and uncheck Pretty Listing (reformating) of code to use lowercase.
I’m way too late on this, and this is even off the subject, but I like that vb is not case sensitive. I try to remember the variable I want in all lower case, and if the case changes, I must have remembered it correctly!
Pingback: Lowercase Keywords Revisited (not an April Fools' Day joke this time, I promise) - The Visual Basic Team - Site Home - MSDN Blogs
when will this lowercase keyword become reality ?