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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discussion & feedback #1

Open
orangemug opened this issue Dec 5, 2017 · 4 comments
Open

Discussion & feedback #1

orangemug opened this issue Dec 5, 2017 · 4 comments

Comments

@orangemug
Copy link
Owner

orangemug commented Dec 5, 2017

I would appreciate feedback on this tiny language for mapbox-gl-js expressions (see the main README.md for details).

If you like it or hate it please tell me why. Thanks in advanced! 馃槉

@orangemug orangemug changed the title Discussion Discussion & feedback Dec 5, 2017
@orangemug
Copy link
Owner Author

@pjsier continuing from your comment in maplibre/maputnik#200 (comment) the thought of writing JSON for mapbox-gl-js expressions seemed like pain to me. So I thought I'd have a go at writing a tiny language instead.

I would love to know your thoughts.

@pjsier
Copy link

pjsier commented Dec 5, 2017

@orangemug I think this could be really useful as a standalone project since the Mapbox style spec syntax is really verbose, but I'm hesitant about including it as part of Maputnik.

The style spec is already a bit of a moving target and changing really frequently, so keeping this up to date with their changes could be a challenge. I could also see it being confusing for people to use a separate syntax on Maputnik.

That said, I can see this being really useful for using a lot properties and expressions in the code because they can get unwieldy, so really well done!

@orangemug
Copy link
Owner Author

Thanks for the feedback @pjsier.

so keeping this up to date with their changes could be a challenge

A few more details for you, incase you're interested, no worries if not.

There is actually not a lot tying it to the expression spec, that was the aim anyway. Basically the only bit that needs to stay constant for it to keep working is that a function is defined in this way

[function_name, arg_1, arg_2, arg_3...]

There are also a two other opt in syntax sugar

  • ["get", FEATURE_NAME] which has a shorthand @FEATURE_NAME
  • ["let", ...] and ["var", VAR_NAME]

It's the job of mapbox-gl-js to decide if the JSON is correct or not. The expression JSON can also be decompiled to code (almost there with this). So you can basically toggle between simple-expr and JSON

Thanks again for the feedback

@orangemug
Copy link
Owner Author

Added source maps, see https://orangemug.github.io/simple-expr/fmt.html

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