To make that actually usable, I'm thinking of:
- the vtable gets a flag for const classes
- pmc_new uses the constant PMC pool, when that flag is set
- but the vtable is first the writeable variant of the $class
- so the PMC can be initialized or filled with data
- then morph() gets called, which sets the real vtable of Const$class
- as this vtable will not contain a usable morph, the PMC stays const from here on.
- for user code, there is one new opcode needed:
morph in PMC, in INTVAL # morph PMC $1 to type $2
Comments welcome, leo