VB and Dynamic Typing

8/28/2005 5:41:42 AM

VB and Dynamic Typing

Eric Meijer wrote “Static Typing Where Possible, Dynamic Typing When Needed: The End of the Cold War in Programming Languages” which I reported about in an earlier post.

The key point he makes is that dynamic features are not intrinsically exclusive to dynamic languages. Features typically associated with dynamic languages including eval blocks, dynamic scoping, expando properties can be implemented on top of a statically typed, statically scoped, stack-based languages.

C# demonstrated some of these initial possibilities in version 2.0 by utilizing heap-allocated frames and compiler-generated state machines to implement both iterators and lambda functions with captured locals.

If we start seeing all of the unique capabilities of languages like lisp completely subsumed into a statically typed world, then Lisp and family will start seeming like really dated languages pretty quickly… For now, I haven’t seen any indications that continuations or macros in imminent in the next version of the CLR.

In a Channel 9 video, Eric hinted about the greater amount of dynamic typing in VB.

One of the things I want to stress is that there is a big spectrum from a completely dynamic language like IronPython to a completely static language like C# or C++. There is also an interesting kind of middle ground. The funny thing is that Visual Basic is right there in the middle, because it allows you to do static typing but it also allows you to do dynamic typing.

…In a year's time people will point at VB as an example of modern language design. Especially because it allows you to span these two worlds  between static and dynamic typing.

I initially thought his article referred to C# extensions (as the article incorporates examples using C# extensions) and also that many of these features were not imminent in the Orcas timeframe.  However, I have reconsidered and now feel that in fact we will see most, if not all, of these dynamic typing and pseudo-dynamic features in Orcas, but these features will primarily be in Visual Basic, not C#.

Some of the features in the article already existed in VB such as late-binding; others that include hash-table objects seem like natural extensions to the VB language.. Simply declare a new variable dim x = new Object and voila you can add instantly expando properties magically; this is the flip-side of being able to perform late-bound calls on any variable of type Object.

Paul Vick, VB developer, also dropped a number of hints of VB’s emerging dynamic personality include one in this post, “VB as a Dynamic Language.” I liked how Eric indicated that these changes will finally make VB an “example of modern language design.” 

With all these changes, VB won’t feel fully like a dynamic language if it doesn’t provide for closures (call them “blocks” if you will), which virtually every other dynamic languages has…

 

Comments

 

Navigation

Categories

About

Net Undocumented is a blog about the internals of .NET including Xamarin implementations. Other topics include managed and web languages (C#, C++, Javascript), computer science theory, software engineering and software entrepreneurship.

Social Media