Bringing Scripting back to VB
Historically Visual Basic has its roots in scripting and dynamic programming, but never fully embraced it. This is seen in mismatched language features such as the ability to consume objects via late binding, a.k.a. duck typing, but no ability to define them. In a presentation at Lang.NET, Paul Vick talks about bringing scripting back to VB.
His first demo shows an Excel prototype that offers a REPL interface with the full Visual Basic engine. REPL, or Read-Evaluate-Print-Loop, is a standard feature for dynamic languages such as Ruby, Python, and Lisp. The scripting window is based on the Dynamic Language Runtime, so it also supports IronPython and JScript.
Paul first discusses the three layers of the VB compiler. On top of the Core services, the traditional compiler features such as parsing and code generation, is the project services. This handle project level details like references and resources. It also has a decompiler which is used in conjunction with the background compiler to make incremental changes when working in the Visual Studio IDE. The outer-most layer is the Tool/IDE services, which includes all the features needed Visual Studio like code completion and error correction.
The full version of core services for VB compiler is written in unmanaged C++ code. A partial version of core services written in Visual Basic also exists for runtime compilation and late binding.
The future version of VB may contain the full version of core services suitable for runtime use. Perhaps this would even include Tool/IDE services layer allowing developers to create a VBA-like experience.
Another demo discusses the VisualBasic.Editor and VisualBasic.Compiler namespaces. This demo shows how to host a VB Editor in a WinForms application. The editor is still fairly rough, but it does already support things like syntax coloring. In the demo, Paul demonstrated overriding the editor's behavior to immediately execute highlighted by right-clicking.
There is no timeline or definite plans for these features. When more information is available it will be posted on Paul Vic's blog.
Todd Montgomery Dec 19, 2014