Michael,

Thank you for pointing this out to me. After some thinking, I decided
to lump all the defprotocols in one file; having all the APIs in one
place seemed handy. But using (load) made it possible to keep deftype
in its own file... though I did have to resort to (use) since (in-ns)
doesn't support (:use).

src/foo/core.clj ;; (load "core/protocols") ...
src/foo/core/protocols.clj ;; (defprotocol IBar ...)
src/foo/core/bar.clj ;; (deftype Bar [] IBar ... )

On Jan 25, 3:24 pm, Michael Wood <esiot...@gmail.com> wrote:
> 2010/1/25 Seth <seth.schroe...@gmail.com>:
>
> > No support for cyclical dependencies is biting me too. I'm trying to
> > use one .clj file per protocol&type, which doesn't seem *too* smelly.
> > It's a habit that goes way back... maybe time to revise my
> > worldview :-)
>
> You can still do this and have some or all of those files in the same 
> namespace.
>
> > If a namespace is intended to be a stratum then I will refactor to fit
> > that. Fewer, larger files are just a little more awkward to deal with.
>
> Have a look at clojure.contrib.pprint as an example.
>
> clojure/contrib/pprint.clj basically contains:
>
> (ns clojure.contrib.pprint
>   (:use clojure.contrib.pprint.utilities)
>   (:import [clojure.contrib.pprint PrettyWriter]))
>
> (load "pprint/pprint_base")
> (load "pprint/cl_format")
> (load "pprint/dispatch")
>
> and then each of pprint/{pprint_base,cl_format,dispatch}.clj contain:
>
> (in-ns 'clojure.contrib.pprint)
> [...]
>
> I think this takes care of your use case.
>
> --
> Michael Wood <esiot...@gmail.com>

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