Integrating SMOP and P5

This page describes the sketches on how to implement a p5<->SMOP integration that would allow to fully implement Perl 6 cooperatively with p5. The branch is being hosted in github

Important Considerations

Predicted Steps

  1. Add polymorphic representation support to p5. This will mean adding the SMOP__ResponderInterface to every value in p5, among them SV and the interpreter itself.
  2. Dynamically create ResponderInterfaces for each of the p5 values (the interpreter itself, SV and other things) and use them when creating this values. This will allow the interpreter to realize which values belong to it or not. This ResponderInterfaces will be set in the interpreter allowing simple pointer comparison.
  3. Add checks in every p5 macro to see if the referred value's RI is one of this interpreter's RI, using SMOP_DISPATCH otherwise.
  4. Implement $interpreter.continuation(), that returns the current continuation. This will, in the case of running p5 code, construct a Coro::State-like object containing the current continuation.
  5. Implement $interpreter.goto($continuation), that will set that continuation as the current continuation. If that continuation is a p5-continuation it does something like Coro::State load_perl, but if it's something else, it will set a static OP_PolymorphicEval and set the continuation object in the interpreter. This OP_PolymorhicEval will use the SMOP Interpreter Implementation API on the given $continuation.

Side-effect benefits