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

prototype (::) syntax is ambigous #4104

Closed
bcherny opened this issue Sep 21, 2015 · 2 comments
Closed

prototype (::) syntax is ambigous #4104

bcherny opened this issue Sep 21, 2015 · 2 comments

Comments

@bcherny
Copy link

bcherny commented Sep 21, 2015

i'm trying to check if an object has a prototype-

if a::b then c      # specific property check - ok
if a:: and b then c # no property specified - not ok

the latter example compiles to if (a.prototype.and(b)), but the intention was if (a.prototype && b).

the fix is to treat spaces around .prototype. vs. :: differently. ie.

a::b       #=> a.prototype.b
a:: b      #=> a.prototype(b)
a::b and c #=> a.prototype.b && c
a:: and c  #=> a.prototype && c

in the meantime, the workaround is to use parens-

if (a::) and b then c
@michaelficarra
Copy link
Collaborator

Duplicate of #1601. The unary form of :: will be removed... some day. Don't use it.

@bcherny
Copy link
Author

bcherny commented Sep 21, 2015

sgtm. thanks for the quick response.

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

No branches or pull requests

2 participants