# Foo/Bar/Baz.pm
package Foo::Bar;
use mop;
class Baz extends Foo::Bar { }
no mop;
# Foo/Bar.pm
package Foo;
use mop;
class Bar {
method class { ... }
}
no mop;
# script.pl
use Foo::Bar::Baz;
what currently happens is:
the mop keywords are exported into Foo::Bar
Baz starts parsing
as part of the parsing, Foo::Bar is loaded
the mop keywords are exported into Foo
Bar starts parsing
Bar's FINALIZE installs class into Foo::Bar as a method
the mop keywords are removed from Foo
Baz finishes parsing, and generates an OP_ENTERSUB, pointing to Foo::Bar::class
Foo::Bar::Baz enters runtime, and calls Foo::Bar::class the method, not the keyword
the method then does something random (probably dies)
This could be worked around once we rewrite the parser in XS (#93) by giving the keywords a call checker that optimizes out the entersub op, but hopefully we can get lexical exports (#99) working before that's necessary.
Given this situation:
what currently happens is:
class
into Foo::Bar as a methodThis could be worked around once we rewrite the parser in XS (#93) by giving the keywords a call checker that optimizes out the entersub op, but hopefully we can get lexical exports (#99) working before that's necessary.