I think I found the core of the issue here; it has to do with the
differences between roles and mixins, with an analogous difference
between compile-time composition and runtime composition. Details
I think we are basically through the discussion. Thank you for your
patience so far. It's interesting to note that you make a distinction
between mixins and roles. I think of roles as being mixins.
Ah. Unfortunately, said article is part 15 of a series. While it's
true that only a handful of them are directly referenced by the
article, that's still more than I've had time to read so far - and the
unreferenced articles still matter in that they provide the
grammatical context in which Article 15 is phrased.
The series is worth reading, indeed.
Just to clarify some terminology: in the above statement,
'ComposedClass' composes 'Role', and 'ComposedClass' inherits from
'UncomposedClass'. Conversely, 'Role' is composed into
This is still not how I think of it. I'm more thinking of the
composition process as having the *same* class in a pre- and a
post-composition state. The role poses a type constraint on the
pre-state and can access this state. There's no inheritance
between two classes.
As you describe it, the current compile-time composition let's
the role define a type bound of the composition result in the
sense that instances of the class do the role.
The basic idea is to define the type T of instances of a class
or role as all types that are subtypes of a type function:
forall T <: Generator[T]
The crux is that T appears on both sides of the typing relation.
I would like to find out how it can be applied to Perl 6.
So if you find the time to read through the series we can try
together to understand the type system of Perl 6.
Free mixins just go into the composed class unconstraint.
Do you mean "unconstrained"?
Yes, sorry for the typo.