Hi --

On Mon, 13 May 2002, Dossy wrote:

> On 2002.05.13, David Alan Black <dblack / candle.superlink.net> wrote:
> > > True, but in the Ruby idiom, cgi["name"] ought to return a
> > > single value.  If you want to iterate over all the values,
> > > you ought to do a cgi["name"].to_a.each to coerce the values
> > > into an array to iterate over.
> >
> > Do you mean the CGI idiom?  In Ruby, a hash value can be (and often
> > is) anything, including an array (which really is a single value, or
> > rather a single object).
>
> Sorry, it's 7:50 AM and I'm still in the "playing with my two
> year old daughter" mental mode -- you're right, I meant the CGI
> idiom.

I'm in "about-to-drive-50-minutes-in-the-rain-to-graduation" mode,
which is probably only marginally better :-)

I guess a lot of what we've been talking about comes down to the
question of whether there really is a CGI idiom -- that is, whether
it's more natural, intuitive, etc., for the simplest expression in a
programming language to correspond to this or that aspect of CGI
behavior.  In a sense, a single-value CGI param is just a special case
of a multi-value one (since any param, I think, *can* be multi-value,
given the right query string).  So then the question is: what's a
special case of a multi-value array in Ruby?  A one-value array, or a
string?


David

-- 
David Alan Black
home: dblack / candle.superlink.net
work: blackdav / shu.edu
Web:  http://pirate.shu.edu/~blackdav