From: Robert Dober Date: 2006-09-28T23:04:23+09:00 Subject: Re: New magical version of Symbol.to_proc ------=_Part_52419_19245238.1159452260383 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline > > > >>> (1..10).to_a.to_ss > > =3D> ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"] > >>> (1..10).to_a.days > > =3D> [86400, 172800, 259200, 345600, 432000, 518400, 604800, 691200, > > 777600, 864000] > >>> [2,'two', :two].classes > > =3D> [Fixnum, String, Symbol] > >>> [2,'two', :two].classes.names > > =3D> ["Fixnum", "String", "Symbol"] > >>> [2,'two', :two].classes.names.lengths > > =3D> [6, 6, 6] > > > > So much happy syntax in one place! > > Actually the reason this is kind of cool is not the syntax but the > semantics. It's much more expressive than any number of &:->()... > things that have been proposed -- and looks better. (There may be > some connection there too.) > > I wonder, though, whether it would be too easy for it to trample on > other method names. I guess that's true of anything -- you'd just > have to make sure you didn't have two conceptions of some plural > thing. I agree, *cool* and *somehow dangerous*, I would very conservatively propos= e a proxy method, similiar in spirit to BDD's rspec#is %w{the meaning of 42}.map.length =3D> [3, too_long_to_count, 2, 2] or maybe not overload #map without params for that purpose? Just an idea of course ;) BTW Using English semantics for Ruby semantics does seem + interesting + avantguarde - intolerant - too dangerous - too early it is great people doing this, I would hate having it in the core though. Robert --=20 Deux choses sont infinies : l'univers et la b=EAtise humaine ; en ce qui concerne l'univers, je n'en ai pas acquis la certitude absolue. - Albert Einstein ------=_Part_52419_19245238.1159452260383--