I'm not sure I follow what John is saying (some of the terminology is
unfamiliar to me, what the heck's a digraph? :p), but is he suggesting
that $+ not be followed by a whitespace to count as a string? If so, I
think that's undesirable as that is 1) confusing, and 2) limits the
sorts of strings that you can create with it when the point of this
addition would be to expand your freedom when creating strings. If
I've misunderstood however, please let me know.
> It would be really handy if Clojure had a similar #s!!, #s(), #s//,
> etc. facility.
I just vote for #s{ .. } because braces to me are visually appealing
and seem to imply a "grouping" around something. There's a nice
symmetry about them (unlike #s//), they're not associated with the
ever pervasive parens (which are all over the place in lisp, and
should be used to connotative functions calls or lists, and that's
it), and isn't arbitrarily angry (looking at you, #s!!). ;-)
- Greg
On Oct 12, 2009, at 4:40 AM, Danny Woods wrote:
>
> 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 [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---