News for hackers. Stuff that matters.
Re:How many errors? by thaumasiotes on Tuesday September 08, 2015 @03:19AM (#10184409)
There is also a non-contrived example in my original comment, String.split("\\s+"). And the advice that regexes in python should always be constructed from r"" strings is a direct response to this problem specifically. I picked a contrived example to make clear that sharing escape characters causes exponential growth as you add layers.

>> Are you really arguing that we could make C less confusing by switching printf("%d", x) to printf("\\d", x)?

> No. I did not say that at all, and I don't appreciate straw man arguments.

This is an argument in a very standard form, reduction to absurdity.

I see printf escapes and C string backslash-based escapes as semantically identical; they are both ways of giving the parser instructions directly rather than giving it a literal representation of what you want (this analysis also nicely explains why they're called "escapes"). But since there is a good amount of evidence that a lot of other programmers feel the same way you do, let me ask this: HTML escapes (with &) have exactly the semantics you attribute to \. Do you think HTML would be better if it used backslashes instead?

There are no comments on this comment yet.