Monday, November 14, 2005

 

Language overload

Definitely having a case of language overload. Today I swore to two colleagues that VBScript functions can have optional parameters. What was I thinking! :)

There is really only one documented way to have an optional parameter in VBScript - use an array as the function parameter. Items missing from the array can be defaulted. Another high ranked Google post suggests using objects, but really if you're going to do that why not go full out OOP?

Actually, you can't. VBScript allows you to create classes and instantiate them (it supports constructors and destructors as well) but doesn't support inheritance. Ghetto.

Here's a fun trick - create a recursive function in VBScript and overflow the stack. On a relatively fast machine with 1GB of RAM this took VBScript about 15 minutes to do. It's incredible really that in this age of scripting, a modern language was created that is interpreted rather than compiled to an intermediate language for execution. This is really fun when you forget to pre-declare a variable in a function deep in your program. (Assuming you actually use Option Explicit.) It churns along happily until it encounters this error (which it should have caught at compile time) and your program dies. D'oh!

Interestingly, VBScript is in it's fifth generation (version 5.6 to be exact). How far it's come... not.

The overload continues, though. Today I worked on PHP, C# and VBScript. Good lord. I had a developer telling me about a TCL script I needed to see... Good times though, there's not much I'd rather be doing.

Comments: Post a Comment

Links to this post:

Create a Link



<< Home

This page is powered by Blogger. Isn't yours?