Skip to content

Conversation

@sargunv
Copy link

@sargunv sargunv commented Dec 22, 2024

Description

The purpose of this PR is to add support for producing arrays with elements calculated by expressions. It's a draft implementation of #950.

I implemented it as a single semiliteral operator mirroring the literal syntax, like other lisps have quasiquote and quote. Happy to restructure this into []/{} or some other name as discussed in that design proposal.

Launch Checklist

  • Confirm your changes do not include backports from Mapbox projects (unless with compliant license) - if you are not sure about this, please ask!
  • Briefly describe the changes in this PR.
  • Link to related issues.
  • Write tests for all new functionality.
  • Document any changes to public APIs.
  • Post benchmark scores.
  • Add an entry to CHANGELOG.md under the ## main section.

@sargunv sargunv force-pushed the feat_add_semiliteral_operator_for_expressions_inside_arrays_and_objects branch from eac3d59 to 23f0dbe Compare December 22, 2024 22:27
@sargunv sargunv changed the title feat: add semiliteral operator for expressions inside arrays and objects Add semiliteral operator for expressions inside arrays and objects Dec 22, 2024
@sargunv sargunv marked this pull request as ready for review December 22, 2024 22:28
@codecov-commenter
Copy link

codecov-commenter commented Dec 22, 2024

Codecov Report

Attention: Patch coverage is 90.90909% with 5 lines in your changes missing coverage. Please review.

Project coverage is 92.76%. Comparing base (c6fd205) to head (c4e7d47).
Report is 21 commits behind head on main.

Files with missing lines Patch % Lines
src/expression/definitions/semiliteral.ts 90.74% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #951      +/-   ##
==========================================
- Coverage   92.78%   92.76%   -0.03%     
==========================================
  Files         107      108       +1     
  Lines        4739     4794      +55     
  Branches     1346     1355       +9     
==========================================
+ Hits         4397     4447      +50     
- Misses        342      347       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

export type ExpressionParser = (args: ReadonlyArray<unknown>, context: ParsingContext) => Expression;
export type ExpressionRegistration = {
new (...args: any): Expression;
prototype: Expression;
Copy link
Author

@sargunv sargunv Dec 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tweaked this because my Semiliteral class is abstract and therefore doesn't have a constructor. If we split semiliteral into two different classes with their own parse like the []/{} proposal, we can revert this line.

"group": "Types",
"sdk-support": {
"basic functionality": {
"js": "https://github.com/maplibre/maplibre-style-spec/issues/950",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea is to link to issues in the MapLibre GL JS and MapLibre Native repo so that people can track progress on the implementation.

@HarelM
Copy link
Collaborator

HarelM commented Aug 17, 2025

@sargunv any updates on this? It seems that this PR is drifting away a bit...

@sargunv
Copy link
Author

sargunv commented Aug 17, 2025

Ah yeah, I've been focused on maplibre native core stuff and haven't worked on this in a while. Last I remember, we aligned on this general approach in a monthly meeting in May, and next step was to write up some expression naming options and poll the community?

I'll propose some names with background/justification and share in Slack soon

@HarelM
Copy link
Collaborator

HarelM commented Aug 17, 2025

Yes, I think that was the last action item on this topic.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants