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

Symbol syntax is ambiguous with normal property access. #12586

Closed
lrhn opened this issue Aug 21, 2013 · 1 comment
Closed

Symbol syntax is ambiguous with normal property access. #12586

lrhn opened this issue Aug 21, 2013 · 1 comment
Assignees
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). closed-as-intended Closed as the reported issue is expected behavior P1 A high priority bug; for example, a single project is unusable or has many test failures

Comments

@lrhn
Copy link
Member

lrhn commented Aug 21, 2013

The new syntax for symbols allows "#foo.bar" as a single symbol literal.
It can also be parsed as the symbol literal "#foo" getting accessed with a "bar" getter. This makes the grammar ambiguous.

I recommend resolving it by disallowing "dotted symbols". In the rare case that you need these (which, if I understand it correctly, is only used for library names), you can use "const Symbol('foo.bar')". The "#foo.bar" notation is too hard to read as being a single literal when you are used to reading ".bar" as a getter access.

@gbracha
Copy link
Contributor

gbracha commented Aug 23, 2013

The bug in the grammar was that symbolLiteral wasn't used :-)

It is now (0.52) defined as a literal, and as such as a primary, and it is not ambiguous - it takes precedence over dot notation.

It is a separate question as to whether this is the best choice. The argument that it is rarely used works both ways. It isn't likely to be a problem in practice. Tools should colorize literals differently from operations, so it should stick out like sore thumb as well.


Added AsDesigned label.

@lrhn lrhn added Type-Defect P1 A high priority bug; for example, a single project is unusable or has many test failures area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). closed-as-intended Closed as the reported issue is expected behavior labels Aug 23, 2013
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). closed-as-intended Closed as the reported issue is expected behavior P1 A high priority bug; for example, a single project is unusable or has many test failures
Projects
None yet
Development

No branches or pull requests

2 participants