The Birth of VB ‘Variant’ Uncovered!

Posted on June 16, 2006
Filed Under /dev/null/ | 50 views |

On and off in my career I’ve had cause to use Visual Basic and VBScript (and the bastard child ASP). All have been on the receiving end of much derision and scorn over the years for various, and often much warranted, reasons. One of my biggest peevs with VB was the Variant datatype. Big, unweildy, the default, Variant smacked of being a hack to make the language more pallatable to neophyte (or lazy) programmmers who didn’t know how (or couldn’t be bothered) to type their variables.

I’ve always assumed it was a yet another consession in the language to make it “easier” to use (dynamically-typed language lovers don’t get me wrong, this is not a static-vs-dynamic rant, a good dynamically typed language is a beautiful thing. VB is not this thing). Turns out the truth is even stranger, and Joel Spolsky is to blame:

The Excel team convinced the Basic team that what we really needed was some kind of Visual Basic for Excel. I managed to get four pet features added to Basic. I got them to add Variants, a union data type that could hold any other type, because otherwise you couldn’t store the contents of a spreadsheet cell in a variable without a switch statement.

He could not have known the ramifications that would unfold.

That aside, read the account from which that revelation comes. It’s pretty darned entertaining (if you’re a geek [OMG SQUEEE!]).

Comments

Leave a Reply