On Fri, 2002-08-30 at 17:03, Tom Sawyer wrote:
> personally i wish { } brackets always represented a proc and that we
> could pass them easily (and also not require a #call to execute them):
> 
> 	def ameth(proc1, proc2)
> 	  proc1()
> 	  proc2()
> 	end
> 
> 	ameth({puts 'hello'},{puts 'world'})
> 
> 	> hello
>         > world
> 
> then a proc...excuse me, a block, is just a Yeild-able proc. yes, that's
> it.

The advantage of using a call method, rather than some special syntax,
is that it's always possible to implement your own class that
understands call(...), and objects of that class are then
interchangeable with Procs, Methods and any other callable object.

On a related note, I wish that the Ruby interpreter performed automagic
optimisation on Procs/blocks, in the same way that it optimises integers
behind the scenes.

I'd like it if there was no visible difference between a proc and a
block.  At the language level, you would only use proc objects, and
invoke them with the call method.  Internally, the Ruby interpreter
would decide whether to use a block as an optimisation, or instantiate a
Proc object.

Cheers,
	Nat.

-- 
Dr. Nathaniel Pryce, Technical Director, B13media Ltd.
Studio 3a, 22-24 Highbury Grove, London N5 2EA, UK
http://www.b13media.com