[#3986] Re: Principle of least effort -- another Ruby virtue. — Andrew Hunt <andy@...>

> Principle of Least Effort.

14 messages 2000/07/14

[#4043] What are you using Ruby for? — Dave Thomas <Dave@...>

16 messages 2000/07/16

[#4139] Facilitating Ruby self-propagation with the rig-it autopolymorph application. — Conrad Schneiker <schneik@...>

Hi,

11 messages 2000/07/20

[ruby-talk:04005] Re: Pluggable functions and blocks

From: Aleksi Niemel<aleksi.niemela@...>
Date: 2000-07-14 10:51:17 UTC
List: ruby-talk #4005
Aleksi makes a question:
> |Why we have bounded methods, like blocks, but not 
> semibounded, like instance
> |methods, nor unbounded, like classmethods?

Matz answers:
> Besids blocks, We have bound methods, which are generated by
> Object#method.  I guess method can not be separated from its receiver.
> In addition, We have implementation obstacle too.

Yep, I see. Unbounded methods would require changes to the Ruby core, right?

Well, my posted implementation for InstanceMethod separates the concept of
method from the receiver. You just hold reference to instanceMethod and
'.call' it when needed. But in not so abstract level it has to maintain the
reference to the instance of course.

But aren't Proc objects quite close to the unbounded methods. Now, if only
they'd work like methods (multiple returns, same kind of argument passing,
associated iterator handling) and you could choose should they bind anything
from the context when created.

	- Aleksi

In This Thread

Prev Next