From: zuzu Date: 2004-07-09T20:58:23+09:00 Subject: Re: I love Ruby On Fri, 9 Jul 2004 20:28:41 +0900, Kaspar Schiess wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > | why are 'begin...end' and { } not always equivalent? > This comes up once in a while, tell me if this answer is short enough: > > def foo(arg=nil) > if block_given? > puts 'foo got block' > end > end > > def bar(arg=nil) > if block_given? > puts 'bar got block' > end > end > > foo bar do end # > foo got block > foo bar {} # > bar got block > > best regards, > kaspar why the difference in scope? why does 'do...end' pass into foo instead of bar? p.s. "foo bar" feels quite ambiguous without any defining ( ). > semantics & semiotics ever look at "general semantics" by alfred korzybski? do you have any opinion on fred dretske w/r/t semiotics? > code manufacture > > www.tua.ch/ruby > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.2.4 (MingW32) > Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org > > iD8DBQFA7oKYFifl4CA0ImQRAn/NAKCH39gW0a58Uw/Y3eiNnxStOPVRtACgmNRF > Mpz4p0OGorKJ3ic+Wyje150= > =XIcv > -----END PGP SIGNATURE----- > >