HaloO,

Moritz Lenz wrote:
* What types are you allowed to assign to an invocant?

Whatever the type constraint says. When you write
class Foo { method bar ($x, $y) }, then bar's signature gets an invocant
of type Foo implicitly. If you write ... method bar (A $s:, $x, $y),
then the type constraint is A.

I would say that the class is always implicitly the type constraint on
the invocant. That is class Foo { method bar (A $s: $x, $y) } makes the
type constraint the juxtaposition of Foo and A. And $s can only access
the public interface of A.

An interesting question is if methods are allowed outside of a class
scope. That is, the type constraint of the invocant inserts it into
the class. Perhaps in a non-privileged form, i.e. without access to
private attributes and methods. Does that make sense?


Regards, TSa.
--

"The unavoidable price of reliability is simplicity" -- C.A.R. Hoare
"Simplicity does not precede complexity, but follows it." -- A.J. Perlis
1 + 2 + 3 + 4 + ... = -1/12  -- Srinivasa Ramanujan

Reply via email to