3 ms·
Hi, i'm the lang designer and implementor here. We absolutely do not normalize newlines as that would defeat the purpose of raw literals. The point here is th
by Metasyntactic 5y ago
Hi, i'm the lang designer and implementor here.
We absolutely do not normalize newlines as that would defeat the purpose of raw literals. The point here is that your content is not interpreted as that's the pain area that people are hitting today. How you write your literal is what you get at the end of the day.
Note: if the content needs to be `\n` then just use that actual newline in teh code. WRT to the file line endings and whatnot, my recommendation is that you never use tools that arbitrarily change that behind your back as it does already have impact today in C#. For example, that will break standard `@""` strings today.
If your line endings are important, then your tools should be setup to respect what you wrote and not change them. All editors can be setup this way, as can git. And that would absolutely be my recommendation on how you should structure things for your code if newlines are relevant.
- jimmygrapes 5y agoAre you left handed by any chance? Trying to resolve an argument about typos in right and left handed people, and I've noticed you have wrote "teh" in many comments (no judgement, you're doing God's work in my opinion). My theory is left handed people are more likely to press e faster than the right hand can get to t and h (in qwerty).
- Measter 5y agoI've not kept up with C#, but does it have something akin to Rust's string continuation? In a Rust string literal a backslash followed by a newline causes the backslash and all following whitespace to be removed. So, for example: let string = "foo\ bar"; Results in `string` having the contents "foobar". That would allow the user to specify the exact newline they need without depending on invisible characters remaining unchanged.