Now that Visual Basic has broken ties with its COM roots it is free to continue innovation and advance the platform for the next generation. Microsoft has done a lot of market research and found that VB is being embraced by the younger generation and have embarked on a completely new form of the language.
The typical VB developer has long been associated with the "Mort" persona. Mort doesn't have time for fancy frameworks and elegant code. He just wants to get things done quickly and efficiently and move on to the next problem. Late binding and dynamic execution is king. Even in during inter-personal communication Mort will often use shorthand codes like "BRB" for Be Right Back. With this in mind, the new language is evolving to take advantage not only of Mort's personality but also of the forthcoming DLR. (Dynamic Language Runtime)
Still in the very early stages of development, it is at least two versions away and can't even be called pre-alpha at this point. Through some of my MVP connections that wish to remain anonymous, I have obtained a sneak peak and just have to share it with you. Following are some early examples of the new Visual Basic.
The canonical introductory example:
HAI
CAN HAS STDIO?
VISIBLE "HAI WORLD"
KTHXBYE
HAI - Signals the beginning of the program. Every program starts with HAI.
CAN HAS...? - This is a feature request and replaces the Imports statement. Similar to #include in C++ or "using" in C#.
VISIBLE - The print statement. Sends the output to stdout.
KTHXBYE - Closes the HAI block. Every program ends with KTHXBYE. Does not close any other code blocks.
Here is an example that retrieves a value from the user and outputs that value to stdout.
HAI
CAN HAS STDIO?
I HAS A VAR
GIMMEH VAR
VISIBLE VAR
KTHXBYE
I HAS A - Variable declaration. Currently all variables are of type BUKKIT (array) and BUKKITs are heterogeneous. Future type proposals include NUMBAR and YARN (string).
HAI
CAN HAS STDIO?
I HAS A WHOLE
GIMMEH WHOLE
LOL VAR R WHOLE
KTHXBYE
LOL <l-value> R <expression> - An assignment operator. The value of WHOLE is put into VAR and now I have a WHOLE in my BUKKIT! Sorry, I just couldn't resist.
GIMMEH - Get input from the user. Similar to Console.ReadLine() in .NET. Places the input into VAR.
File access and error handling:
HAI
CAN HAS STDIO?
BTW this file has a list of all my friends in it
PLZ OPEN FILE "FRNDZ.TXT"?
AWSUM THX
VISIBLE FILE
O NOES
INVISIBLE "ERROR!"
KTHX
KTHXBYE
BTW - By The Way. This is the comment indicator and replaces the single quote. Equivalent to REM.
PLZ...? - PLZ...? sets up the equivalent of a try/catch block. AWSUM THX begins the block of code that should be executed if the operation is successful and is implicitly closed by O NOES. O NOES is equivalent to a catch block. The block is closed by KTHX.
OPEN - OPEN handles non-standard I/O. FILE is simply a variable and in this example represents a file handle. Here we see the dynamic nature of this new version. We did not need to declare the variable FILE with I HAS A.
INVISIBLE - Used to output messages to the debug console. (stderr)
I hope you've enjoyed this look into this future version of Visual Basic. I for one am looking forward to the time when this language is embraced by the next generation of "c0d3rz" and "hax0rs" who will most certainly restore the language to its former glory and popularity.
Dave
Just because I can...