On Nov 28, 8:21 am, "Mark Volkmann" <[EMAIL PROTECTED]> wrote:
> I've been learning Clojure for about a month now and like it so far.
> In the interest of making it easier to convince other people to give
> it a try, I think it would be a good idea to carefully consider some
> readability issues before making the 1.0 release. I'd hate for people
> to reject Clojure based on some of the syntax looking as difficult to
> read as Perl code. I'm mainly referring to reader macros.
>
> I feel that some reader macros are easily justified based on the
> frequency of their use. For example, anonymous functions with #(...)
> instead of (fn ...). Others are much less justified because I suspect
> they are rarely used. For example, #^{...} instead of (meta ...).
>
> So what do others think about this? Should some reader macros be
> eliminated for readability sake?
>
I think it is important to understand what the reader macros do before
proposing changes. For instance #^{...} and (meta ...) are not
equivalent.
As a general rule, reader macros either establish data structure
syntax, given the limited set of delimiters, or provide a shorthand
for a common atomic call that lifts one or more sets of delimiters:
'x => (quote x)
#(...) => (fn [] (...))
^x => (meta x)
@x => (deref x)
etc.
You are under no obligation to use them. You might want to try
translating a bit of code that uses them extensively to code that uses
their expansions explicitly. Is the code really clearer, given the
additional nesting? Is it that much of a cost to learn ', #, ^, @ on
top of quote/fn/meta/deref? A newbie isn't going to know what the
latter mean either.
Using symbols that remind people of Perl doesn't make a language like
Perl. These reader macros have extremely simple rules (they do
something with the next token).
As far as frequency of use, the only one I would reconsider would be ^
for meta, although I can easily imagine metadata intensive programs
that would find ^ quite valuable. I've also seen people using (meta x)
explicitly, so, I don't see a problem. If you don't like them don't
use them.
Rich
--~--~---------~--~----~------------~-------~--~----~
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
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
-~----------~----~----~----~------~----~------~--~---