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

What is a valid identifier? #26

Closed
simevidas opened this issue Sep 16, 2012 · 3 comments
Closed

What is a valid identifier? #26

simevidas opened this issue Sep 16, 2012 · 3 comments
Assignees
Labels
Milestone

Comments

@simevidas
Copy link

The "expressions" page states:

To reference a property that is not a valid identifier, you can use segment-literal notation

However, nowhere on that page it is defined what a valid identifier is.

In JavaScript, it's a word consisting of letters, digits, $, or _, with the exception that it cannot start with a digit. Is it the same for Handlebars? It would be useful if this information were provided on the site.

@dandv
Copy link

dandv commented Oct 7, 2012

WTF is a "segment literal notation"? Other than a Google bomb, that is. The only two Google search results for that string are the expressions page, and this GitHub issue.

@simevidas
Copy link
Author

@dandv LOL I did not notice that. The handlebars-site explains what it is. In JavaScript, property names can be any string, i.e. the property name can contain any sequence of characters. Identifiers, on the other hand, are restricted to letters, digits, and the _, and $ characters. So, in order to denote a property name that is not a valid identifier, the bracket-notation, a.k.a. subscript-notation can be used, e.g. obj[ 'Not a valid identifier!!!' ]. The OP uses the term "segment-literal notation". Since that term doesn't appear anywhere else on the Internet, it appears to be an invention of the OP :P... probably a lapsus memoriae.

@dandv
Copy link

dandv commented Oct 8, 2012

Thanks @simevidas :) I sort of figure out what it meant, though the example on the website introduced a period after the object: articles.[10].comments. Filed #27 for that.

Would be great if @wycats could check out GitHub... a bunch of low-hanging fruit here to fix, but would help new users stumble less.

@ghost ghost assigned kpdecker May 31, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants