At the same time, iblech is merging the JavaScript version of metamodel into the PIL2JS runtime, so that backend can have a reasonable chance of passing (and unexpectedly succeeding) t/oo/ tests.
Meta-object protocol is a lot of fun. Thanks to Haskell's lazy evaluation
and the builtin yadayada operator (i.e. undefined), I churned out
the first cut of primitive metaobjects relatively quickly.
To aid my understanding, I drew in lots of Gnosticism metaphors. For example, the demiurge below is the original Perl6::MetaClass, the root of everything, with its metaclass defined as an instance of itself:
-- Perl6::MetaClass - &_build_meta line 1
-- First metaclass by parthenogenesis
demiurge:: Object
demiurge = MkObject{ objClass = cls, objData = dat }
where
(fld, dat) = splitMap (gnosis $ MkName undef) -- no $.name
cls = MkClass{ clsMeta = demiurge, clsFields = fld }
After it consumed the bare-bones class definition in gnosis, we build the archetypical Perl6::Object metaclass from that; it's called pneuma, with its class definition defined in logos, which covers the class methods (new, bless, CREATE, isa, can) and instance methods (BUILDALL, DESTROYALL, isa, can).
Then we use the _build_meta helper -- conveniently named metamorph in my current code -- to augment demiurge with primitive, internal-only methods (BUILD, is_a, _merge, _create_accessor), plus accessors to the attribute and method tables. The code that does this reads:
-- Bootstrapped MetaClass - suitable for applying to environment
theos:: Object
theos = metamorph demiurge
The final task of this first-step bootstrapping, genesis, merely declares that theos has pneuma as a superclass; that is, the Perl6 MetaClass is itself a Perl6 Object, fully exposed to the userland. Using this as a base, all primitive runtime constructs can automatically appear as well-behaving objects. But that's another topic for another day...
Typo calling typer (Score:1)
It is lovely seeing all these powerful words inspiring (pneuma) life. But this is only the created life of the flesh (and you are aiming higher than this; Perl is intended to enrich the spirit also: the rhema that complements the logos). There is more.
He was with God in the beginning.
Through him all things were made; without him nothing was made that has been made.
In him was life, and that life was the light of men.
Re:Typo calling typer (Score:2)