From: Robert Dober Date: 2009-01-09T06:34:27+09:00 Subject: [ruby-core:21223] Re: Definable != is a Bad Thing??? On Mon, Jan 5, 2009 at 9:37 AM, Kornelius Kalnbach wrote: > Robert Dober wrote: >> You sure could >> def && a, &blk >> return blk.call if a >> a >> end >> >> and >> a && b >> is syntactic sugar for >> &&(a){b} > mmh...the problem is, if you assign to a new local variable inside the > block, like foo && (bar = 42), it matter whether the second operand has > its own scope. Does it have it's own scope? 559/81 > cat environement.rb && ruby environement.rb #!/usr/local/bin/ruby # vim: sw=2 ts=2 ft=ruby expandtab tw=0 nu syn=on: # file: environement.rb def x( a, &blk ) blk.call end x( b = 42 ){ p b } 42 or did I missunderstand? R. -- It is change, continuing change, inevitable change, that is the dominant factor in society today. No sensible decision can be made any longer without taking into account not only the world as it is, but the world as it will be ... ~ Isaac Asimov