chharvey / counterpoint

A robust programming language.
GNU Affero General Public License v3.0
2 stars 0 forks source link

String literals: double-quotes #88

Closed chharvey closed 1 year ago

chharvey commented 1 year ago

This feature changes the string lexicon from single-quotes to double-quotes. It is breaking, and it supersedes #5, #6, and #33.

let string_literal: str = "String literals are now double-quoted!
    They now use **U+0022 QUOTATION MARK** as delimiters.
    The rest of the syntax hasn’t changed —
    They may still contain line breaks,
    \"escape sequences\",
    line continuations,\
    and in-string comments. % this comment is omitted from the string value";

let string_template: str = """String templates are also double-quoted!
    They are still delimited with three quotes.
    The rest of their syntax hasn’t changed, either —
    They may still contain line breaks and {{ interpolation }},
    but no \"escape sequences\", line continuations\,
    or in-string comments.
    % The string value contains this comment and the backslashes written above.""";

Additionally, Unicode identifiers are now written with single-quotes instead of back-ticks.

let 'Svaret på den ultimata frågan.': int = 42;

Again, only the delimiter has changed; everything else stays the same.