mapbox / mapbox/expression-jamsession
$type should not require being wrapped in quotes
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 81
- Forks
- 9
- PR merge metrics
- No merged PRs in 30d
Description
This is a syntax error:
`$type == "Polygon"`
This is required:
`"$type" == "Polygon"`
https://runkit.com/stevebennett/5c07705a9abafb0012661a02
That's, um, a bit gross. The thing on the left is a variable, the thing on the right is a literal, and they're both equally wrapped in quotes.
It's logical, in that what it maps to is `["==", "$type", "Polygon"]`. But it means that Jam Session is not providing much of an abstraction at all over the array-based expression syntax, and is violating expectations of how an expression language should behave.
(Put differently: if the only way to write Jam Session syntax is to first think about what syntax it will be transformed into, then is there really much point?)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the two expressions from the issue and trace how Jam Session parses and translates them into array-based expressions. The work is done when an unquoted variable such as $type is accepted, preserves the intended variable-versus-literal meaning, and regression coverage verifies both forms.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100