From: Robert Dober Date: 2008-05-27T21:53:40+09:00 Subject: Re: OOP in Ruby? On Tue, May 27, 2008 at 2:20 PM, Huw Collingbourne wrote: > aidy wrote: >> On May 26, 3:59 pm, luka luka wrote: >>> In Ruby, everything is an object. >> >> The 'if' expression is not an object. >> > > There are many things in Ruby that are not objects - not only keywords > but also, for example, blocks. While blocks can be 'converted' into > objects (Proc objects), unlike in some other languages (such as > Smalltalk), Ruby blocks do not automatically have an independent > existence I agree upto here, but... >- that is, just writing a block in code does not make it an > instance of a Block (or Proc) class. I however believe it does, if you write a block in Ruby it is always passed on to a method, let that be Kernel#proc, Enumerable#map or whatever, that means that a Proc object referring to the block is always accessible via either the prefixed &blk parameter in this method or in case there is not &blk parameter and yield is used in the method it still is accessible as Proc::new without parameters Example from a unit test def a &blk b = Proc::new assert_equal blk, b assert_equal b, Proc::new assert_kind_of Proc, blk end Not using this reference does not mean it does not exist IMHO. Cheers Robert > > best wishes > Huw > > SapphireSteel Software > Ruby and Rails In Visual Studio > http://www.sapphiresteel.com > -- > Posted via http://www.ruby-forum.com/. > > -- http://ruby-smalltalk.blogspot.com/ --- Whereof one cannot speak, thereof one must be silent. Ludwig Wittgenstein