Hi,

>> gen-class loads eg. foo/bar/Baz.clj for class foo.bar.Baz. However,
>> maybe one also has support functions in the foo.bar namespace. Hence
>> one needs also foo/bar/bar.clj.
>
> I seem to be able to solve the problem by putting this at the top of
> Baz.clj:
>
> (ns foo.bar (:use foo.bar))
>
> That causes foo/bar/bar.clj to be loaded the first time its needed and
> not again.  Is that what you want? I'm probably misunderstanding the
> problem, so feel free to correct me.

- You understand me correctly.
- That works? I didn't even try. I was under the impression, that
there
  was some cycle detection implemented in use and require. So I would
  have expected this to fail...

For me this feels fishy, because:
- Why does the user have to do crazy looking stuff? (defining a
  namespace requiring itself?)
- I have to be concerned about load'ing Baz.clj in bar.clj. If there
  is no cycle detection, I'm in trouble. So I have to inform myself
  about unrelated implementation details.
- It is inconsistent to the "namespace matters, not file" philosophy
  advocated previously.

I could also just put "(require 'foo.bar)" in Bar.clj and put the
implementation somewhere else. That would solve the problem also, but
why does the user have to provide boilerplate, when this could be done
automatically?

Your solution solves my problem, but to be honest: to me it looks not
less hacky...

Sincerely
Meikel

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to