|
|
Created:
6 years, 10 months ago by gbracha Modified:
6 years, 10 months ago CC:
reviews_dartlang.org, Lasse Reichstein Nielsen Visibility:
Public. |
DescriptionLibraries can be private.
R=ahe@google.com
Committed: https://code.google.com/p/dart/source/detail?r=33050
Patch Set 1 #Patch Set 2 : #
Total comments: 1
Patch Set 3 : #
Total comments: 2
Messages
Total messages: 13 (0 generated)
lgtm
https://codereview.chromium.org/165483004/diff/30001/docs/language/dartLangSp... File docs/language/dartLangSpec.tex (right): https://codereview.chromium.org/165483004/diff/30001/docs/language/dartLangSp... docs/language/dartLangSpec.tex:219: With this change, a library name declaration is private if it *begins* with an underscore. That is, library _foo; and library _foo.bar; are private names of libraries. What is the meaning of: library foo._bar; The "_bar" is an indentifier (per the grammar), but is not the name of a declaration, and the name in total doesn't start with an underscore. That would mean that "foo._bar" is not a private name, and the "_bar" part should not be be name-mangled for privacy (the VM currently does that). (This is perfectly fine, and easy to implement, I just want to be sure I understand the consequences).
On 2014/02/14 11:48:26, Lasse Reichstein Nielsen wrote: > https://codereview.chromium.org/165483004/diff/30001/docs/language/dartLangSp... > File docs/language/dartLangSpec.tex (right): > > https://codereview.chromium.org/165483004/diff/30001/docs/language/dartLangSp... > docs/language/dartLangSpec.tex:219: > With this change, a library name declaration is private if it *begins* with an > underscore. > That is, > library _foo; > and > library _foo.bar; > are private names of libraries. > > What is the meaning of: > library foo._bar; > The "_bar" is an indentifier (per the grammar), but is not the name of a > declaration, and the name in total doesn't start with an underscore. > That would mean that "foo._bar" is not a private name, and the "_bar" part > should not be be name-mangled for privacy (the VM currently does that). > > (This is perfectly fine, and easy to implement, I just want to be sure I > understand the consequences). Thanks for the comment. From conversations with Peter last week, it is clear that an additional changes are needed so that both cases are private. These will be added to the CL soon.
On 2014/02/19 23:11:12, gbracha wrote: > On 2014/02/14 11:48:26, Lasse Reichstein Nielsen wrote: > > > https://codereview.chromium.org/165483004/diff/30001/docs/language/dartLangSp... > > File docs/language/dartLangSpec.tex (right): > > > > > https://codereview.chromium.org/165483004/diff/30001/docs/language/dartLangSp... > > docs/language/dartLangSpec.tex:219: > > With this change, a library name declaration is private if it *begins* with an > > underscore. > > That is, > > library _foo; > > and > > library _foo.bar; > > are private names of libraries. > > > > What is the meaning of: > > library foo._bar; > > The "_bar" is an indentifier (per the grammar), but is not the name of a > > declaration, and the name in total doesn't start with an underscore. > > That would mean that "foo._bar" is not a private name, and the "_bar" part > > should not be be name-mangled for privacy (the VM currently does that). > > > > (This is perfectly fine, and easy to implement, I just want to be sure I > > understand the consequences). > > Thanks for the comment. From conversations with Peter last week, it is clear > that an additional changes are needed so that both cases are private. These > will be added to the CL soon. I take that back. I ran some experiments. One can easily access members of a private library, regardless of whether its name or any identifier within it starts with an underscore. So the notion that a library is private remains meaningless, just as originally specified. What we want to express is that a *name* may be private, which is a different issue, that the spec has never addressed before. A simple name is private if it starts with an underscore, and a qualified name is private if any of the simple names within it is private. I will try and concoct language to this effect in a upcoming revision.
PTAL. I've also tweaked the interface inheritance language.
https://codereview.chromium.org/165483004/diff/120001/docs/language/dartLangS... File docs/language/dartLangSpec.tex (right): https://codereview.chromium.org/165483004/diff/120001/docs/language/dartLangS... docs/language/dartLangSpec.tex:212: Dart supports two levels of privacy: {\em public} and {\em private}. A declaration is {\em private} iff its name is private, otherwise it is {\em public.} A name $q$ is private iff any one of the identifiers that comprise $q$ is private, otherwise it is {\em public.} An identifier is private iff it What is a "declaration"? What is "its name" (that is, the name of a declaration)? In particular, where is this defined for libraries?
On 2014/02/20 15:51:38, ahe wrote: > https://codereview.chromium.org/165483004/diff/120001/docs/language/dartLangS... > File docs/language/dartLangSpec.tex (right): > > https://codereview.chromium.org/165483004/diff/120001/docs/language/dartLangS... > docs/language/dartLangSpec.tex:212: Dart supports two levels of privacy: {\em > public} and {\em private}. A declaration is {\em private} iff its name is > private, otherwise it is {\em public.} A name $q$ is private iff any one of > the identifiers that comprise $q$ is private, otherwise it is {\em public.} An > identifier is private iff it > What is a "declaration"? > > What is "its name" (that is, the name of a declaration)? > > In particular, where is this defined for libraries? Section 14 defines library names: Libraries may be explicitly named or implicitly named. An explicitly named library begins with the word library (possibly prefaced with any applicable metadata annotations), followed by a qualified identifier that gives the name of the library. <skip> An implicitly named library has the empty string as its name.
On 2014/02/20 21:37:42, gbracha wrote: > On 2014/02/20 15:51:38, ahe wrote: > > > https://codereview.chromium.org/165483004/diff/120001/docs/language/dartLangS... > > File docs/language/dartLangSpec.tex (right): > > > > > https://codereview.chromium.org/165483004/diff/120001/docs/language/dartLangS... > > docs/language/dartLangSpec.tex:212: Dart supports two levels of privacy: {\em > > public} and {\em private}. A declaration is {\em private} iff its name is > > private, otherwise it is {\em public.} A name $q$ is private iff any one of > > the identifiers that comprise $q$ is private, otherwise it is {\em public.} > An > > identifier is private iff it > > What is a "declaration"? > > > > What is "its name" (that is, the name of a declaration)? > > > > In particular, where is this defined for libraries? > > Section 14 defines library names: > > Libraries may be explicitly named or implicitly named. An explicitly named > library begins with the word library (possibly prefaced with any applicable > metadata annotations), followed by a qualified identifier that gives the name of > the library. > <skip> > An implicitly named library has the empty string as its name. Thank you. It is still not clear to me what is a declaration? Is a library a declaration?
On 2014/02/21 05:43:43, ahe wrote: > On 2014/02/20 21:37:42, gbracha wrote: > > On 2014/02/20 15:51:38, ahe wrote: > > > > > > https://codereview.chromium.org/165483004/diff/120001/docs/language/dartLangS... > > > File docs/language/dartLangSpec.tex (right): > > > > > > > > > https://codereview.chromium.org/165483004/diff/120001/docs/language/dartLangS... > > > docs/language/dartLangSpec.tex:212: Dart supports two levels of privacy: > {\em > > > public} and {\em private}. A declaration is {\em private} iff its name is > > > private, otherwise it is {\em public.} A name $q$ is private iff any one > of > > > the identifiers that comprise $q$ is private, otherwise it is {\em public.} > > > An > > > identifier is private iff it > > > What is a "declaration"? > > > > > > What is "its name" (that is, the name of a declaration)? > > > > > > In particular, where is this defined for libraries? > > > > Section 14 defines library names: > > > > Libraries may be explicitly named or implicitly named. An explicitly named > > library begins with the word library (possibly prefaced with any applicable > > metadata annotations), followed by a qualified identifier that gives the name > of > > the library. > > <skip> > > An implicitly named library has the empty string as its name. > > Thank you. It is still not clear to me what is a declaration? Is a library a > declaration? Technically, a library is not a declaration (but maybe it should be - library mirrors are declaration mirrors); instead it contains top level declarations as enumerated in section 14. So the current text does not make libraries private - which is correct. It makes their names private however.
On 2014/02/25 00:29:58, gbracha wrote: > On 2014/02/21 05:43:43, ahe wrote: > > On 2014/02/20 21:37:42, gbracha wrote: > > > On 2014/02/20 15:51:38, ahe wrote: > > > > > > > > > > https://codereview.chromium.org/165483004/diff/120001/docs/language/dartLangS... > > > > File docs/language/dartLangSpec.tex (right): > > > > > > > > > > > > > > https://codereview.chromium.org/165483004/diff/120001/docs/language/dartLangS... > > > > docs/language/dartLangSpec.tex:212: Dart supports two levels of privacy: > > {\em > > > > public} and {\em private}. A declaration is {\em private} iff its name is > > > > private, otherwise it is {\em public.} A name $q$ is private iff any one > > of > > > > the identifiers that comprise $q$ is private, otherwise it is {\em > public.} > > > > > An > > > > identifier is private iff it > > > > What is a "declaration"? > > > > > > > > What is "its name" (that is, the name of a declaration)? > > > > > > > > In particular, where is this defined for libraries? > > > > > > Section 14 defines library names: > > > > > > Libraries may be explicitly named or implicitly named. An explicitly named > > > library begins with the word library (possibly prefaced with any applicable > > > metadata annotations), followed by a qualified identifier that gives the > name > > of > > > the library. > > > <skip> > > > An implicitly named library has the empty string as its name. > > > > Thank you. It is still not clear to me what is a declaration? Is a library a > > declaration? > > Technically, a library is not a declaration (but maybe it should be - library > mirrors are declaration mirrors); instead it contains top level declarations as > enumerated in section 14. So the current text does not make libraries private - > which is correct. It makes their names private however. Thank you for explaining. I find this a bit convoluted. Could you add text to explicitly state that a library isn't covered by this wording. Preferably in non-normative text. How would this work: "Libraries aren't private. For any other declaration, it is private iff its name is private." I tend to get confused when the specification is implicit based on surprising corner-cases of other definitions. What I think is weird here is that the definition of the term "declaration" is tied to the definition of privacy, and a library can't be a declaration because of this. I'll re-read the text with the understanding that a library isn't a declaration and get back.
LGTM, but I wish the declaration of privacy was less implicit. https://codereview.chromium.org/165483004/diff/120001/docs/language/dartLangS... File docs/language/dartLangSpec.tex (right): https://codereview.chromium.org/165483004/diff/120001/docs/language/dartLangS... docs/language/dartLangSpec.tex:8: {\large Version 1.2}} I believe 1.11 is larger than 1.2, so this version number is a bit surprising.
Message was sent while issue was closed.
Committed patchset #3 manually as r33050 (presubmit successful). |