Hi --

On Tue, 15 Mar 2005, Nick Woolley wrote:

> Hello,
>
> Curt Hibbs wrote:
>> I agree. In fact it was my positive experiences with JavaScript that
>> attracted me to Ruby.
>
>
> I've had positively *painful* experiences with ActionScript (a variety of 
> ECMAscript).  The main pain was in the debugging of small errors, often 
> introduced during refactoring.  A misspelt variable comes to life like a 
> gremlin and things break mysteriously.  Add to this ActionScripts byzantine 
> scoping rules (which Javascript may lack). Tracking it down requires 
> binary-search style debug prints, and wasted so much of my time I was tearing 
> my hair out.
>
> In fact one of the things which worries me a bit about Ruby, as a newcomer, 
> is that instance variables come to life in the same way - no variable 
> declarations.
>
> I'm curious if you liked JavaScript despite that, or if you found a way 
> around it?  Likewise, is autovivification an issue in Ruby I should beware 
> of?

You do have to be careful spelling instance variables, as they default
to nil.  Autovivification in the sense that the term is used with
respect to container objects, though, does not happen in Ruby; that
is, if you say:

   x[1] = 2

you'll get an error unless x exists already.  (There's no way for x to
autovivify here, since variables are untyped [unlike in Perl, say], so
x could be anything with a #[] method.)


David

-- 
David A. Black
dblack / wobblini.net