Skip to content

Template string support in Expression Language #48353

Closed
@uuf6429

Description

@uuf6429

Description

A few months ago I hacked up support on top of Symfony EL for ES6-style template literals*.

While it works reasonably well (even though a hack, thanks to Symfony's ongoing extension hostility), I think it could make sense to have this built-in:

  • template strings are extremely convenient in expressions: `${greeting} ${name}!` instead of greeting ~ ' ' ~ name ~ '!'
  • Symfony's use of tilde as a concatenation operator is extremely unpopular
  • since backticks are not currently a part of the EL syntax, implementing this feature will be backword compatible and relatively easy to implement

* the current implementation linked above does not change the Symfony EL parser/internals, but rather converts templating string syntax to Symfony syntax; using brackets and tildes.

Example

`Fifteen is ${a + b} and not ${2 * a + b}.`

Metadata

Metadata

Assignees

No one assigned

    Labels

    ExpressionLanguageRFCRFC = Request For Comments (proposals about features that you want to be discussed)Stalled

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions