Lowercase Keywords Revisited (not an April Fools’ Day joke this time, I promise)

Hey all,

I hope you enjoyed yesterday’s April Fools’ Day post. I thought it was a fun way to kick off an experiment I’d like to conduct and in this post I’ll tell you how you can actually try out lowercase keywords for VB on your machine right now no matter what version of VS you’re using (no joke).

You see, a few years back Architect-emeritus Paul Vick asked a question, “Do PascalCased keywords make VB look more verbose than it really is?” At the time I didn’t really give the question enough thought but a lot of commenters responded positively about the look (both then and yesterday) and recently I got to thinking about it again. It is true both that VB uses capitalized words far more often than in natural English text and also that programmers exposed to lots of other programming languages probably also aren’t used to so many uppercase characters. I can imagine how this could magnify the perception of VB’s verbosity so I set out to figure a way to actually test the hypothesis. What I came up with was a special proof-of-concept font: Glamour. How it works it pretty simple: Visual Studio can make keywords appear any color you want. But it can also make keywords appear bold. I made a font where the bold version is the same as the regular version but with all of the uppercase letters using the lowercase glyphs. So when this font is installed and selected as the text editor font and keywords are configured to be bold Visual Studio renders them in all lowercase instead (An elegant hack, huh?).

There are several advantages to this approach:

  • Anyone using any version of Visual Studio can try it out.
  • It’s just a presentation thing (a glamour); it won’t cause the pretty-lister to modify an existing file nor will it affect the way the text is actually saved, so…
    • It won’t affect anyone else on your team if they don’t want to try it or don’t like it,
    • You won’t have to undo any changes if you don’t like it,
    • If a lot of people like it they can use it without half the VB code in the world using PascalCased keywords and the other half using lowercase keywords.

Of course, if you look at your code outside of VS or copy/paste it into another program or do anything to make the code not parse as keywords (like commenting out a block of code) it’ll revert to its normal PascalCased look. But for playing around with an idea I still think this is a good enough approach to get a feel for whether you like it or not. Like I said yesterday, when I started programming in QBasic all of the keywords were in SCREAMING CAPS so it’s not like the current style is etched in stone. Who knows, maybe this is popular enough that we add an option to Visual Studio for this kind of thing (no promises!).

I named the font Glamour (like a magical illusion spell) in recognition to its appearance-only effects. It’s entirely based off of the popular open source font Inconsolata by Raph Levien (itself influenced by the popular Microsoft font Consolas) and you can try it out right now:

  1. Download Glamour from my GitHub repo.
  2. Install it by drag/dropping the truetype font (.ttf) files in your %SystemDrive%\Windows\Fonts folder.
  3. Change your text editor font in the Tools > Options > Fonts & Colors dialog to Glamour.
  4. Select “Keyword” in the “Display Items” list and check the “Bold” checkbox.
  5. You’re all set. Happy coding!

If you’re a longtime VB user like myself who’s interested in trying something a little different, or someone used to other languages who wants to give VB a more familiar look and feel go ahead and try it out and let us know what you think.

Regards,

Anthony D. Green, Program Manager, Visual Basic, C#, and F# Languages Team