Nicholas Clark wrote:

I'd like to be able to provide this as a non-singleton PMC class, with the
addition of a value lookup, and (possibly) iteration. But cut and paste is
evil.

Well, the more general question is: how can we parameterize our aggregates. We already have tons of arrays with (bit, double, int, PMC*, STRING*) values.

For hashes it could get worse:

  key       /    value
  STRING*   /    PMC*          Hash
  PMC *     /    PMC *         Python  / Perl6
  &PMC      /    INTVAL        ref hash
    x             y            Perl6

The hash functions in src/hash.c can handle this (probably), with key/value type and with user defined compare/hash functions already inside..

We need an interface above that constructs appropriate vtable pieces for key and value access from the PMC side.

Nicholas Clark

For now c&p helps :-)
leo

Reply via email to