Mmm, I could create a third namespace that contained the common
functionality. But it is an artificial separation. If a user read
through the source code, he would think "why is this code separated
into two files, when it's dealing with the same thing?"

Anyway, here's my use-case:
I wrote a sprite_engine.clj file. This file contains the internal
workings of creating and manipulating a graphics engine for different
types of sprites.

Sprites should be defined in their own file. ie. box_sprite.clj,
cursor_sprite.clj, player_sprite.clj.
These sprites :use sprite_engine.clj for some utility methods for
manipulating the sprite_engine.

By default, a sprite_engine has only one sprite. A cursor sprite.
So my sprite_engine.clj :uses cursor_sprite.clj, but my
cursor_sprite.clj also uses sprite_engine.clj.

-------sprite_engine.clj------
(ns sprite_engine
  (:uses cursor_sprite))

(defn add_sprite [sprite engine]
  ...)

(defn get_sprite_id [engine]
  ...)

(defn new_sprite_engine []
  ...
  (add_sprite (new_cursor_sprite))
  ...)

------cursor_sprite.clj-----
(ns cursor_sprite
  (:uses sprite_engine))

(defn new_cursor_sprite []
  (assign_id (new_sprite_id))
  ...)


So, my code (I think) is pretty well separated in terms of
responsibility. But as it's structured right now, I can't load the
file. Is there an elegant way of going about this?
  -Patrick
--~--~---------~--~----~------------~-------~--~----~
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