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

Design an expression constraint or form that allows for statically determining all possible output values. #5393

Closed
anandthakker opened this issue Oct 2, 2017 · 3 comments
Labels
cross-platform 📺 Requires coordination with Mapbox GL Native (style specification, rendering tests, etc.)

Comments

@anandthakker
Copy link
Contributor

It seems that we need to be able to determine statically (i.e., without access to feature data) what all the possible output values are for some expressions:

  • text-font - needed because "One of the components of an offline region download is the complete set of glyph range PBFs for all the font stacks used by that region's style"
  • icon-image - per chat with @ian29 @aparlato, "we need to know all the icon names referenced by a style in order to check that the icons exist"

In order to do this, we need a way to define an enforceable constraint on expressions that guarantees that guarantees that its possible output values is a subset of the set of string literals used in the expression. (Theoretically possible for the guarantee to be looser, but this is probably good enough.)

@anandthakker
Copy link
Contributor Author

cc @jfirebaugh

@anandthakker anandthakker added the cross-platform 📺 Requires coordination with Mapbox GL Native (style specification, rendering tests, etc.) label Oct 2, 2017
@anandthakker
Copy link
Contributor Author

anandthakker commented Oct 2, 2017

Copying over from chat:

@jfirebaugh: It seems like it should be pretty straightforward to write a static analyzer that recursively descends an expression AST to determine potential outputs, with some sort of sentinel value for "unknown"/"dynamic value"
@anandthakker: @jfirebaugh hm, my fear with that approach is that it might be hard for users to understand, without some trial and error, what expressions they could use
@jfirebaugh: @anandthakker Studio can use some stricter but easier to understand rule if it wants to. But this would solve @ian29's need and the offline glyph's need.
@anandthakker: hm yeah, good point. I was thinking in terms of people authoring raw expressions, but as I myself have argued elsewhere, the users doing that are very likely to be expert

@jfirebaugh
Copy link
Contributor

We have a plan for this in mapbox/mapbox-gl-native#9939 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cross-platform 📺 Requires coordination with Mapbox GL Native (style specification, rendering tests, etc.)
Projects
None yet
Development

No branches or pull requests

2 participants