From: David Alan Black Date: 2002-05-10T00:17:36+09:00 Subject: Re: cgi params api Hello -- On Thu, 9 May 2002, Patrick May wrote: > One thing that I don't like is the way cgi forces you to treat every > param as if there were multiples, when most of the time you're dealing > with single params. > > I know you can do things like > > multiple, = cgi["multiple"] > > or > > multiple = cgi["multiple"][0] > > but these seem crufty. Here's an idea I had: > > > # query string => "multiple=something&key=value&multiple=somethingelse" > cgi["multiple"] # <= "something" > cgi["multiple"].multiple # <= ["something", "somethingelse"] > > cgi["key"] # <= "value" > cgi["key"].multiple # <= ["value"] > > > This api would handle the most common case in a very intuitive way for > the programmer. It also allows the programmer to explicitly handle > multiple params. I'm wondering whether there's a nicer name than "multiple" for this -- maybe "all"? "multiple" sounds kind of low-level to me, and also since what you have in mind can return an array of one element, it probably isn't the most accurate term. (I'm not totally sure I wouldn't want to have it be the other way around -- well, I guess that means the way it is now, but maybe with a nice method, like #first, instead of having to do [0]. But since you're doing all the work, I'll shut up :-) David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav