From: quixoticsycophant@... (Jeff Mitchell) Date: 2003-09-08T01:36:06+09:00 Subject: Re: proposal for a named parameter prefix nobu.nokada@softhome.net wrote in message news:<200309071005.h87A5o4D004546@sharui.nakada.kanuma.tochigi.jp>... > Hi, > > At Sun, 7 Sep 2003 04:13:18 +0900, > Jeff Mitchell wrote: > > I propose: > > > > def foo4(*array,%params,&block) > > array.each do |a| > > # ... > > end > > params.each do |key, value| > > # ... > > end > > @callback = block > > end > > > > from above, > > > > def foo3(%what_is_this) > > # ... > > end > > > > Aha there's a percent sign so we know it's a hash. > > Why does a percent sign mean a hash? Because it was the arbitrary character I chose in the proposal above. Also, "coincidentally", it happens to be perl's sigil for hash (just like "&" happens to be perl's sigil for code block). It doesn't have to be a hash per se, just "the thing that holds named parameters". > > > To summerize, "%" gets us two things > > > > (1) a nice signal to let everyone know a named parameter hash is > > there > > > > (2) the ability to mix variable-length arguments with named > > parameters (in a nice way) > > IIRC, matz has thought ** for it. Hm? My first reaction is that it would be confusing since ** suggests "splat twice" (whatever that means). -- Jeff