Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let's distribute visibility #1

Open
allenwb opened this issue Jan 30, 2017 · 1 comment
Open

Let's distribute visibility #1

allenwb opened this issue Jan 30, 2017 · 1 comment

Comments

@allenwb
Copy link
Contributor

allenwb commented Jan 30, 2017

As you point out, in the "Open Questions" section, the application of a single visibility token to all elements of a BindingList is likely to be misunderstood. In particular, I think that in all contexts (both declaration and use), the private sigil should immediately precede the identifier of a private field. An ES programer should never be allowed or required to write the name of a private field without including the sigil.

So, we should change the syntax to have a visibility token (the sigil or empty) per element, as you discussed. While we could impose the requirement that all elements of a binding list have the same visibility, I don't that it is actually necessary that we do so.

Decorators just have to be parametrized such that they can determine the visibility of the binding for each application. It would seem that they need this ability, independent of this proposal, in order to manipulate the different kinds of binding elements. For example, using the currently proposed syntax,

@foo x=5;
@foo #y;

foo decorator function would need to be written such that it does the right fooish thing for the property x and for the private field #y (possibly erroring out for one of them). Given that, I don't see why processing:

@foo own x=5, #y;

would work any differently.

In addition, I think we should probably allow decoration of each individual element of a binding list such that

@foo own @readonly x=5, #y;

would be semantically equivalent to

own @foo @readonly x=5, @foo #7;

Because we are excluding prototype placement BindList declarations, we don't have to worry about the ambiguity that an empty ElementPlacement would create for this scheme.

Of course decorators aren't really part of this proposal, but we should design it as if they were.

@erights
Copy link
Owner

erights commented Feb 8, 2017

I agree with all but the last wrinkle. We should support

@foo own x=5, #y;

as you say. But we should not support

@foo own @readonly x=5, #y;

If you want that, write separate declarations for each different set of annotations. Don't allow partial factoring -- it is too confusing and likely for readers to misinterpret.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants