Many programming languages have syntax that means "everything from this token until the end of the line is a comment" (e.g., // in C-family, ; in Lisp family, # in shell family)

Do any have syntax for "everything from this token until the end of the line is a string"?

Why isn't that a common thing to have? It strikes me as something that'd be *super* handy

Follow

A few weeks ago, I asked:

> Many programming languages have syntax that means "everything from this token until the end of the line is a comment" (e.g., // in C-family, ; in Lisp family, # in shell family)
>
> Do any have syntax for "everything from this token until the end of the line is a string"?
>
> Why isn't that a common thing to have? It strikes me as something that'd be *super* handy

I just learned that has pretty much *exactly* the syntax I wanted! ziglang.org/documentation/mast

@codesections That's neat and looks good, and I wish most languages have something that simple. But you can achieve roughly the same thing already with sequential literals, e.g.

const char *str =
"line 1\n"
"line 2\n"
;

or:

str =\
"line 1\n"\
"line 2\n"

Admittedly more verbose, less pretty, but the main thing is you get the leading indent.

Sign in to participate in the conversation
Fosstodon

Fosstodon is an English speaking Mastodon instance that is open to anyone who is interested in technology; particularly free & open source software.