From: Louis J Scoras Date: 2005-10-25T06:16:53+09:00 Subject: Re: A comparison by example of keyword argument styles ------=_Part_913_19583841.1130188609718 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 10/24/05, Ara.T.Howard wrote: > > > > meth 'hello ', 'world', 'useless', :meat =3D> 'steak', :side =3D> 'potato= es' > > harp:~ > ruby a.rb > Good, I got to say hello world. > You thought of my third request was useless > For dinner we have steak > With a side of potatoes > > > note. it's impossible to determine, if an argument is optional (your > 'request' > above) if the last hash passed __is__ that optional argument itself or if > it's > the set of keywords. therfore you must pass 'useless' for the request in > this > case - if you think about it the parsing is otheriwse impossible. > > Couldn't you require an explicit hash then, if it is intended to be slurped into the optional parameter? You need to magically realize that this is a hash in the first place. meth 'hello ', 'world', :meat =3D> 'steak', :side =3D> 'potatoes' response =3D 'useless' meat =3D 'steak' side =3D 'potatoes' Would be distinguished from this: meth 'hello ', 'world', {:meat =3D> 'steak', :side =3D> 'potatoes'} response =3D {:meat =3D> 'steak', :side =3D> 'potatoes'} And this: meth 'hello ', 'world', {:meat =3D> 'steak'}, :side =3D> 'potatoes' response =3D {:meat =3D> 'steak'}, side =3D 'potatoes' ------=_Part_913_19583841.1130188609718--