extend already refers to: #'clj-time.core/extend in namespace

2011-09-08 Thread Brad
I started using the clj-time library and found that it works great.
Only issue I don't understand is this one about extend already refers
to another version of extend.

It seems that clj-time has a function called extend that conflicts
with the same named function in clojure.core.

The recommendation online is to put (:refer-clojure :exclude [extend])
in your ns declaration. I've done this.

My core.clj file looks like the following:

(ns test.core
  test project
  (:refer-clojure :exclude (extend))
  (:use clj-time.core))

(defn foo
  []
  (print asdf))

It sounded like doing this would inside my project use the extend
inside of clj-time.core rather than the clojure one.

The following two scenarios happen and don't make sense to me.

The first is I slime-connect to a new swank session. The repl is in
user. I open my test/core.clj file and compile it. When I return to
the repl and (ns test.core) I get a sldb trace which I need to quit.
It has the following complaint:

extend already refers to: #'clj-time.core/extend in namespace:
test.core

The second is a variation where I start a new swank session and in the
repl change the name space to test.core (ns test.core). Then I open
test/core.clj and compile it. This time I just a warning printed to
the REPL as follows:

WARNING: extend already refers to: #'clojure.core/extend in namespace:
test.core, being replaced by: #'clj-time.core/extend

Can anyone explain what is going on here. I don't quite get it.

- Brad


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


Re: extend already refers to: #'clj-time.core/extend in namespace

2011-09-08 Thread Brad
Btw, I'm using

clojure-1.2.0.jar
clj-time-0.3.0.jar

- Brad

On Sep 8, 5:03 pm, Brad b...@beaconhill.com wrote:
 I started using the clj-time library and found that it works great.
 Only issue I don't understand is this one about extend already refers
 to another version of extend.

 It seems that clj-time has a function called extend that conflicts
 with the same named function in clojure.core.

 The recommendation online is to put (:refer-clojure :exclude [extend])
 in your ns declaration. I've done this.

 My core.clj file looks like the following:

 (ns test.core
   test project
   (:refer-clojure :exclude (extend))
   (:use clj-time.core))

 (defn foo
   []
   (print asdf))

 It sounded like doing this would inside my project use the extend
 inside of clj-time.core rather than the clojure one.

 The following two scenarios happen and don't make sense to me.

 The first is I slime-connect to a new swank session. The repl is in
 user. I open my test/core.clj file and compile it. When I return to
 the repl and (ns test.core) I get a sldb trace which I need to quit.
 It has the following complaint:

 extend already refers to: #'clj-time.core/extend in namespace:
 test.core

 The second is a variation where I start a new swank session and in the
 repl change the name space to test.core (ns test.core). Then I open
 test/core.clj and compile it. This time I just a warning printed to
 the REPL as follows:

 WARNING: extend already refers to: #'clojure.core/extend in namespace:
 test.core, being replaced by: #'clj-time.core/extend

 Can anyone explain what is going on here. I don't quite get it.

 - Brad

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


Re: extend already refers to: #'clj-time.core/extend in namespace

2011-09-08 Thread Meikel Brandmeyer (kotarak)
Hi,

the correct way to *change* to a namespace is in-ns. Calling ns will also 
refer to clojure.core. The first scenario happens because the namespace 
already exists and the ns tries to refer extend to #'clojure.core/extend 
which fails because #'clj-time.core/extend is already there. The second 
scenario happens because the namespace did not exist before. So the ns form 
sets up everything as normal. Now loading the file will refer extend to 
clj-time.core/extend. This will only give a warning because now 
clojure.core/extend is replaced and clojure.core gets special treatment here 
by giving only a warning instead of an exception.

tl;dr: Use ns to setup a namespace. Use in-ns to switch namespaces. In your 
case: (in-ns 'test.core).

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