Hi,

Clojure reads a file toplevel expression after toplevel expression and 
compiles and executes them separately (exception: toplevel "do" is split 
into its sub-expressions). The fact that things are stored in a file is 
just a coincidence. You can just as well type everything into the repl 
manually and you won't see a difference. Hence side-effects might occur.

To split a namespace across multiple files use load.

; split/master.clj

(ns split.master
  ...)

(def msg "Hello, World!")

(load "slave")

; split/slave.clj

(in-ns 'split.master)

(defn greet
  []
  (println msg))

; split/consumer.clj

(ns split.consumer
  (:use split.master))

(defn do-greet [] (greet))

Hope that helps.

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