Dear Clojure group,

The library clj-record requires to add a source file for every table
in a given database.

This can lead to a lot of files whose namespaces have to be imported
wherever you want to work on the tables.

In order to avoid having to write the whole namespace declaration
every time, I decided put it into a file on its own and load this
namespace via (ns :use...).

The problem is I also have to be able to use an alias with each of the
table files like this:

Table file 1: src/active-record/user.clj

-------------------------------------------------------------------------------

Table file 2: src/active-record/charge.clj

-------------------------------------------------------------------------------

File to hold load and alias the namespaces of the table files:
src/active-record/tns.clj

 (ns active-record.tns
   (:require [active-record.user :as user])
   (:require [active-record.charge :as charge]))

-------------------------------------------------------------------------------

Clojure core file: src/active-record/program/core.clj

(ns active-record.program.core
  (:use active-record.tns))

;; Evaluation returns nil


(user/create
 {:login "my-login"
   :first_name "Jonas"
   :last_name "Rohl"
   :password "secret"
   :email_address "jo...@example.com"})

;; Evaluation throws an exception:
;; No such var: user/create
;;  [Thrown class java.lang.Exception]


(charge/create
 {:user_id 10,
  :amount_dollars 244
  :amount_cents 91
  :category "meals"
  :vendor_name "Metro"
  :date "2010-01-15"})

;; Evaluation throws an exception:
;; No such namespace: charge
;;  [Thrown class java.lang.Exception]

-------------------------------------------------------------------------------


I restarted Emacs and tried again but got the same error messages.

Maybe I messed up the namespace declarations again but it could also
be that referring to an alias that was created in another namespace
might not be possible.

Does anybody know which one is the case?

Stefan

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