How rewrite without '::' ?
NotFound
julian.notfound at gmail.com
Fri Nov 21 10:48:39 UTC 2008
> PMC *foo_part = key_new_cstring(INTERP, "Foo");
> PMC *bar_part = key_new_cstring(INTERP, "Bar");
> PMC *key = key_append(INTERP, foo_part, bar_part);
>
> PMC *class_object = Parrot_oo_get_class(INTERP, key);
> PMC *object = VTABLE_instantiate(INTERP, class_object, PMCNULL);
>
>
> 'Parrot_oo_get_class' will also take an array, so you can do that
> instead of a key, but this is the most direct translation of the PIR code.
>
> We should probably add a function that takes a C varargs list and does
> all this for you.
Perhaps a function like the following may have more generic usage:
PMC *
Parrot_key_set_from_cstring (PARROT_INTERP, char delim, ARGIN(const
char * keystr))
Build a key from a C string and the delimiter specified.
The usage in this case will be:
PMC *class_object = Parrot_oo_get_class(interp,
Parrot_key_set_from_cstring(interp, ';', "Foo;Bar"));
Is easily implementable by calling existing key functions.
The name is borrowed from the existing function key_set_to_string
--
Salu2
More information about the parrot-dev
mailing list