On 10 July 2026 06:02:13 BST, Holly Schilling <[email protected]> 
wrote:

>The reason I don’t feel the `trait … for` syntax is appropriate is because of 
>`$this`. In a function inside a typical trait, `$this` refers to an instance 
>of the trait. In an extension, `$this` refers to an instance of the class 
>being extended.


I don't think that's true - there's no such thing as an "instance of a trait", 
the contents of a trait are pasted directly into the class where they're used, 
and act just as if they were written inline at that point.

What that does mean is that they have access to private members, which I 
understand extensions would not, so that might be a good reason to use a new 
keyword.


Rowan Tommins
[IMSoP]

Reply via email to