Andrew Whitworth via RT wrote:
On Tue Apr 22 10:05:57 2008, [EMAIL PROTECTED] wrote:
We've been kicking around the idea of removing new_from_string for a while, but the pushback is always that it's useful to be able to create a new PMC with some initialization data, without first creating a PMC initializer that has to be garbage collected. So, instead of removing it entirely, make it a standard initialization option, passing a string argument instead of a PMC argument.
[...]

Is this idea still being kicked around? What would all the new
interfaces look like? This seems like the kind of update that could be
tackled in the next month if we wanted something that was more
internally consistent.

- Would need a new vtable function 'init_str'.

  void init_str(STRING *initializer)

Or alternatively, if we find we need to exactly duplicate the interface of 'new_from_string':

  void init_str(STRING *initializer, INTVAL flags)

- The 'new' opcode would need two additional variants that take a STRING initializer instead of a PMC initializer:

  =item B<new>(out PMC, in STR, in STR)

  =item B<new>(out PMC, in PMC, in STR)

- The 'pmc_new' function would need two new variants, in addition to 'pmc_new' (which calls VTABLE_init), 'pmc_new_init' (which takes an extra PMC argument and calls VTABLE_init_pmc), and 'pmc_new_noinit' (which doesn't call any vtable init), and the constant versions of each.

  pmc_new_init_str(PARROT_INTERP, INTVAL base_type, ARGIN(STRING *init))

Allison

Reply via email to