Leopold Toetsch: # Further we would need for some classes a Const$Class variant, where the # set-like vtables throw an exception. These classes should be # autogenerated from *.pmc for all classes that have a "const_too" or such # in their classes $flags.
Isn't The Plan(tm) to use properties for this?
The property 'constant', 'ro' or whatever can only be some kind of communication: the HLL is telling the PMC to be read only. We could now have in each set-like vtable:
if (we_have_props && !is_bool(prop("ro")) // pseudo code set_the_value ... else throw_exception
or we have a different class, that have in the set-like vtable slots just the exception. No penalty for rw classes.
The lookup, if we have that property is a hash lookup, the is_bool is int, string_bool or a vtable depending on the value of the property.
Setting/resetting the "ro" property could morph() the PMC to the const/non-const variant.
I think that "read-only" is import enough (and used internally all over the place) to get special treatment.
leo