Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Bend NSExpression syntax to accomodate Studio expression syntax #11053

Closed

Description

@1ec5

The NSExpression-based property value implementation in #10726 relies in large part on an existing NSExpression format string syntax. Studio is planning to use its own abstraction atop the style specification’s expression language, powered by expression-jamsession. Both syntaxes are more or less inspired by spreadsheet formula syntax, but there are some subtle differences. We should explore having -[NSExpression(MGLAdditions) mgl_jsonExpressionObject] interpret the format string more loosely to accommodate differences that may easily lead to confusion. For example:

  • min() and max() take a single array literal argument in NSExpression but a series of arguments in expression-jamsession.
  • Accessing a feature’s attribute entails a key path expression in NSExpression but a call to get() in expression-jamsession.
  • Concatenating strings currently requires a call to stringByAppendingString: (but soon mgl_join()) in NSExpression but the & operator in expression-jamsession. Per Reimplement MGLStyleValue atop NSExpression #8074 (comment), we can overload the bitwiseAnd:with: function for this purpose.

/cc @davidtheclark @anandthakker @jmkiley

Activity

  1. added
    iOS
    macOS
    on Jan 25, 2018
  2. added this to the milestone on Jan 25, 2018
  3. 1ec5 commented on Jan 25, 2018

    @1ec5
    ContributorAuthor

    Placing this issue on the v4.0.0 milestone to investigate, without necessarily committing to implementing this feature.

  4. 1ec5 commented on Jan 26, 2018

    @1ec5
    ContributorAuthor

    Also, for forwards compatibility, we can add a freeform custom function that takes a style specification–flavored expression array, to be used whenever we encounter an operator that doesn’t readily translate to NSExpression syntax.

  5. modified the milestones: , ios-v4.0.1 on Apr 18, 2018
  6. removed this from the ios-v4.0.1 milestone on May 8, 2018
  7. 1ec5 commented on May 8, 2018

    @1ec5
    ContributorAuthor

    We ended up shipping v4.0.0 without these compatibility shims. We won’t be able to add them for v4.0.1, but we remain open to adding them in the future based on developer feedback.

    Also, for forwards compatibility, we can add a freeform custom function that takes a style specification–flavored expression array, to be used whenever we encounter an operator that doesn’t readily translate to NSExpression syntax.

    #11472 added an MGL_FUNCTION() function (from the department of redundancy department) that can represent any style specification–flavored array.

  8. 1ec5 commented on Jun 21, 2018

    @1ec5
    ContributorAuthor

    We aren’t adding these compatibility shims in the near future, but we’re open to reconsidering in the future based on developer feedback.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    iOSmacOSruntime styling

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions