Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simpler closing delimiters for special strings #961

Closed
yannham opened this issue Dec 1, 2022 · 0 comments · Fixed by #979
Closed

Simpler closing delimiters for special strings #961

yannham opened this issue Dec 1, 2022 · 0 comments · Fixed by #979

Comments

@yannham
Copy link
Member

yannham commented Dec 1, 2022

Is your feature request related to a problem? Please describe.
Currently, the delimiters for multiline strings are m%"/"%m (or with more consecutive %, as long as the numbers of % of the opening and the closing delimiter match).

Repeating the m is not very useful (having the % is though, to avoid having to escape " inside multiline strings). New team members also sometimes didn't remember if the closing delimiters were "%m or "m%.

This syntax scheme also doesn't scale well for other type of strings: we can imagine having raw strings at some point, using the same scheme r%", but also language-specific strings to enable highlighting in the editor, such as cpp-lang%", as well as another multicharacters delimiter with #948. With several alphanumeric characters in the delimiter, this scheme becomes really clunky.

Describe the solution you'd like
For multiline strings, and all future special strings literals, have the same closing delimiter "% or "%...%, dropping the m. This is backward-incompatible. We could still allow both "%m and "% to remedy this, but honestly we're at a stage were we can afford to do such breaking changes, and this will prove much better in the long term than having to put up with a legacy alternative syntax.

For the record, this what Rust does with raw strings r#"..."#, as well as C++ (where you don't have to repeat the R or the u8 at the end of special strings).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants