2009/8/24 wangzx <wangzaixi...@gmail.com>:
>
> (defn hello
>  "Writes hello message to *out*. Calls you by username.
>  Knows if you have been here before."
>        [username]
>        (dosync
>                (let [past-visitor (@visitors username)]
>                        (if past-visitor
>                                (str "Welcome back, " username)
>                                (do
>                                        (alter visitors conj username)
>                                        (str "Hello, " username) ) ) ) ) )
>
> The code is copied from book "Programming Clojure", I think the ) is
> too much for reading. So, can we using the following style:
>
> defn hello [username]
>        dosync
>                let [past-visitor (@visitors username)]
>                        if past-visitor
>                                str "welcome back, " username
>                                do
>                                        alter visitors conj username
>                                        str "Hello, " username
>
> The line indent contains the parenthesis and it looks it is much
> friendly for ready.
>
> I think clojure may mix both the parenthese and python-like indent
> together.
>

Sorry, I think it's a bad idea. Clojure is not Python!

To be clear, I like the idea of indentation-as-block-delimiters, but I
like it in Python (and would like to see it in other imperative
programming languages). I think it's a bad idea to implement it in
Clojure for a number of reasons:

1. Clojure is LISP, and LISP's about parentheses!
2. It is NOT simple to do, and IMO unjustified complexity. Maybe it's
simple to implement superficially, but there would be some ugly,
inevitable warts, I think?
3. I see no pragmatic reason to implement
a more complex parser and impose a coding style that could be quite
different to what Lispers (or Clojurers) are acostumed to. I don't
really see it more legible than lisps parentheses. I SEE, however, how
it could make some other code (imperative paradigm, mainly) cleaner.


-- 
Patrick Steiger.

"Theory is when you know something, but it doesn't work. Practice is
when something works, but you don't know why.
Programmers combine theory and practice: Nothing works and they don't
know why." - Anon

--~--~---------~--~----~------------~-------~--~----~
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