gracelang / language

Design of the Grace language and its libraries
GNU General Public License v2.0
6 stars 1 forks source link

what does "public, confidential, readable, writable, confidential" mean? #139

Closed kjx closed 6 years ago

kjx commented 6 years ago

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.

KimBruce commented 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.)

kjx commented 6 years ago

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.

KimBruce commented 6 years ago

Good point. It's not clear what the standard semantics should be.

kjx commented 6 years ago

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

kjx commented 6 years ago

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"