Am 02.05.2011 23:14, schrieb David Nolen:

The relevant clojure-dev thread.
http://groups.google.com/group/clojure-dev/browse_thread/thread/f4907ebca8ef6e11

It's not clear whether the core team and the various contributors are
interested in supporting the behavior you want. It's also not clear
whether the issue is matter of the difficulty of a good implementation
or simply disinterest.

Thanks for that link. I would really like to hear (read) a statement of
one member of the core team.
Some of the limitations:
1. (defmacro x [] `(let [a# ~(atom 0)]))

2. (defmacro y [] `(let [a# ~(comp inc inc)])) ; from that link

3. (defmacro z [] `(let [a# ~((fn [x#] (fn [] x#)) 0)]))

All three calls fail, (x) and (y) and (z).
I see no plausible reason why it *should* be that way.
Instead this is useful and idiomatic lisp.

Normally I wanted to write:
`(~(get @loggers level @logger)
  ~(get *level-name* level)
  ~domain ~msg ~e)

The first get will see if for the given “level” there is a level
specific log function. If not it will fall back to the default logger
“logger”. So, “loggers” is a mapping from level to closures and
“logger” is a closure. Those closures are functions that take 4 args:
the log level, a domain, a message and an exception.

Now I have to write instead
(let [l (get @loggers level @logger)
      f (gensym "logger")]
  (intern 'mylib.log f l)
  `(~f ~(get *level-name* level) ~domain ~msg ~e))

which is plain ugly. I need to artificially invent a name, pollute the
NS of my logging lib and probably create less efficient code, because
a lookup of my gensymed ~f will be required at runtime.
Would be great if this could be fixed easily enough to get included in
a (near) future version.


Regards,
André

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