I agree that backslash string wrapping is obscure.<div>I do use it a lot, but I would not be sad to see it go.</div><div><br></div><div>The same is true for \a, \b, \f, \v, \EM, \DC1, etc.</div><div>We do need \&, though.<br>
<br><div class="gmail_quote">On Tue, Oct 2, 2012 at 10:17 PM, Evan Laforge <span dir="ltr"><<a href="mailto:qdunkan@gmail.com" target="_blank">qdunkan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The backslash string wrapping feature is a fairly obscure part of<br>
haskell syntax, and some tools don't handle it properly (e.g. the<br>
built in 'lex' function won't lex such strings properly). It's also<br>
not as useful as e.g. python's triple quotes, because you have to<br>
suffix and prefix every line with a backslash. As long as you are<br>
have to add suffixes and prefixes (i.e. straight cut and paste no<br>
longer works), you might as well write it out with (++). In other<br>
words, as long as you're applying ('\\':) . (++"\\") you might as well<br>
apply ("++ \""++) . (++"\""). And it seems to me that "string<br>
literal" ++ "another string" is an easy thing for a compiler to<br>
optimize, ghc-core says ghc unsurprisingly has no trouble with it.<br>
<br>
So it's probably not helpful for performance. IMO it's not very<br>
useful for it's intended purpose (embedding multiline strings) because<br>
of the \s everywhere. It doesn't seem very widely used, and it adds a<br>
little bit of a hassle to parsing. And 'lex' doesn't support it.<br>
<br>
Any interest in getting rid of it?<br>
<br>
<br>
I would actually be in favor of triple quotes (yeah, I know it can be<br>
done with quasi-quotes, but still...), but that's a different issue.<br>
<br>
Also, it's hardly a big deal, but do we really need \a, \b, \f, and<br>
\v? The one time I used one (it was \v) it was a typo and I would<br>
have preferred the parse error, instead I got weird output that I<br>
didn't notice for a long time. If I really want to, say, ring the<br>
terminal bell or do a vertical tab or perhaps send a telegraph, I<br>
would be using some library that handles terminal type stuff in a<br>
higher level way. Similarly, the \EM, \DC1, etc. codes are probably<br>
not pulling their weight. The '70s were 40 years ago! And there's<br>
that weird \& thing. Surely cursor control library authors have<br>
better ways to construct their magic codes.<br>
<br>
_______________________________________________<br>
Haskell-prime mailing list<br>
<a href="mailto:Haskell-prime@haskell.org">Haskell-prime@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-prime" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-prime</a><br>
</blockquote></div><br></div>