From: "Mariusz Pękala" Date: 2007-05-30T17:44:45+09:00 Subject: Re: Introducing the "it" keyword --zYM0uCDKw75PZbzx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2007-05-30 02:00:28 +0900 (Wed, May), Trans wrote: > > > Thx for your time, I shall probably say what I think about all of thi= s: > > > (a) > > > return v if ((v =3D 42) % 2).zero? > > > would be nice if it worked > > > (b) > > > I am against fancy enhancements that are purely for optimization but = see > > > above. > > > > We are completely on the same page with this. >=20 > I concur. From what I understand, this _will_ eventually work: >=20 > return it if ((it =3D 42) % 2).zero? >=20 irb(main):005:0> def check; return it if ((it =3D 42) % 2).zero?; end =3D> nil irb(main):006:0> check NameError: undefined local variable or method `it' for main:Object from (irb):5:in `check' from (irb):6 Or you mean it _will_ work in future ruby version? Anyway, it really would be nice if such construction would work, but it's not a big problem to express it as: if (x =3D complex_calculation); return x; end In my humble opinion, the 'problem' is not very important (forgive me my limited vocabulary, I really don't want to offend anyone), since I suppose that following code clearly/better shows the *intentions*: avoiding performing complex calculation twice, and freeing the possibly large object for GC. x =3D complex_calculation use(x) if x.is_ok? x =3D nil --=20 No virus found in this outgoing message. Checked by 'grep -i virus $MESSAGE' Trust me. --zYM0uCDKw75PZbzx Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7-ecc0.1.6 (GNU/Linux) iD8DBQFGXTlssnU0scoWZKARAsNMAJ4vNIKFiVzfBEwQDbouIZ4/n+eo1ACgstDb UwMCLlUGkyXa6s4ooIfJw1M= =5ten -----END PGP SIGNATURE----- --zYM0uCDKw75PZbzx--