On 23 Feb, 01:28, Mark Engelberg <mark.engelb...@gmail.com> wrote:
> I'm not crazy about this behavior either, but my understanding is that
> this is an intentional design decision that is a direct consequence of
> two things:
> 1.  In Clojure IDEs, people want to be able to feed the compiler
> single functions and expressions.  You don't need to compile the
> entire file all at once; this can be useful for making small
> modifications to a running system.  For consistency, compiling the
> entire file is just like feeding the functions into the compiler one
> by one.  There's no special "lookahead" for compiling a file in its
> entirety.

That's the same for Common Lisp.

> 2.  Without lookahead, declarations are the only way to allow the
> compiler to give an intelligent error message if you accidentally
> refer to a function name that does not exist.  People want good error
> messages.

Doesn't make sense. If the compiler can recognize that a function is
not defined (and it can, since it signals an error), then it can
signal a meaningful error or even better a warning (e.g., "call to
unknown function FOO"). To have the function declaration beforehand is
necessary only when you want to do some optimizations based on the
type of the function or other properties (e.g. if the function is
declared inline).
I don't know why Clojure requires declare, but certainly it looks like
an unnecessary limitation from someone coming from Common Lisp.

Cheers,
Alessio

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