Need rigorous definitions for path and "value at path". #6

Open
rafaelw opened this Issue Mar 1, 2013 · 3 comments

Projects

None yet

3 participants

@rafaelw
polymer member

Cases to consider:
Path:
-empty string (currently a path with 0 property components)
-index operators, e.g. "foo[2].baz" (currently not supported)
Value at Path:
-empty string path (the value is the model itself)
-non-object model (valid, if path is non-empty, value is undefined)

@michaelsbradleyjr

Regarding index operators, how about a syntax like:

a.b.#0.c

#1

#2.w

x.y.#3

#4.#5.#6

A path segment preceded by a # could then be run through parseInt, and if the result is NaN an exception would be thrown regarding the bad segment. Otherwise, the returned Integer value would take the place of the String value of that segment in the path.

@rafaelw
polymer member

@michaelsbradleyjr Actually, in JS indexes are just property names. JS syntax disallows naked integers as identifiers (e.g. foo.0), but ChangeSummary is fine with it. IOW, All of the following already works as path specifications:

a.b.0.c
1
2.w
x.y.3
4.5.6

@rafaelw rafaelw was assigned by jmesserly Aug 7, 2014
@jmesserly

I think this is mostly implemented now, but maybe we still need a grammar "spec"?

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