On 17 Mar, 13:23, Rich Hickey <richhic...@gmail.com> wrote:
> I remain opposed, and here are some more reasons:
>
> when you say
>
> (def foo [x]
>   (bar x 42))
>
> you are as likely to be referring to a forgot-to-require bar-lib as
> you are to a to-be-defined bar.
>
> The compiler can only default the latter, by interning bar in the
> current namespace.

I don't think having the compiler guessing what I mean to be a cool
idea. It reminds me of the so-called C++ template instantiation
problem (I'd say "nightmare") where the compiler tries several ways to
instantiate a template until it founds a way which works, and which
couldn't be the way you intended if you are not skilled enough (and
even then...). So I'll always vote for a predictable interpretation.
As if my vote had any value :-D

> There is no notion of compiling with a placeholder,
> the name must be resolved to something. Should you really intend the
> former, you end up with a mess, as you add (:require bar-lib) to your
> ns call only to have it fail with a conflict - bar already defined in
> your-ns.

I forgot that Clojure is a compiler, not a interpreter/compiler as the
other lisps I've tried out. So there are some issues involved.

> Then you have to ns-unmap bar and retry. This is a big pain and one
> you encounter all the time in Common Lisp, where the reader has auto-
> interning characteristics similar to what is being discussed here.

Thank you Rich for saving us such a big pain indeed ^_^ As they say,
sometimes the cure is worst than the illness...

> The biggest reason is - I'm not having the problems you are
> describing, and neither are other experienced Clojure developers -
> many of whom use the repl a lot.
>
> Early on, I considered this a theoretical argument, but might have
> been persuaded to reconsider if it kept coming up, but it didn't, and
> doesn't.
>
> (declare x y z foo bar baz ...)
>
> is such a simple way to delay some decisions and sketch, I do not
> consider it a serious impediment.

That's very reasonable: you shouldn't solve issues which are not
bothering you or your fellows, more so when you know beforehand that a
solution could backfire. So why I'm experiencing such a discomfort?
And I'm not alone, someone else already confessed sharing my
discomfort (even if they are not fully aware of it). Because we are
not experienced Clojure developers, are we? ;-)

Jokes apart, as I stated before, I do agree that Clojure does the
right thing by requiring you to specify where it should look for a
symbol; still I think I shouldn't be bothered with declaring symbols
and/or ordering functions in a counter intuitive way. You can't
reproach my laziness after Clojure itself have embraced it, can you?
^_^

I thought about it, read again the answers of my fellow developers and
realized that we are not dealing with a limitation of the compiler
itself: we are dealing with a limitation of our current development
environment. Therefore the problem should be solved at the tools
level. For instance: we could wrap the REPL with code which checks for
missing definition errors and then gives the developer the choice
about what to do: to fix a typo or to automatically issue a
declaration against the REPL, followed by the rejected definition
again. If such functionality is provided by the IDE, then the auto
issued declarations could be automatically inserted at the top of the
source file, and we'd never have to deal with them.

To summarize: let's both preserve Clojure's sound sanity checks and
make computer do the boring job. Here in Italy we call it "having a
full barrel and a drunk wife". What about your country? ^_^

What do you think?

--~--~---------~--~----~------------~-------~--~----~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to