On Thu, July 7, 2005 11:40 am, Roger Browne said:
> Matt Diephouse wrote:
>> Should as much functionality as possible be put into the core PMCs?
>
> I'd like to see parrot include a set of core PMCs that implement fairly
> pure abstractions, without any language-specific stuff (such as
> automatic conversions, preconceived notions of which string values are
> true/false etc). It would be easier for a language implementor to add
> functionality to these, than to modify PMCs that include some perl-isms
> or python-isms.
>

One specific issue this brought to mind is the Pair PMC.  The pair pmc is
not really a pair.  It is what I would call a dictionary entry.  The
design and writing of the pair assumes the pair will be used for a
key->value type entry.    But I just want to have a pair that stores two
PMCs.  Thus, I currently have the option of using FixedPMCArray and
setting the size to 2, or writing a "real" pair pmc.  Using the
FixedPMCArray has a performance hit, so I would like to use a "real" pair
pmc.

The problem with the pair pmc is the inability to change the key.  So the
existing pair PMC should be modified to use indexing to access elements 0
and 1 (get_pmc_keyed_int and set_pmc_keyed_int).  This is what you think
of when you think of a pair.  Then a DictionaryEntry PMC can be derived
from this that protects the key from changing and also includes the
set_pmc_keyed and is_equal functions.

John

Reply via email to