On Fri, 6 Apr 2001, Clemens Wyss wrote:
> I would have expected that Ruby raised an error here!
> Smalltalk has the following methods:
> at: <key> put: <value>
> which would raise an exception if the key/index does not exist.
Well, Ruby's #[]=(key,value) is not an equivalent to #at:put: method.
It's more like:
if in ordered collection:
if key is negative:
add length to key
if key not found:
if collection is auto-extensible:
extend collection to key+1 elements
else:
whine
now do Smalltalk's (self at: key put: value).
this does not describe support for ranges, lengths, strings, and
regexps, as arguments to #[]= for (ordered) collections that support them.
matju