From: MenTaLguY Date: 2005-11-04T21:52:23+09:00 Subject: Re: [ANN] lazy.rb --=-MIR4BzBPMjYxad4/vjsX Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Fri, 2005-11-04 at 16:42 +0900, Pit Capitain wrote: > Hi mental, >=20 > do you have some unit tests or an example where implicit forcing isn't=20 > working as you'd like? Err... unit tests. Those would be nice. But, here are a couple examples: blah =3D promise { 3 } p blah.methods.include? "+" # =3D> false, failed to force force( blah ) p blah.methods.include? "+" # =3D> true ...and: foo =3D promise { 3 } begin p [][foo] # TypeError: can't convert Lazy::Thunk into Integer rescue TypeError =3D> e puts e end force( foo ) p [][foo] # =3D> nil Same problem in both cases, basically. Oh, and if you try these in irb, remember that you will get different results because irb's attempt to display the result value will force the promise. -mental --=-MIR4BzBPMjYxad4/vjsX Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQBDa1mccUNIGiXCc4MRAnLjAKCPySixdpXlOlftu3can8gatLhe6wCeIw9N gqZn/M6asBM8YCeFBJl0ZaM= =IyHW -----END PGP SIGNATURE----- --=-MIR4BzBPMjYxad4/vjsX--