Am 02.05.2011 02:26, schrieb Alan:

You can't embed a function in code as a raw function object

Can anyone give explanations why this is so?
I understand that it may sound provocative, but this sounds to me like
a major bug.

- you need to return code that will result in that function. That it
happens to work for non-closure functions is, as I understand it, a
happy (or not?) accident.

The "workaround" is simple enough: don't do it.

This indeed sounds like a workaround. I don’t want to put you into the
corner of the defenders of that current behaviour. So, please don’t take
my comments as personal criticism.

I just think that a functional programming language should support
closures as first class objects everywhere, also in macros. Especially
if that language is called… “Clojure”.
For example Common Lisp does support this.
In his book “Ansi Common Lisp” Paul Graham wrote:
“With macros, closures, and run-time typing, Lisp transcends object-
oriented programming.”

A modern Lisp like Clojure should indeed support closures in macros.


Instead, return code that will be evaluated in the expansion context
and have the effect you want.

The idea about “static logging” is that this is not required.
I can of course dynamically look the current logger up and simply call
(@*logger* lvl msg)

But with static logging this would still result in dynamic code that
can change its behaviour during runtime. What I want instead is to call
the closure.

Maybe there are good reasons why closures should not be real first class
objects, as it is the case in other programming languages that support
them. If that is the case I would really like to hear it.

I am not interested in the answers of religious fanatics who defend any
behaviour that the current implementation has, even if it obviously
limits the expressiveness.


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