Tuesday, May 01, 2007

The Visual Basic Language on Silverlight

The terms "Visual Basic," "VB," and "Dynamic VB" have popped up repeatedly in interviews and MIX07 sessions about the Dynamic Language Runtime (DLR). I suggested in my Stealth Dynamic Languages Presentation at MIX07 post that VB for the DLR would be VBScript or a related dialect.

The VB Team posted a VB On Silverlight item this afternoon, which describes (in considerable detail) the features of the VB language supported in Silverlight 1.1 Alpha. Here's an overview that confirms that "VB Lite" or whatever supports LINQ:

When deciding what aspects of the Visual Basic language and runtime should be included with Silverlight v1.1, we tried to follow a similar pattern: we wanted to preserve the core VB programming experience—late binding, conversions, Linq [sic], and so on; and we didn’t want to bloat the download size with anything that wasn’t absolutely necessary or didn’t make sense in Silverlight—things like some of the COM helpers (COM is not supported in Silverlight), financial functions, etc. It was a delicate balance to strike between functionality and overall size.

The current size of the Silverlight 1.1 runtime's .NET Framework is 4.2 MB.

Note: LINQ to XML for Silverlight is scheduled for inclusion post Alpha 1.

The Silverlight 1.1 Runtime download lets you write VB code-behind. The VB team says "It includes a version of the factored .NET Framework, including the VB runtime (Microsoft.VisualBasic.dll)." You'll also need Orcas Beta 1 and the VS Add-On for Silverlight, which includes project templates and IDE changes for building Silverlight applications in VB (and C#).

The Silverlight SDK delivers reference documentation for the VB runtime. According to the post, "[i]t basically details [the] functions and types in Microsoft.VisualBasic.dll."

The Silverlight 1.1 VB implementation Isn't VBx

The Microsoft Silverlight Developer Reference poster has a reference to Visual Basic and VBx under the Languages heading, with VBx carrying a Soon flag which the legend translates to "Post Silverlight 1.1 Alpha."

Paul Vick's What the heck is "VBx"? post describes a cross-platform, hostable version of VB that delivers scripting capabilities similar to VBScript and VBA:

Well, as I've been hinting at for a while now, there's been something I've been working on quite a lot in recent months that I couldn't talk about. With our announcements at MIX07, though, I can now take a bit of the wraps off. "VBx" is our current (subject to change) codename for the next major version of Visual Basic. (The "x" is supposed to signify the Roman numeral X, or 10, since the next major version of Visual Basic is going to be 10.0. The "x" really should be capitalized, but some people were worried there'd be confusion with the old VBX controls. Not that the search engines are really going to draw a distinction. Like VB itself, they're mostly case insensitive.)

Paul continues:

As excited as we are about VBx, it is, unfortunately, not part of the Silverlight 1.1alpha1 released yesterday. Although we have a significant amount of functionality already implemented there is still more work to be done to bring the VBx language support up to the level that we feel is necessary for a productive community preview. Our plans are to have a community preview out later this year, and to talk much more detail about VBx at PDC07.

VBx is the Next Version of Visual Basic

Paul Vick asks the question: After MIX, how many Visual Basic languages are there?

He answers it with "One. Just one. VBx is the next version of Visual Basic, not a new version of Visual Basic." And then he goes on to explain:

What John and Jim demoed [in their Tuesday session], and what the DLR enables, however, is a second scenario. Because the DLR is managed code, it can be run directly on Silverlight. This means that you can actually get a running instance of a DLR language within Silverlight itself. So instead of having to compile an application or library before you can use it in Silverlight, you can simply include the code as a part of the Silverlight application, and the code can be compiled by the DLR language on the fly. This enables the traditional style of client-side applications that you see in AJAX or other libraries. Instead of compiling the library ahead of time, you simply download the client code to the browser when it hits the page, and the code will be compiled and run within the browser in real time.

Will VBx be the Next Version of VBA?

Paul Vick's vision of VBx as "a hostable managed component (written in Visual Basic, no less!) built on top of the DLR" indicates to me that VBx could be Microsoft Office's Holy Grail--a drop-in replacement for VBA in Office 14 and beyond that could run on the PC and Mac. Comments anyone?

Stay tuned to the VB Team, Paul's Panopticon Central and this blog for more details on Visual Basic 10.0.

Technorati tags: , , , , ,