From: Charles O Nutter Date: 2006-03-27T15:11:28+09:00 Subject: Re: Tricky block args ------=_Part_12693_26472913.1143439871407 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline That is very good to hear. This short-cut behavior seems counter intuitive to me, and I'm not a fan of unexpected side effects. However, Rails uses this short-cut in several places, and so if we want to run Rails today, we must support this syntax. I look forward to the future reduction of block parameters to local variables. Thank you for the help, I will look at the code in the area you suggest. On 3/27/06, Yukihiro Matsumoto wrote: > > Hi, > > In message "Re: Tricky block args" > on Mon, 27 Mar 2006 13:54:58 +0900, "Charles O Nutter" < > headius@headius.com> writes: > > |We are trying to implement some missing block arg functionality. Could > |someone knowledgable about the more unusual methods of declaring block > args > |point us to where in the C code it is implemented? Specifically, the > ability > |to specify an array or hash location as the target for a block param: > | > |x =3D [0] > |[1,2].each {|x[0]|} > > The assignment to x[0] is done in assign() function, especially at the > code after /* array set */ comment. It's called from rb_yield_0(). > > FYI, in the future, block parameters will be restricted to local > variables only, so that I don't recommend using something other than > local variables for the parameters. > > matz. > > -- Charles Oliver Nutter @ headius.blogspot.com JRuby Developer @ jruby.sourceforge.net Application Architect @ www.ventera.com ------=_Part_12693_26472913.1143439871407--