[#927] UnboundMethod#to_proc — Dave Thomas <dave@...>
I'm wondering what I can do with a Proc generated by
17 messages
2003/04/06
[#929] Re: UnboundMethod#to_proc
— "Chris Pine" <nemo@...>
2003/04/06
----- Original Message -----
[#934] Re: UnboundMethod#to_proc
— Mathieu Bouchard <matju@...>
2003/04/06
[#940] Re: UnboundMethod#to_proc
— chr_news@...
2003/04/07
>
[#941] Re: UnboundMethod#to_proc
— Dave Thomas <dave@...>
2003/04/07
>> If they have diverging interfaces such that the contracts conflict
[#936] docs on implementation of ruby and/or ruby-gc ? — Ruben Vandeginste <Ruben.Vandeginste@...>
4 messages
2003/04/07
[#964] Range in logical context — Dave Thomas <dave@...>
If I run
7 messages
2003/04/16
[#965] Re: Range in logical context
— Mauricio Fern疣dez <batsman.geo@...>
2003/04/16
On Thu, Apr 17, 2003 at 06:10:40AM +0900, Dave Thomas wrote:
[#973] problem with rb_rescue2() ? — Mathieu Bouchard <matju@...>
5 messages
2003/04/19
Re: UnboundMethod#to_proc
From:
Dave Thomas <dave@...>
Date:
2003-04-06 14:38:11 UTC
List:
ruby-core #931
On Sunday, April 6, 2003, at 05:51 AM, Yukihiro Matsumoto wrote:
> Hi,
>
> In message "UnboundMethod#to_proc"
> on 03/04/06, Dave Thomas <dave@thomases.com> writes:
>
> |I'm wondering what I can do with a Proc generated by
> |
> | UnboundMethod.to_proc
>
> The error message gives what you can do:
>
> % ruby -e 'Kernel.instance_method(:printf).to_proc.call("foo")'
> -e:1:in `to_proc': you cannot call unbound method; bind first
> (TypeError)
> from -e:1:in `call'
> from -e:1
>
> so, bind UnboundMethod first, then call to_proc.
>
But then to_proc is being called on a Method, not an UnboundMethod. If
there's no way of adding a binding to the Proc, then I suggest that we
change UnboundMethod#to_proc always to raise an exception, rather than
generate an object in an invalid state.
Cheers
Dave