2 ms·
Hi. I'm the language designer behind this feature :) A few points. > but the following would generate the same string, since each line begins after the """:
by Metasyntactic 5y ago
Hi. I'm the language designer behind this feature :)
A few points.
> but the following would generate the same string, since each line begins after the """:
That's not a virtue here. The point is to be able to write clear literals that never need escapes and which allow for easy grokking of what the content actually is.
All current string forms in C# require some amount of manual (or tooling) help to fix them up to be legal. That's not the case with this literal. The content can always work as-is without having to touch it at all.
- __ryan__ 5y agoThat definitely makes sense. In my (limited, especially not C#) experience I just really dislike reasoning about trimming the leading whitespace, even if the rules are simple. I yearn for a consistent visual cue. In my syntax, the IDE would ideally treat the """ block virtually like a <textarea>.
- Metasyntactic 5y ago> I just really dislike reasoning about trimming the leading whitespace Note: this feature is entirely optional. You can absolutely not have leading whitespace trimming at all. Indeed, this is a requirement of the proposal as we have to make it possible to actually represent text that has leading whitespace :)