dimanche 23 mars 2014

Racket raw strings


Vote count:

0




In Racket you have to escape backslashes in strings, therefore Windows paths and regexes become verbose.



For example, the regular expression (.*)\1 can be represented with the string "(.*)\\1" or the regexp constant #rx"(.*)\\1"; the \ in the regular expression must be escaped to include it in a string or regexp constant. [Source: Regexp Syntax]



In many languages like Perl and Ruby regexes are supported syntactically /\([a-z]+\)/, in others there are optional raw strings, like in Python r"\([a-z]+\)". It seems that Racket doesn't support raw strings, where you don't need to escape backslashes, natively. Is there any method to implement them, a third-party library, a proposal, whatever?


See also:



asked 1 min ago

sindikat

2,833





Aucun commentaire:

Enregistrer un commentaire