lowercase keywords, redux

I’m back from vacation and finally got a chance to wade through the 47 comments on my previous entry on lowercase keywords. Anything that touches on lexical or syntatic issues usually provokes a pretty strong response, and I was glad (?) to see that this still held true. Reading through the comments, I think there are a few things that I should add to my previous entry:

  • I was only musing about changing the appearance of keywords and was saying nothing about changing case insensitivity. I like case insensitivity and there are absolutely no plans to propose changing that at all.
  • The purpose of this thought experiment was not to chase some imagined “C# vibe,” it was to see if there is anything that might improve the visual experience of using VB. If I wanted to work on C#, I could walk down the hall, talk to a few people, and it would be done. I wouldn’t even have to move my office, probably. But I don’t. I respect C#, but I really like VB and am always on the lookout to see if there are things that might make working in VB an even more pleasant experience for myself and the millions of other developers out there.
  • I also wasn’t proposing this as some grand solution, it was more of an off-the-cuff curiosity. I agree with the comments that there certainly are other things to look at when we think about lexical simplicity. (My #1 desire is to get an option or something that will make the pretty lister stop adding back the superfluous “ByVal.” My hope was to have that in Orcas, but…)
  • Along with the previous point, I’m not saying this is somehow more important than, say, the few things we didn’t get done in Orcas but wanted to. Not at all…
  • I’m not sure what I was thinking, of course this would have to be an option. There’s no way we’d force something like this on people. In an ideal world, this would be part of a larger constellation of formatting options. We’re well aware that our automatic formatting is not to everyone’s liking and we see this as a place we can improve.

Oh, and I had to bootleg the compiler, as someone observed, not because the core language services wouldn’t accept lowercase keywords, but just to get the pretty lister to stop listing things back upper-cased…

15 thoughts on “lowercase keywords, redux

  1. Josh Stodola

    >>I was only musing about changing the appearance of keywords and was saying nothing about changing case insensitivity. I like case insensitivity and there are absolutely no plans to propose changing that at all.<<

    Phew, now I can finally get some shut-eye. I love the mixed case of Visual Basic, it is so much easier to read.

    One thing I love in C# that VB lacks (well, pretty much) is the one line if statement. Im sure it has a fancy name but I dont know what it is. Looks like this:

    (condition) ? trueResult : falseResult

    It would be awesome to do this in VB. Tell me this would not come in handy:

    Dim Result as String = (Num > 0) ? "Positive" : "Negative"

    I know about the IIF function, but I like the other syntax way better, you can look at it and know what it means.

    Thanks for the redux! Best regards…

  2. Jonathan Allen

    VB 9 Beta 2 has a working inline if.

    Dim x = True

    Console.WriteLine(If(x, "Tree", "Boat"))

    It works the same way as C#.

  3. [ICR]

    Josh – That’s a ternary statement. It’s debatable as to whether it’s good. It’s terse, yes, but it’s also difficult to read. However, that’s generally only when it’s abused. A simple (Num > 0) ? "Positive" : "Negative" is easy enough to understand, but it’s also possible to embed it into the middle of a function, link them together and do all sorts of complicated things like this:

    CallFunction((Num == 0) ? GetZeroString() : ((Num > 0) ? GetPositiveString(Num) : GetNegativeString(Num)))

    And that’s still a very simple example. (Yes, it’s a contrived, bad way of doing things such as localisation).

    I personally would say that bad usage doesn’t necessarily mean it shouldn’t exist. But others would disagree. Personal taste.

    Back on topic, glad you cleared that up for people 🙂

  4. Jack

    "(condition) ? trueResult : falseResult "

    It’s really confusing when you use that one line statement.

    why not make it clear by using the full if statement? does it make you l33t for using one line code?

  5. Raj Chaudhuri

    Perhaps a different color scheme for syntax coloring, or possibly a made-for-VB font?

    Actually, I like the font idea. Our typographic needs are quite different from the symbol-heavy languages.

  6. Fan Shi

    Actually I think VB should consider to simplify the syntax to favor the new requirement of dynamic programming. For example, the implementation requires "Implements" keywords with interface member name in every class member that implements the interface. However, in most case we don’t need to change the implemtation member name or access level, so the "Implements" keyword after every declaration should be optional.

    Simple makes more possible, I think syntax design in the future version should always consider it.

  7. Raj Chaudhuri


    Would you please do a post on the nature of the relationship between the VB compiler and the pretty lister? I find it interesting that you had to bootleg the compiler to prevent the pretty printer from doing its thing.

  8. Steve

    Sorry I’m late to the party, but VB has always had a single line if statement:

    If num>0 Then Result="positive" Else Result="Negative"

    Sometime all this new fancy syntax just overlaps what we’ve always had. People just forget.

  9. Tomas Kirda

    I personally love automatic formatting. I think it even improves productivity, now I don’t need to worry about casing keywords correctly, I know that Visual Studio will do this for me so I save some time here since I am very sensitive about how my code is formatted. Plus, I love that you can configure lots of stuff (like use 2 spaces instead of tab) under tools->options.

  10. ASH


    The two things aren’t the same.

    A ternary function is a conditional assignment, not just an "single line if".

    I look forward to the ternary assignment in vb.net.

  11. Pingback: anothr user

  12. Diego Vega

    Paul, I said it in the comments of your previous post: Lower case keywords look nice. I think I could quickly get used to it. It may end up being more readeable because it makes pascal and camel case identifiers stand out.

    To other commenters: The inline if is comming. Look for it in previous posts.

  13. david

    c = (a=b)

    I0 = – (c and I1) or ((not c) and I2)

    BASIC always had inline if, but it was never extended or developed.

    Speaking of which, it’s good to see that DATA statements are making their way back into the language.

    Also, have you considered assigning a fixed key value to each line? You can use a line key in test and for source-level crash-dump analysis. Unlike line numbers, a fixed key value stays constant when you refactor your code. Of course, it needs to be supported by the IDE, and by your test and debug tools.

    Now that C# has more-or-less come around to the BASIC way of thinking (we won the war but lost the battle – they even have virtual methods now!), perhaps we could introduce them to a few more good ideas from the past?

  14. Michael Irwin

    I was finding my first serious work in VB fine with the auto-formatting. Then VS crashed one day and when I restarted it I found that the prettifier didn’t pretty things any more. Sure, indentation still works, sort-of, but none of the key-words is capitalised unless I actually type it that way (auto-completion of an "if" statement after you add the "then" gives "End If", but doesn’t capitalise the first two words. If you put a statement and then a return and an "else" and a return the editor should (IMHO) realise what an "else" is and outdent it to the enclosing "If" and "End" statements. Maybe too difficult, but I’ve seen it done with Pascal (a product called Alice), and with Modula-2, both of which have the same structure.

    Personally, my main beef isn’t with VB 2005 – it’s nice to work with in VS – but with people who either don’t put the hints in the intellihelp or else provide examples that don’t work with VB 8. Why ? Because I’ve never used VB.NET before and I haven’t a clue what it used to be in order to make a guess of any sort of what it should be now.

    Accessing the data held in app.config is a good exampe of this – a particularly brain-dead decision to change it after the docs had been signed-off on. Still, I’m sure that that’s been thrashed to death by now !


Leave a Reply

Your email address will not be published. Required fields are marked *