Hi Mikel,
I tried your solution but am still not able to import the aliases from
another namespace:
This is what I did:
---------------------------------------------------------------------
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)
(load "/active_record/tns")
;; Returns nil
;; I had to change 'active-record' to 'active_record'
(user/create
{:login "my-login"
:first_name "Jonas"
:last_name "Rohl"
:password "secret"
:email_address "[email protected]"})
;; Evaluation throws an exception:
;; No such var: user/create
;; [Thrown class java.lang.Exception]
;; Same error message as before.
(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]
;; Same error message as before.
---------------------------------------------------------------------
I restarted Emacs after making the above changes to my code.
Maybe it is just not possible to import aliases from another
namespace?
Stefan
On Oct 21, 7:47 pm, Meikel Brandmeyer <[email protected]> wrote:
> Hi,
>
> you can't transfer aliases from one namespace to another. But as a
> workaround, you can create a file which contains the necessary
> commands:
>
> active-record/tables.clj:
> (require '[active-record.user :as user])
> (require '[active-record.charge :as charge])
>
> And then just load the file in the namespaces you want to use the
> tables.
>
> (ns active-record.program.core
> (:load "tables"))
> ...
> ---
> (ns active-record.program.different-namespace
> (:load "tables"))
> ...
>
> (You might have to use "active-record/tables". Haven't used load in a
> while. But without .clj extension!)
>
> Sincerely
> Meikel
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
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