Since escaping backslashes inside string literals can get tedious, I
wondered wether a non-escaping string-syntax might be handy.
Yes, raw strings (ala Python) are a useful piece of syntax to have.
But specialized regexp syntax (ala Perl) is even better.
I personally use raw strings quite often in Python and not just for
regexps, but it's true that we already have #<<EOF for that.
A much more handy syntax to have would be that of #/what\.*/i being
read into (delay (regexp "what\\.*" #t)) --and having all the regexp
functions accept promises, of course.
A specialized regexp syntax IHMO should:
- not require escaping of backlashes
- include all supported switches (case insensitive, multiline, etc.)
- memoize or otherwise cache the compilation step
- allow for changing the delimiter: #r(what\.*)i
these are all essential features.
A somewhat useful but not essential feature would be a verbose version:
#r/
what ;the "what" word, case insensitive
\.* ;followed by zero or more full stops
/ix
but I guess this requires support by the underlying regexp library.
Tobia
_______________________________________________
Chicken-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-users