-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
As of right now, template literals are modeled after ECMAScript, e.g.:
export component Foo {
bar: string
return `
Hello ${bar}
`
}
Imho this causes two problems:
- The
${sequence is a considerable complication for the parser (or better: The tokenizer) - Template literals of this kind cause lots of unwanted space, that cannot be
trimed away by the engine itself
I therefore suggest to change the template literal syntax to this:
export component Foo {
bar: string
return """
Hello {bar}
"""
}
Rules are:
- Leading and trailing spaces are trimmed
- Indentation as per the closing delimiter is removed from every line (similar to PHP Heredoc syntax: https://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc)
This will still allow for possible future tagged template literals, like:
export component Foo {
bar: string
return markdown"""
# A markdown document
## Some headline: {bar}
Lorem ipsum...
"""
}
mhsdesign
Metadata
Metadata
Assignees
Labels
No labels