Re: RFC from a newbie: Method References

2000-12-18 Thread Jeremy Howard
Michael G Schwern wrote: > Hmmm... an object which contains a method reference which contains a > referent to itself. > Yup. I don't know why some people think that circular references are complex ;-) > > > Something like this would be nice in a class that creates method > > references--it would s

Re: RFC from a newbie: Method References

2000-12-18 Thread Michael G Schwern
On Sun, Dec 17, 2000 at 11:28:49PM +1100, Jeremy Howard wrote: > There's not necessarily any circular reference. The problem is that method > references are frequently used to implement event callbacks. This would > generally look something like this: Hmmm... an object which contains a method re

Re: RFC from a newbie: Method References

2000-12-17 Thread Jeremy Howard
Michael G Schwern wrote: > On Sun, Dec 17, 2000 at 12:11:01PM +1100, Jeremy Howard wrote: > > Something to be careful of--it's easy to create a circular reference when > > using method pointers. As a result, neither the referrer nor referee objects > > are ever destroyed. > > > > When using method

Re: RFC from a newbie: Method References

2000-12-16 Thread Michael G Schwern
On Sun, Dec 17, 2000 at 12:11:01PM +1100, Jeremy Howard wrote: > Something to be careful of--it's easy to create a circular reference when > using method pointers. As a result, neither the referrer nor referee objects > are ever destroyed. > > When using method references it's important that your

Re: RFC from a newbie: Method References

2000-12-16 Thread Jeremy Howard
Michael G Schwern wrote: > package Class::MethRef; > use strict; > > sub meth_ref { > my($proto, $method, @args) = @_; > return sub { $proto->$method(@args) }; > } > > > So this... > > my $meth_ref = $obj->meth_ref('foo', @some_stuff); > $meth_ref->(); > > is equivalent to this.. > > $

Re: RFC from a newbie: Method References

2000-12-16 Thread Michael G Schwern
On Fri, Dec 15, 2000 at 11:23:23PM -0800, Ian Hickson wrote: > Having said that: The only feature that I really miss from Perl 5 is the > lack of method pointers -- that is, references to functions in a package > with an associated object. Oh, that's easy. Use a closure... my $foo = Foo->new; m

Re: RFC from a newbie: Method References

2000-12-16 Thread Ian Hickson
On 16 Dec 2000, Randal L. Schwartz wrote: > > >>> So: What I would love to see in Perl 6 is a way of having a single >>> scalar that holds a reference to a particular instance's method. >>> Is there any chance that this would be considered? Or is this already >>> possible in Perl 5 but I have mis

Re: RFC from a newbie: Method References

2000-12-16 Thread Randal L. Schwartz
> "Ian" == Ian Hickson <[EMAIL PROTECTED]> writes: Ian> So: What I would love to see in Perl 6 is a way of having a single scalar Ian> that holds a reference to a particular instance's method. Ian> Is there any chance that this would be considered? Or is this already Ian> possible in Perl 5

Re: RFC from a newbie: Method References

2000-12-16 Thread Ian Hickson
On Fri, 15 Dec 2000, Michael Fowler wrote: > On Fri, Dec 15, 2000 at 11:23:23PM -0800, Ian Hickson wrote: > > So: What I would love to see in Perl 6 is a way of having a single scalar > > that holds a reference to a particular instance's method. > > > > Is there any chance that this would be con

Re: RFC from a newbie: Method References

2000-12-16 Thread Michael Fowler
On Fri, Dec 15, 2000 at 11:23:23PM -0800, Ian Hickson wrote: > So: What I would love to see in Perl 6 is a way of having a single scalar > that holds a reference to a particular instance's method. > > Is there any chance that this would be considered? Or is this already > possible in Perl 5 but I

RFC from a newbie: Method References

2000-12-15 Thread Ian Hickson
I'm very new to the Perl 6 development process, and apart from browsing through the RFCs and the archives of this mailing list, I haven't done much research. So I apologise in advance if I'm breaking some etiquette/ convention by jumping in here with a half-baked idea! Having said that: The only