Ar an triú lá de mí Eanair, scríobh Jamie Zawinski:
[...] Incidentally, #r is inconsistent, as it has no way to read a
string
ending in a backslash or a double-quote.
Right, but as a practical matter it’s possible to add u to the r to say that
Unicode escapes (and only Unicode escapes) are allowed, allowing examples
like the following:
#ru"\u0022" => "\"" (1 character)
#ru"\u005c" => "\\" (1 character)
#ru"a\b\u263a" => "a\\b☺" (4 characters)
Both the issue and the workaround are inherited from Python.
My feeling is an approach close to what PHP does, with separate functions
for the PCRE engine, is most reasonable for us, given that raw strings are
probably syntactic convenience enough. (And use the shared library, good God
there’s no reason to reimplement Perl regexp syntax, or even to translate
it.) I would even be inclined to drop the idea of match data for these
functions, since we can return multiple values for the matches. But I don’t
anticipate having the time to implement these things in 2011.
--
“Apart from the nine-banded armadillo, man is the only natural host of
Mycobacterium leprae, although it can be grown in the footpads of mice.”
-- Kumar & Clark, Clinical Medicine, summarising improbable leprosy research
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-beta