On Feb 13, 2007, at 3:34 PM, Jason M. wrote:
Right… but isn’t the assignment of the value ‘nil’ going to
since the assignment succeeded? I remember screwing up a program by
forgetting to put in the extra = sign once… my if blah = blah2
always returned true because the assignment occurred.
The value associated with an assignment statement is the value of
the right hand side of the assignment.
It is somewhat nonsensical to ask whether an assignment ‘succeeds’ or
The only way for an assignment to fail would be a syntax error or some
sort of exception while evaluating the right hand side, in which case
the assignment won’t be evaluated as an expression at all.
It may help to remember that nil is simply a literal reference to a
particular object in the same way that 1 is a literal reference for a
particular Fixnum object (the one that behaves like the number 1).
Don’t think of nil as meaning the absence of any object but instead
think of it as the unique object known as nil.