Perl and Ruby do something similar with regular expressions, where the
character following 'm' or 's' becomes the delimiter for that
expression, making 'm/\/some\/path/' identical to 'm!/some/path!'.  The
delimeter can be 'smart' as well, where the closing delimiter is
dependent upon the opening one (in the case of brackets, parentheses and
braces) leading to expressions like 'm(/some/path)'.  It would be really
handy if Clojure had a similar #s!!, #s(), #s//, etc. facility.

John Harrop wrote:
> How about borrowing a page from LaTeX? That has a \verb+text+ which
> can use any desired delimiter character. My thought is to have
> something like $+.....+ turning whatever was between the character
> following $ (here, +) until the next occurrence of that character into
> a literal string. A way to escape the chosen character is still
> desirable, though it could be chosen in most cases not to be needed.
> Perhaps the sequence $+ recurring would translate to a literal + (and
> any other $x digraph into a literal $x digraph). $ seems like a good
> choice because it suggests the letter s, as in string, is not already
> overloaded in Clojure for some following symbols (unlike #), and very
> rarely occurs in text with a nonwhitespace character afterward. (This
> post stands as an obvious exception, but even then, I've used $+ and
> $x only so using a third nonwhitespace character after the $ would
> allow quoting this post verbatim in the same manner.)
> Sole limitation on the following character would be that it not be
> whitespace (a stand-alone $ would be treated the same as it currently
> is, as would a $ with no leading whitespace, so referencing nested
> Java classes would not be broken; multicharacter symbols starting with
> $ would be but I expect there is as of yet little or no preexisting
> code with such symbols).
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to