develooper Front page | perl.perl6.internals | Postings from July 2002

Re: init_method_t for coroutines and subs?

Thread Previous | Thread Next
From:
David M. Lloyd
Date:
July 5, 2002 06:56
Subject:
Re: init_method_t for coroutines and subs?
Message ID:
Pine.LNX.4.44.0207050844320.27705-100000@tomservo.workpc.tds.net
On Wed, 3 Jul 2002, Melvin Smith wrote:

> At 09:51 PM 7/3/2002 -0400, Josh Wilmes wrote:
> >I know there was some talk about this extra "address" parameter recently,
> >but i'm not sure what the upshot of it is.  Right now, tcc is complaining
> >loudly because the init functions for parrotsub and parrotcoroutine don't
> >match the init_method_t type in the _vtable structure.
> >
> >What's the deal here?
>
> I made the PMC init method take an int argument sometime around
> January, and at the time we agreed it would be useful to have polymorphic
> constructors. Then it sort of silently got removed.
>
> I suppose the patch was done around the same time I commited
> the sub/coroutine PMCs, which would explain why they got out of sync.
>
> Passing an optional arg to the constructor can possibly save us cycles
> in the long run, for examples, the PMCs that need to know how to size
> themselves. Unless we do lazy allocation, aggregates usually preallocate
> at construction time, then resize later. For languages other than Perl
> that might need a "struct" type, it makes sense to request the correct
> allocation up front. The size could be bytes, elements, or kilometers.
> It doesn't need to be just size, as in subs/coroutines.
>
> In any case, it wasn't doing any harm, so I'm not sure why it got
> removed.

It got removed because it wasn't in the spec... Dan directed that we
replace it with a version of init that accepts a PMC argument
(init_pmc_method_t) that can be used to send in initial size or whatever
else you can dream up.

- D

<dmlloyd@tds.net>


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