Will Coleda via RT wrote:
Hunt down existing use of 'new_i_s' and either replace or remove the functionality.
The FixedIntegerArray is an example of where 'new_from_string' is used.

'new_i_s' was experimental and can die. Any PMC's using the behavior can instead pass a hash argument to 'new'.

Given the usage in compilers/imcc/pbc.c:

    _class  = interp->vtables[r->pmc_type]->pmc_class;
    p       = VTABLE_new_from_string(interp, _class, s, PObj_constant_FLAG);

Is there a standard for passing the flags? In the old scheme, we had a specific argument to pass in the flags... There are a lot of cases where we pass in flags here; Do we now have to create a Hash PMC in each case? If it's a Hash, then we have to setup a convention to pass the flags... but doing this just as a convention seems to be ripe for mistakes; Clues welcome on how to proceed.

It was already just a convention, and various different PMCs used the arguments passed to 'new_from_string' in different ways. To kick things off, let's convert the few PMCs that implement the 'new_from_string' vtable function to handle the behavior in 'init_pmc' using 'flags' and 'string_rep'. The 'flags' key in the init hash can be the integer flags, and 'string_rep' the string value for 'new_from_string'. Though, I suspect a bit of intelligence should be applied, with saner names for some of the PMCs.

Creating a hash is expensive, but then new_from_string was also quite rare (only implemented on 4 PMCs), so isn't a huge target for optimization.

Allison

Reply via email to