Skip to content

Question: implicit template strings concatenation #368

@un-def

Description

@un-def

Experimenting with the syntax, I discovered that adjacent template string literals are implicitly concatenated:

ucode -Sp '`foo``bar` === "foobar"'
true

Whitespaces between literals are ignored:

ucode -Sp '`foo`
`bar` `baz`'
foobarbaz

This only works with template strings, not single- or double-quoted strings or a mix of the former and the latter.

This doesn't seem to be a part of the ECMAScript syntax (at least this doesn't work with V8 and SpiderMonkey), which ucode is inspired by, and is not documented in the ucode documentation.

I'd like to use this as a feature (see below), but not sure if this is actually a stable feature and not a quirk.

const command = (
    `long`
    ` string`
    ` literal`
)

ucode version I use: v0.0.20250529

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions