This looks very interesting! It would be great if we could avoid accessors for private fields.
In fact, if this works out, it looks attractive to scrap
private[this] has become next to pointless then. Yes, it communicates that a field is accessed only from
this, but this can also be trivially established by just searching all occurrences of the field in the class. Visibility modifiers establish a contract between a class member and its users. Here there’s not contract to establish since everything stays in a single class.
The original purpose of
protected[this] was to provide more relaxed constraints for type parameter variance. These constraints have been shown to be unsound, so in Scala 3
protected[this] behaves exactly like
protected wrt variance. I don’t think there is a point to keep it anymore.
[this] would provide a real language simplification by dropping a syntax construct from the language,