Allison Randal wrote:
tewk wrote:
Patch was to large to attach so: http://tewk.com/pdd15_testing.diff
Tests currently fail because they use the "new" opcode to instantiate
objects.
Fixing the 'new' opcode is the first change we need to make to get
both object models working simultaneously. Pick one:
- The 'new' opcode can no longer lookup string class names by type
number (eventually true).
I'd really like to work on permanent solutions. So how should we
implement option one?
Should we have a pmc lookup resolution order of current namespace, hll
namespace, parrot namespace, and finally root namespace.
Then all current, non-hll pmcs should be placed in the parrot namespace.
Nope that won't work, the parrot and root namespaces can't blead into
hll namespaces' visibility.
We really need independent opcodes which segment the current namespace,
hll namespaces, and the root parrot namespace.
I think we should have:
new_cur - resolves using the current namespace
new_hll - resolves pmcs and classes using the hll namespace
new - resolves using the parrot namespace.
we probably need the same thing for newclass.
newclass_cur
newclass_hll
newclass
Second issue:
PDD15 registers methods in the class. So methods defined using :method
in the class namespace aren't found by the find_method.
So:
1: We force compiler writers to make add_method calls for every method
and drop :method
2: After running :init and :load subs we auto-call add_method for
methods defined in pir with :method. (this has nasty corner cases)
What do we do about evaled :methods, repeat the same auto-call
technique after ever eval?
3: We modify the Class PMC's find_method to look in the namespace for
method and lazily call add_method.
Comments, corrections welcome,
Kevin
- The PDD 15 object implementation needs to register a type number for
its classes (as a temporary measure to smooth over integration).
I recommend the second option for now.
$P0 = get_class "Classname"
$P1 = $P0.'new'();
This will also work, and will provide more syntactic sugar than the
'new' opcode (e.g. named parameters for the initializer).
Allison