Behind the Proposal — SE-0200 Enhancing String Literals Delimiters to Support Raw Text

The development, refinement, and deployment of SE-0200 Enhancing String Literals Delimiters to Support Raw Text was a long and surprising journey. It ended with a uniquely Swift take on “raw strings” that focused on adding custom delimiters to string literals and escape sequences.

This post discusses what raw strings are, how Swift designed its take on this technology, and how you can use this new Swift 5 feature in your code.

swift.org/blog/behind-SE-0200/

SE-0200 introduces custom delimiters for Swift string literals in Swift 5, allowing raw text that ignores escape sequences unless adjusted with matching pound signs, blending features from languages like Rust while retaining Swift's interpolation.

This design evolved from initial raw string proposals, addressing community feedback by supporting escapes via prefixed backslashes (e.g., # for one-pound delimiters), making it ideal for code generation, JSON, and backslash-heavy content without clutter.

Developers can use zero to multiple # signs around quotes, with the fewest needed for clarity, enabling cleaner multi-line strings and literals free of unnecessary escapes.


Category:

Tag:

Year: