Hello,

At 21:37 12/05/2002 +0900, you wrote:
>Hello --
>
>On Sun, 12 May 2002, Dossy wrote:
>
> > On 2002.05.12, Sean Chittenden <sean / chittenden.org> wrote:
> > > What's a better API:
> > >
> > > Suppose p['name'] has two values:
> > >
> > > p['name']  >>  val1    # on second call, p['name'] will return a new 
> value
> > > p['name']  >>  val2    # in a round robin fashion
> > >
> > > or
> > >
> > > p['name']  >> ['val1','val2']  # if multiple vals per key
> > > p['name']  >> 'val1'           # if only one val per key
> >
> > My two cents?
> >
> > p['name'] always returns val1.  p['name'].to_a returns
> > the array of values.
>
>"to_a", to_me, suggests something being converted to an array.  That's
>(arguably very) different from what you're describing, which is
>something like the head of the array vs. the whole array.
>
>It's like saying:  'val1'.to_a == ['val1', 'val2']
>which I don't think makes sense.  (I know you're talking about a
>particular case, not generally saying that strings should do that,
>but this is what I think it boils down to.)
>
>
>David

I agree. A more semantically correct could be:
p['name']               >> 'valA'
p['name'].container     >> ['valA', 'valB"]

The ".container" of 'valA' is the array containing all the values.

However, to be semantically correct, .container() should return the
actual container, not a copy of it... that could be dangerous if the
container is a mutable object...

Yours,

Jean-Hugues

-------------------------------------------------------------------------
Web:  http://hdl.handle.net/1030.37/1.1
Phone: +33 (0) 4 92 27 74 17