Raku / roast

🦋 Raku test suite
https://raku.org/
Artistic License 2.0
179 stars 135 forks source link

Which metamodel roles are specced; which ought to be? #402

Open cfa opened 6 years ago

cfa commented 6 years ago

Following the discussion at perl6/doc#1846, I'm raising this ticket to ask which metamodel roles ought to be specced (but currently aren't) so that we can distinguish Rakudo-specific implementation details from the language specification proper.

The PR/issue linked above can be summarised as an attempt to (sparsely) document Metamodel::ModuleHOW and its roles (Metamodel::PackageHOW is effectively a subset). These are:

It's not clear to me whether decomposition of metaclasses into named roles is specced or a Rakudo implementation detail. So: Should we be documenting the individual roles at all?

Thanks!

zoffixznet commented 6 years ago

@jnthn would you be able to say which of these should be part of the spec?

jnthn commented 6 years ago

Well, per Hyrum's law, they'll probably all converge on being de facto spec if they don't change for long enough. :-)

That aside, I'm a bit conflicted on this matter. Points for putting these in spec and doc are:

Points against putting these in spec/doc are:

None of these points feels to me to give a clear answer either way. I can argue all of "let's spec/doc it, to make meta-programming more accessible", "let's wait until we've more concrete usages to see if this is right", and "let's not tie our hands for the future and put off specifying it indefinitely". I suspect my opening point means the latter isn't an option we get to pick, though, which leaves "do it now" or "agree it should happen at some unspecified time in the future".

7ish years on from doing the original metamodel design, I don't really look at it and see a bunch of things that I wish were different. I do wonder if method caching needs a revisit, because the pre-computation of caches is expensive at startup time (deserializing those is probably the second biggest chunk of startup deserialization cost). But that wouldn't be especially disruptive to do within the current design anyway, and perhaps we can put more laziness smarts into MoarVM anyway and so not touch things at the Rakudo level at all. So even there I don't feel like specifying this would be tying my hands on changes I'd like to see.

So, perhaps we shouldn't let the perfect be the enemy of the good and spec the roles. Who knows, maybe having people base their custom meta-objects around of set of core roles we have control over will afford the Rakudo team, and future implementations, more flexibility in the long run anyway.