Clear questions and runnable code
get the best and fastest answer
Re^3: Single Quotes - how to avoid any escape processing?by LanX (Canon)
|on Jan 31, 2013 at 21:59 UTC||Need Help??|
> But why is this always considered a necessary feature for a quoting delimiter, trumping all other considerations like avoiding headaches like the OP describes?
I didn't say it's a necessary, I explained the motivation "If ... you want to allow ...".
> What would prevent the usage of the delimiting character as its own escape character? I.e. two consecutive single-quotes would not terminate a single-quoted string literal
IIRC VB (or VB-Script) does something like this.
> I don't see any reason for ever wanting to put two string literals right next to each other without space or comma in between, so it would not create any syntactical ambiguity.
> Or am I missing something?
Perl has already a very complex syntax, adding new extra DWIM exception doesn't make it easier.
What might be easy and meaningful for you can be line noise or just complexity horror for someone else.
For instance see this discussion about the differences between Perl and JS in handling the closing bracket in regex-character classes: Regex: Char-class equivalent for [^].
So in short: Rules have to be kept as simple as possible and backslashing is a well-established notation.
Moritz already mentioned a new way in Perl6, which sounds reasonably simple, so help is on the way for the next version.
EDIT: And for the records: The OP might hate them but I LOVE HERE-DOCS!!!