Of cause, you can do arr[3] = undefined;, but still: choosing between
null and undefined, undefined seems to carry the meaning better than
null.
No, you can't. You can do arr[3] = "undefined" (string assignment), but not without the quotes as undefined is, well, undefined.
On 9/22/06,
Martin Bialasinski <[EMAIL PROTECTED]> wrote:
On 9/22/06, Thomas Fuchs <[EMAIL PROTECTED]> wrote:
>
> hmm-- i've modelled it after the rails ruby extension[1].
Which uses nil.
> Note that the german version of the article is much clearer and
> mentions the synonymity of null and nil explicitly.
I believe the english version has some good points, see below.
> So null in _javascript_ should be equal to nil in Ruby.
There are reasons to say nil in Ruby == undefined in _javascript_.
The Wikipedia article distinguishes between two meanings:
Quote: Null is a special value for a pointer (or other kind of object
reference) used to signify that the pointer intentionally does not
have a target. [...] Some languages use other nomenclature for such a
pointer, e.g., nil, undefined, void reference, etc.
=> undefined in _javascript_, nil in Ruby
Quote: In many disciplines, the concept of null allows a three-valued
logic, with null indicating "unknown value".
=> null in _javascript_. What about Ruby, does it have something similar?
_javascript_ supports both concepts with null and undefined
respectively. Using undefined instead of null makes sure, that you can
have an array with members using this three-valued logic.
Furthermore: "var foo;" depicts a variable that does not have a value.
foo is undefined, not null. And I believe this is what the filler
elements are. Array members that do not have a value (that are
undefined), because they were not part of the original array.
Of cause, you can do arr[3] = undefined;, but still: choosing between
null and undefined, undefined seems to carry the meaning better than
null.
--
Ryan Gahl
Application Development Consultant
Athena Group, Inc.
Inquire: 1-920-954-9798 x2903
Blog: http://www.someElement.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs
-~----------~----~----~----~------~----~------~--~---
