Raw string literals -- restarting the discussion

Brian Goetz brian.goetz at oracle.com
Wed Jan 16 13:40:03 UTC 2019


> So bringing all this together I have a serious proposal for a formalisation of rawness which I think is fairly unique, but which is internally consistent and imo easy to understand and satisfies all your use-cases.

This sounds a lot like what Swift does.

>     var s = \"Hello, World\"; // a raw string!

Jim has already noted how using \” as a raw delimiter has the effect of suggesting the escaping is “distributed over the string”, which is a nice trick.

Swift unifies raw and escaped strings in this manner, by parameterizing on the number of #.  Unfortunately, if we try to emulate this exactly, because of choices we’ve already made (for the zero-backslash case), we end up with an asymmetry that the Swift approach lacks.  

Still, this approach is something we are considering as a possible inspiration.
> Thoughts? I think it's fairly "Java-like", doesn't introduce too many new concepts, and looks familiar due to adapting existing concepts and notation. Hopefully not deceptively familiar.
There are some good thoughts in here.  Will toss those into the stew and stir….



More information about the amber-dev mailing list