About collective extension methods, the situation is somewhat different.
-
collective extension methods do not define a local scope, where as
with + <indent>
means “local scope” everywhere else. -
we certainly do want to allow a single extension method without needing
with
. I.e.extension (x: T) def append (y: T): T = ... extension (x: T) def prepend (y: T): T = ...
should both be accepted. So then when we combine the two to a single collective extension, would we require a
with
or allow one? Requiring it is just as bad as braces in that I have to add something to the other scope if I have more than one thing in the inner scope. Allowing it just gives two ways to do the same thing.
That’s why I think it’s better not to use with
. But there can be a nice error message that explains the matter if somebody writes it.