Closed kjx closed 6 years ago
It should be an error to have more than one visibility annotation on a declaration. The basic dialect (I've forgotten its name) should catch and reject that. Other dialects could ignore it, I suppose, but the reported behavior is certainly counterintuitive. (Labeling something as both readable and writable should not be a problem.)
The basic dialect (I've forgotten its name) should catch and reject that.
So, if the basic dialect "standardGrace" handles this, then that's good because the core of the language doesn't have to handle it --- but then the core language semantics have to give some semantics to this kind of thing.
Good point. It's not clear what the standard semantics should be.
It's particularly weird when it comes to these access control things, given the asymmetry between var/def and methods. It seems to be something like:
Annotation | Var/Def | Method |
---|---|---|
public | both accessors public | no-op |
readable | getter public | not applicable / no-op |
writable | setter public | not applicable / no-op |
confidential | no-op | make confidential |
I'm working on stuff related to this, but nowhere near finished yet
most precise semantics are at most one annotation for any encapsulation property. Methods & defs have one property; vars have two. a var can be "readable, writeable" but not "readable, readable" or "public, readable"
should that be an error? (if so, how caught? in general? when?)
for what it's worth, in both amg & kernan, sticking that on a def makes the def public; sticking it on a method makes the method confidential.