> Reader macros have full access to the text stream, so it would be
> straightforward to define a Perlish heredoc syntax for big literals,
> e.g.
Sure, heredoc could be done, it has the nice advantage of being
flexible, guaranteeing that you can escape any text. The only issue is
that like Perl, it's pretty ugly. I wouldn't object to it though as
long as there was another alternative shorthand for expressing
strings. The purpose of which would be primarily to make writing
regular expressions easier, but also to deal with strings that have
quotes in time, which are found quite frequently when dealing with UI
stuff and user-interaction.
> almost every syntax will require escaping *something*
Yes, but the chance that you'll find *both* a quote and a brace in a
short string is very low. Hence the utility of an alternative
shorthand for short strings.
And having a verbose alternative (heredocs, triple-quote, whatever)
will bullet-proof you against other situations.
- Greg
On Oct 11, 2009, at 8:11 PM, Richard Newman wrote:
>
>> True, and it is why newLISP uses two delimiters for this purpose, {}
>> and [text][/text]. The latter might not work well in clojure though
>> because of its use of arrays.
>
> Reader macros have full access to the text stream, so it would be
> straightforward to define a Perlish heredoc syntax for big literals,
> e.g.
>
> #_SOMETEXT
> foo bar
> ...
>
> SOMETEXT
>
> I don't really see much point in this proposal as a whole, though --
> almost every syntax will require escaping *something*, whether it be
> quotes or curly braces -- so don't view this as me championing
> anything.
>
> I certainly consider triple-quotes to be nicer than #s{}, which is
> (IMO) visually repellent.
>
> The reader macro approach has no significant advantage over triple
> quotes, because either way involves a change to Clojure's Java code.
> Indeed, it might be impossible to escape } within the reader macro
> version, which defeats the point.
>
> >
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---