From: patrick-may@... (Patrick May) Date: 2002-05-13T17:59:07+09:00 Subject: Re: cgi params api David Alan Black wrote in message news:... > An array seems to me like a more natural container for multiple values > than a string. I guess I'm not sure what you would ever do with such > a string, except split it on $/ and get an array :-) Array is the more natural container for multiple values than a string. A string is the more natural container for a single value. However, given a form, the programmer can safely assumptions, including: + the meaning of different param keys + whether a param should be treated as having single or multiple values Dealing with unexpected input is usually done in the form of sanity checking asserts. Once the input differs from the 'contract' of the form, the correct behavior is usually to fail. After the asserts, the programmer controls how s/he wants to treat the data. This change would make using a singular param easier. In my experience, this is the common case by a long shot. # -- now -- # confusing ways to get a single value name, = cgi["name"] name = cgi["name"].to_s name = cgi["name"][0] name = cgi["name"].join("/0") # quick way to get multiple values multiple = cgi["hobbies] # -- future -- # quick way to get single value name = cgi["name"] # longer, but still quick way to get multiple values multiple = cgi["hobbies"].values ~ Patrick