After MIX, how many Visual Basic languages are there?

One. Just one. VBx is the next version of Visual Basic, not a new version of Visual Basic.

Part of the confusion stems from the fact that there are TWO ways you can use Visual Basic in Silverlight, and one uses Orcas and one uses VBx. So let me see if I can clarify a little bit…

As everyone should be aware now, Silverlight is a cross-platform version of the CLR. This means that Silverlight, with some limitations, can run any compiled IL application or library that the desktop CLR can run. This also means that (again, with some limitations) Visual Basic applications or libraries that have been compiled into IL on the desktop can be downloaded and run on Silverlight. If you go and read Joe’s VB on Silverlight entry, he points you to how you can do this today–build a VB application or library using Orcas Beta 1 and then run it on Silverlight.

You’ll notice that what you have to do in this scenario, though, is compile your application or library on the desktop and then run it in Silverlight. You can’t take your application or library in source code form, send it to Silverlight and have it compiled on demand within Silverlight itself, because the Orcas Visual Basic compiler isn’t a part of Silverlight. So, for example, if I was to embed a Silverlight application in a web page viewable on the Mac, I have to build my libraries ahead of time and deploy them to the web server to be downloaded when someone hits the page.

What John and Jim demoed, 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.

This is where VBx, the next version of Visual Basic, comes in. Part of VBx is a hostable managed component (written in Visual Basic, no less!) built on top of the DLR. Since Silverlight can host DLR languages, this enables you to send Visual Basic code to a Silverlight instance and have it dynamically compiled and run. So when the Mac hits your webpage, you don’t have to send a binary at all, you can send just source code. When you want to modify your application, you don’t rebuild, you just modify the source code sent to the browser and refresh the page and there you are!

The important thing to keep in mind is that there is still only ONE Visual Basic language but once VBx arrives you’ll have more than one way of getting to it. You’ll still be able to compile code into the traditional .DLL or .EXE, but you’ll also have the option of compiling and running the code on the fly, within a running instance of the CLR. That’s where things are likely to get interesting…

6 thoughts on “After MIX, how many Visual Basic languages are there?

  1. RichB

    So there are 2 compilers. The compiler called vbc and the DLR compiler built on the Microsoft.Scripting AST?

    So, if there are 2 compilers, there is a high potential they will not implement the language specification in the same way. There will be edge case scenarios in one of the compilers that function differently in the other (c.f. the C# compiler edge cases Eric Lippert has been talking about recently).

    > Silverlight, with some limitations, can run any compiled IL

    What are those limitations? I imagine one of them is unverifiable code is not supported. And code which uses unsupported libraries are obviously not supported. What other IL instructions are not supported? Tail call?

    Reply
  2. Pingback: OPC Diary

  3. Pingback: Joycode@Ab110.com

  4. Pingback: Frank La Vigne

  5. Mike

    "Part of the confusion stems from the fact that there are TWO ways you can use Visual Basic in Silverlight, and one uses Orcas and one uses VBx."

    No no, part of the problem is the huge amount of stuff Microsoft is going to release, and the use of code names and acronyms. Tell me, what exactly is Orcas? Is it an IDE, a language, a version (version of what, compilers, framework)? In you sentence that I quoted above: how can Visual Basic ‘use’ VBx? That’s confusing.

    Reply
  6. paulvick

    Mike: I probably could have more accurately said, "…from the fact that there are TWO ways you can run Visual Basic code in Silverlight, and one uses the Orcas compiler and one uses the VBx compiler."

    Reply

Leave a Reply