Some More Notes on VB

1/27/2004 10:30:48 AM

Some More Notes on VB

I have some familiarity with the history of VB. I do know that, at one time, VB.NET was originally planned to be more faithful to traditional VB. VB was still going to have two polymorphic types, Variant and Object. Variants, which still exist as an internal structure in the System namespace but can only be seen through reflection, actually performed substantially better than Objects initially, but, over time as .NET developed, the differences grew smaller and the weight of supporting and testing two catch-all types grew heavier. Ultimately, variants were dropped.

For example, since Objects could now hold primitive data types, a conversion from Objects to Variants became much more expensive. Objects needed to be checked to see if it is any one of a set of fundamental types via IConvertible, after which it must be converted to the appropriate representation of a Variant.

With the loss of support for Variants, it looks like VB runtime functions like CInt were rewritten to take Object parameters instead of Variants. Hence, a large amount of boxing was introduced, since, Objects, unlike Variants, are reference types. Native versions for VB's functions were probably not in the high priority list, because of the huge cost of porting VB to .NET and retaining compatibility.

VB had a lot of other legacy/compatibility issues that ultimately held back full support of .NET. In constrast, C# was built from scratch. I pretty sure that the VB designers wanted to cover the full range of the CLR, but had pressing issues of their own to deal with. With Whidbey, perhaps, we will see VB.NET as it was originally envisioned but never fully realized. For example, we see some reemergence of forgotten technologies, such as Control Arrays (most likely not a VB-only concept) and Edit-and-Continue.

I wanted to link to a webpost that compare the IL generated by VB and C#, and found that VB's IL tended to be more verbose. I can no longer find that post. If anyone knows, please leave a comment.

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