[Javascript] combining Javascript & VBscript

Paul Novitski paul at dandemutande.org
Wed Mar 31 00:44:41 CST 2004


Dave,

VBscript is almost as loosely typed as Javascript: all variables are the 
'variant' type.  This sequence of statements is perfectly valid:

         dim Thang
         Thang = "abc"
         Thang = 4
         Thang = Now

The only variable type you can't intermix like that is the array.

I like VBscript's parent language, Visual Basic, because it's got strict 
types but also the variant type that can store other types.  I like strict 
typing because it helps me write tighter, more robust code, and I like 
loose typing in situations where I need to juggle unknown input without it 
pinching my fingers.

P


At 07:42 PM 3/30/2004, you wrote:
>Well, some might say that redefining a variable (either by value, or by
>type) might be useful, just as redefining an array might be.  If VBScript
>doesn't support that in some fashion, I'd say it has a serious problem.
>
>-- Dave Lovering
>
>----- Original Message -----
>From: "Paul Novitski" <paul at dandemutande.org>
>To: "[JavaScript List]" <javascript at LaTech.edu>
>Sent: Tuesday, March 30, 2004 11:45 AM
>Subject: Re: [Javascript] combining Javascript & VBscript
>
>
> > One serious advantage VBscript has over Javascript is the enforcement of
> > unique variable names.  Accidentally naming two variables the same can
> > cause problems that are hair-pullingly difficult to detect & debug in a
> > complex application.
> >
> > Javascript blithely allows:
> >
> >          var thingie = "a";
> >          var thingie = "b";
> >
> > whereas VB chokes on:
> >
> >          dim thingie
> >          dim thingie
> >
> > and generates a runtime (compile) error "Name redefined".
> >
> > Alas, neither script seems to enforce uniqueness of function names, taking
> > (in my experience) the last instance of a function as the one to run when
> > it's called.
> >
> > Paul
> >
> >
> >
> > At 10:28 AM 3/30/2004, Chris T wrote:
> > > > for example Javascript's string methods or, gosh, I don't
> > > > know, maybe VBscript's high-level date & time formatting.
> > >
> > >That seems to be the biggest reason to want to do it. If you're going
> > >straight VBScript, you will be limited in that you can't get Milliseconds
> > >I don't believe, but JS can do that.
> > >
> > >And like you said, the built-in formatting of dates is probably
> > >superior  in VBScript.
> > >
> > >Chris Tifer





More information about the Javascript mailing list