From: "David A. Black" Date: 2008-09-17T19:02:36+09:00 Subject: Re: Advanced conditionals --1926193751-1005125300-1221646203=:8908 Content-Type: MULTIPART/MIXED; BOUNDARY="1926193751-1005125300-1221646203=:8908" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --1926193751-1005125300-1221646203=:8908 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Hi -- On Sat, 13 Sep 2008, Pe=F1a, Botp wrote: > From: David A. Black [mailto:dblack@rubypal.com] > ... >>> e =3D [1,2,3].select{|n| n>1},{|x| x*10} >> =3D>[20,30] >> >> meaning, do a (re)map if a second code block is passed >> That comes up periodically.... It never appealed to me; I guess I >> think of it like a method having two argument lists. Besides, how > > indeed. and i think we agree to disagree there. > i prefer that code blocks be generics and be passed like normal > arguments. ergo, they will now be explicitly defined in def. less > invisible ink? ;) It's not really an invisible ink thing -- more about the semantics or anatomy of a method call. The thing is, you can already pass procs as normal arguments, so if you allow that to happen without specifying that they are procs (i.e., {} instead of proc {}), the main effect is that you lose the concept of the code block, and presumably you lose yield. So all you gain, really, is not having to write "proc". I don't think it's worth it; I like the whole block/yield/iterator thing too much. >> would you distinguish it from a hash literal? :-) > > strengthen the parser. currently, since a code block come last, then > the rest should be code blocks, if any. also, if a token arg > sequence of "{|" is caught, then that should start a code block. > meaning {||} is always a code block. That's ugly, though -- you'd end up with a lot of empty ||'s. David --=20 Rails training from David A. Black and Ruby Power and Light: Intro to Ruby on Rails January 12-15 Fort Lauderdale, FL Advancing with Rails January 19-22 Fort Lauderdale, FL * * Co-taught with Patrick Ewing! See http://www.rubypal.com for details and updates! --1926193751-1005125300-1221646203=:8908-- --1926193751-1005125300-1221646203=:8908--