From: Nat Pryce Date: 2002-04-23T06:49:40+09:00 Subject: Re: Ruby as Smalltalk From: "Paul Brannan" > On Tue, Apr 23, 2002 at 12:19:43AM +0900, Nat Pryce wrote: > > E.g. in Ruby a user defined control structure if-then-else block would look > > like this, which is more awkward than the built in if statement: > > > > if some_test proc do > > something > > end, else proc do > > something_else > > end > > This seems very awkward to me, much more so than passing two procs to a > single method. I didn't even realize this syntax was legal. Yes I meant to write something that would pass a boolean and two procs to a method, but obviously still had my Smalltalk head on! A correct Ruby version would be like this (I'll use the name myIf because if is a reserved word): def myIf( a_boolean, &then, &else ) ... implementation here ... end ... myIf( x > 0, proc do something end, proc do something_else end )