tweag / nickel

Better configuration for less
https://nickel-lang.org/
MIT License
2.37k stars 89 forks source link

Add raw strings #1873

Open fuzzypixelz opened 6 months ago

fuzzypixelz commented 6 months ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

See https://github.com/tweag/nickel/issues/1864.

Describe the solution you'd like A clear and concise description of what you want to happen.

Add r%"..."% syntax for raw strings, where no escape sequences are recognized.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

N/A.

Additional context Add any other context or screenshots about the feature request here.

N/A.

vi commented 3 weeks ago

Maybe usual m%%%%%%%" ... "%%%%%%% (with enough per cent characters) can fill that niche (at least partially)?

vi commented 3 weeks ago

no escape sequences are recognized

But indentation works the same was as in usual multiline string or is also disabled (all bytes just copied literally)?

yannham commented 3 weeks ago

This is a good question. I would tend to disable indentation as well - so that raw is really raw, and there's no interpretation nor transformation whatsoever. But we could also imagine auto de-indenting them. I guess it depends on the use-case we see for raw strings.

You're right that in practice, multiline strings with long delimiters might be enough for most purposes.