develooper Front page | perl.perl6.internals | Postings from February 2001

Re: PDD 2, vtables

Thread Previous | Thread Next
From:
Dan Sugalski
Date:
February 18, 2001 23:29
Subject:
Re: PDD 2, vtables
Message ID:
5.0.2.1.0.20010219022645.0199fe88@24.8.96.48
At 02:50 AM 2/19/2001 +0000, Simon Cozens wrote:
>On Sun, Feb 18, 2001 at 09:34:46PM -0500, Dan Sugalski wrote:
> > At 01:13 AM 2/19/2001 +0000, Alan Burlison wrote:
> > >Dan Sugalski wrote:
> > >
> > > > Grab one via a utility function. getPMC() or something of the sort.
> > >
> > >newPMC() ? ;-)
> >
> > Works for me.
>
>Slight that-sucks alert: So, if I have to get a new PMC of class X (which is
>something that's going to have to happen often) I call
>     X->vtbl->new(newPMC())
>or
>     X->vtbl->morph(newPMC(),X);

X->vtbl->new. (Whether you snag a new PMC with newPMC or get handed a 
scratch one by the interpreter depends on circumstance) Morph is used for 
active variables, while new can assume that the PMC it was handed is dead.

I was originally thinking that new should handle the case where the PMC it 
was handed might need cleanup, but at this point I think that's a bad 
thing--it forces important code out too many places, and if we want at 
least semi-determinate cleanup we ought be doing it someplace else anyway.

					Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
dan@sidhe.org                         have teddy bears and even
                                      teddy bears get drunk


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About