Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
PMC instantiation
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Dan Sugalski  
View profile  
 More options Aug 30 2004, 12:51 pm
Newsgroups: perl.perl6.internals
From: d...@sidhe.org (Dan Sugalski)
Date: Mon, 30 Aug 2004 12:51:39 -0400
Local: Mon, Aug 30 2004 12:51 pm
Subject: Re: PMC instantiation
At 9:47 AM +0200 8/26/04, Leopold Toetsch wrote:

>The current scheme of PMC instantiation works mostly fine for
>scalars and other simple types, but it's a bit limited. It allows
>only one initializer (see init_pmc in docs/pdds/pdd02_vtables.pod).

Okay, here's a thought. We might as well just do this once, and do it
right. So I'm thinking we:

Add a vtable slot to the PMC vtable inv_init (or something like that,
the name's not that big a deal), define it as an invokable method
taking parameters as the current calling conventions, and be done
with it. Basically we special-case this one method and hoist it up
into a vtable slot. IMCC for it'd look something like:

      (result1, result2) = $Pxxx.inv_init(1, 2, "foo", "bar", $Pbaz)

If the class wants its heavyweight constructor multi-dispatched, then
it can go do that.

If this seems not too insane to implement (or, alternately, so insane
it's obviously the correct thing to do) then we can hash out the
details and get it done.
--
                                Dan

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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Leopold Toetsch  
View profile  
 More options Aug 31 2004, 6:16 am
Newsgroups: perl.perl6.internals
From: l...@toetsch.at (Leopold Toetsch)
Date: Tue, 31 Aug 2004 12:16:41 +0200
Local: Tues, Aug 31 2004 6:16 am
Subject: Re: PMC instantiation

Dan Sugalski <d...@sidhe.org> wrote:
> Add a vtable slot to the PMC vtable inv_init (or something like that,
> the name's not that big a deal),

  vtable->new and "__new"?

> ... define it as an invokable method
> taking parameters as the current calling conventions, and be done
> with it. Basically we special-case this one method and hoist it up
> into a vtable slot. IMCC for it'd look something like:
>       (result1, result2) = $Pxxx.inv_init(1, 2, "foo", "bar", $Pbaz)

Two return values? What is $Pxxx: a class PMC or an empty Undef object
of some kind?

I think we should have:

   Pclass = getclass, "Foo"
   Pobjnew = Pclass."__new"(args)  # Pnew is an OUT argument

and that be special-cased to call VTABLE_new according to calling
conventions.

How does that correspond to the proposed CONSTRUCT property? Is that
still needed?

leo


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dan Sugalski  
View profile  
 More options Aug 31 2004, 9:51 am
Newsgroups: perl.perl6.internals
From: d...@sidhe.org (Dan Sugalski)
Date: Tue, 31 Aug 2004 09:51:59 -0400
Local: Tues, Aug 31 2004 9:51 am
Subject: Re: PMC instantiation
At 12:16 PM +0200 8/31/04, Leopold Toetsch wrote:

>Dan Sugalski <d...@sidhe.org> wrote:

>>  Add a vtable slot to the PMC vtable inv_init (or something like that,
>>  the name's not that big a deal),

>   vtable->new and "__new"?

Those are a little too similarly named. We should have something more
distinct, I think.

>  > ... define it as an invokable method
>>  taking parameters as the current calling conventions, and be done
>>  with it. Basically we special-case this one method and hoist it up
>>  into a vtable slot. IMCC for it'd look something like:

>>        (result1, result2) = $Pxxx.inv_init(1, 2, "foo", "bar", $Pbaz)

>Two return values? What is $Pxxx: a class PMC or an empty Undef object
>of some kind?

$Pxxx is an uninitialized object of the class you're creating, but
that won't work at the PIR level. PIR combines the new and init
functions together, which I always forget.

>I think we should have:

>    Pclass = getclass, "Foo"
>    Pobjnew = Pclass."__new"(args)  # Pnew is an OUT argument

>and that be special-cased to call VTABLE_new according to calling
>conventions.

Still don't like __new, but otherwise that works out OK. It'd call
VTABLE_init_extended or whatever we'd name the entry.

>How does that correspond to the proposed CONSTRUCT property? Is that
>still needed?

I don't think CONSTRUCT would be needed with this.
--
                                Dan

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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Leopold Toetsch  
View profile  
 More options Sep 3 2004, 5:27 am
Newsgroups: perl.perl6.internals
From: l...@toetsch.at (Leopold Toetsch)
Date: Fri, 3 Sep 2004 11:27:32 +0200
Local: Fri, Sep 3 2004 5:27 am
Subject: Re: PMC instantiation

Dan Sugalski <d...@sidhe.org> wrote:
> At 12:16 PM +0200 8/31/04, Leopold Toetsch wrote:

>>    Pclass = getclass, "Foo"
>>    Pobjnew = Pclass."__new"(args)  # Pnew is an OUT argument

>>and that be special-cased to call VTABLE_new according to calling
>>conventions.
> Still don't like __new, but otherwise that works out OK. It'd call
> VTABLE_init_extended or whatever we'd name the entry.

Ok. It is actually "new_extended" now. It's creating new objects, so
"init_extended" didn't totally match the behaviou?r.

Initial tests are in as well as a fallback in default.pmc that
constructs a new PMC without initializers.

leo


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dan Sugalski  
View profile  
 More options Sep 7 2004, 10:23 am
Newsgroups: perl.perl6.internals
From: d...@sidhe.org (Dan Sugalski)
Date: Tue, 7 Sep 2004 10:23:17 -0400
Local: Tues, Sep 7 2004 10:23 am
Subject: Re: PMC instantiation
At 11:27 AM +0200 9/3/04, Leopold Toetsch wrote:

>Dan Sugalski <d...@sidhe.org> wrote:
>>  At 12:16 PM +0200 8/31/04, Leopold Toetsch wrote:

>>>     Pclass = getclass, "Foo"
>>>     Pobjnew = Pclass."__new"(args)  # Pnew is an OUT argument

>>>and that be special-cased to call VTABLE_new according to calling
>>>conventions.

>>  Still don't like __new, but otherwise that works out OK. It'd call
>>  VTABLE_init_extended or whatever we'd name the entry.

>Ok. It is actually "new_extended" now. It's creating new objects, so
>"init_extended" didn't totally match the behaviou?r.

Oh. This isn't right. The extended stuff's extended initialization,
just like init is now. It works on the PMC it's attached to, rather
than allocating a new PMC from the pool.
--
                                Dan

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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Leopold Toetsch  
View profile  
 More options Sep 7 2004, 11:05 am
Newsgroups: perl.perl6.internals
From: l...@toetsch.at (Leopold Toetsch)
Date: Tue, 7 Sep 2004 17:05:17 +0200
Local: Tues, Sep 7 2004 11:05 am
Subject: Re: PMC instantiation

I was always talking about a class method that returns new objects like
in the example above.

If we need extended initialization too, then that's a different set of
opcode/vtable.

The C<new_extended> matches nicely Python's object construction, like:

  c = complex(1,2)

where "complex" actually is a class.

leo


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »