--- gabriele renzi <surrender_it / rc1.vip.ukl.yahoo.com> wrote:
> il Sun, 6 Jun 2004 17:10:57 +0900, Jeff Mitchell
> <quixoticsycophant / yahoo.com> ha scritto::
> >Why should you expect [] to imply hash-like behavior in the first place?  It's
> >just a convenience method.  What was the problem with the #lookup and #store
> >suggestion at [ruby-talk:102505]?
> 
> I believe Sean is correct in saying that what he defines as hash-like
> behaviour is usage of [] with arbitrary objects. S
>  uggesting fetch and store is ok, but for many things it does not work
> (say, pstore does not seem to have #store and #lookup, yet it has
> hash-like behaviour via [])

This is the fault of PStore or of the lack of agreed-upon semantics
for classes with hash-like behavior.  There should be a standard list
which includes the definition of such behavior.  Here, I'll start the
list now:

 hash-like:  #fetch, #store
array-like:  #at, #store

Any others?  How about tree-like?

I want this list to be part of the ruby standard -- clearly
documented so that implementers know they should define #fetch
and #store for the hash-like classes they write.  [] should
be viewed as convenience only.




	
		
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/