Re: Problem reloading source file with imports

2010-08-31 Thread Meikel Brandmeyer
Hi,

On 31 Aug., 12:00, Chris Jenkins  wrote:

> The thing that still confuses me is that I can successfully load a source
> file that imports the whole of clojure.contrib.seq once (with warnings) but
> an attempt to reload that source file then fails - even if I edit the source
> file to remove the whole :use clause before reloading. That's weird but I'm
> working again and that's the important thing - thanks.

What happens is the following:

1. partition-by from core is created in the namespace.
2. partition-by is overwritten by the seq-utils version => warning

<- now the reload happens. reload does not nuke the old version of the
namespace. so the old bindings are still in effect. ->

3. partition-by is supposed to be overwritten by the core version. =>
error

I think this is some special treatment for core. But I don't clearly
remember. You can consult the archives of the group. There was some
discussion on this topic.

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


Re: Problem reloading source file with imports

2010-08-31 Thread Chris Jenkins
Thanks Robert. That makes a lot of sense and I was able to follow your
advice last night and get my source file to reload successfully by adding
":only [indexed]" to my :use clause (because indexed was the only function
that I was using in this case).

The thing that still confuses me is that I can successfully load a source
file that imports the whole of clojure.contrib.seq once (with warnings) but
an attempt to reload that source file then fails - even if I edit the source
file to remove the whole :use clause before reloading. That's weird but I'm
working again and that's the important thing - thanks.

On 30 August 2010 21:05, Robert McIntyre  wrote:

> Sorry, I was tired and didn't explain very well.
>
> Right now you have a "naked"
> (:use clojure.contrib.seq-utils)
> somewhere.
>
> You want to use partition-by, but that's already in core, so you might
> just get rid of the :use altogether.
>
> But maybe there are some other functions in seq-utils that you do want
> to use --- in that case, do
> (:use [clojure.contrib [seq-utils :only [functions you want]]])
> or
> (:use [clojure.contrib [seq-utils :only []]])
>
> to avoid stepping on core and also to document what you actually use.
>
> If you really want the seq-utils version of partition-by, then you can do:
>
> (:use [clojure.contrib [seq-utils :as whatever]])
> whatever/partition-by
>
> And if you really want to replace the core version with the seq
> version without any namespacing, do
>
> (:refer-clojure :exclude [partition-by])
> (:use [clojure.contrib [seq-utils :only [partition-by]]])
>
> does that help?
>
> --Robert McIntyre
>
>
>
>
>
>
> On Mon, Aug 30, 2010 at 2:43 PM, Chris Jenkins 
> wrote:
> > How would using the :only keyword help here? Just to be clear, the
> problem
> > here is that attempting to load my source file the second time fails
> > (loading the first time having succeeded, albeit with a few warnings
> about
> > replacing symbols from clojure.core), which makes it very difficult for
> me
> > to use swank-clojure, for example, because I can't hit C-c C-k twice on
> the
> > same file.
> > Here is the failure when I try to load the file for the second time:
> > java.lang.IllegalStateException: partition-by already refers to:
> > #'clojure.contrib.seq-utils/partition-by in namespace: test.core
> > (core.clj:1)
> > So here's my main question: If I'm working in the REPL and I edit a file
> > that I've preu'vviously loaded, how can I cause the file to be reloaded
> without
> > hitting that error? If my .clj file doesn't :use any other clojure
> modules
> > then reloading works fine but, if it imports anything, then the second
> > (load-file...) fails.
> > On 30 August 2010 11:05, Robert McIntyre  wrote:
> >>
> >> Yeah, they changed that from clojure 1.1 and it's really annoying ---
> >> as far as I know, your only options right now are to either select
> >> exactly which functions
> >> from seq-utils you want using the :only keyword, or if you really want
> >> to use the seq-utils version
> >> you can use refer-clojure and the :exclude keyword. Or, you can use
> >> the :as keyword in the :use form
> >> to qualify the import so that you don't actually replace anything.
> >>
> >> If you accidently get this warning and don't want to restart the repl
> >> you can do
> >> (ns-unmap 'your-namespace 'offending-function), fix the naked import,
> >> and reload.
> >>
> >> --Robert McIntyre
> >>
> >>
> >>
> >>
> >> On Mon, Aug 30, 2010 at 5:54 AM, Chris Jenkins 
> >> wrote:
> >> > Since I switched to Clojure 1.2, I see an error message whenever I try
> >> > to
> >> > reload a source file that imports anything. The error message is of
> the
> >> > form
> >> > " already refers to xxx", as though it is complaining that it
> can't
> >> > import the same thing twice.
> >> > For example, I have a minimal source file that looks like this:
> >> > (ns test.core
> >> >   (:use clojure.contrib.seq-utils))
> >> > I can load it (once!) into the Clojure REPL successfully:
> >> > $ java -cp lib/clojure-contrib-1.2.0.jar:lib/clojure-1.2.0.jar
> >> > clojure.main
> >> > Clojure 1.2.0
> >> > user=> (load-file "src/test/core.clj")
> >> > WARNING: partition-by already refers to: #'clojure.core/partition-by
> in
> >> > namespace: test.core, being replaced by:
> >> > #'clojure.contrib.seq-utils/partition-by
> >> > WARNING: frequencies already refers to: #'clojure.core/frequencies in
> >> > namespace: test.core, being replaced by:
> >> > #'clojure.contrib.seq-utils/frequencies
> >> > WARNING: shuffle already refers to: #'clojure.core/shuffle in
> namespace:
> >> > test.core, being replaced by: #'clojure.contrib.seq-utils/shuffle
> >> > WARNING: reductions already refers to: #'clojure.core/reductions in
> >> > namespace: test.core, being replaced by:
> >> > #'clojure.contrib.seq-utils/reductions
> >> > WARNING: partition-all already refers to: #'clojure.core/partition-all
> >> > in
> >> > namespace: test.core, being replaced by:
> >> > #'clojure.contrib.seq-utils

Re: Problem reloading source file with imports

2010-08-30 Thread John Sanda
I ran into the same situation as Chris yesterday with
clojure.contrib.seq-utils as well as with clojure.contrib.str-utils. The
explanation is very timely for me and much appreciated.

- John

On Mon, Aug 30, 2010 at 4:05 PM, Robert McIntyre  wrote:

> Sorry, I was tired and didn't explain very well.
>
> Right now you have a "naked"
> (:use clojure.contrib.seq-utils)
> somewhere.
>
> You want to use partition-by, but that's already in core, so you might
> just get rid of the :use altogether.
>
> But maybe there are some other functions in seq-utils that you do want
> to use --- in that case, do
> (:use [clojure.contrib [seq-utils :only [functions you want]]])
> or
> (:use [clojure.contrib [seq-utils :only []]])
>
> to avoid stepping on core and also to document what you actually use.
>
> If you really want the seq-utils version of partition-by, then you can do:
>
> (:use [clojure.contrib [seq-utils :as whatever]])
> whatever/partition-by
>
> And if you really want to replace the core version with the seq
> version without any namespacing, do
>
> (:refer-clojure :exclude [partition-by])
> (:use [clojure.contrib [seq-utils :only [partition-by]]])
>
> does that help?
>
> --Robert McIntyre
>
>
>
>
>
>
> On Mon, Aug 30, 2010 at 2:43 PM, Chris Jenkins 
> wrote:
> > How would using the :only keyword help here? Just to be clear, the
> problem
> > here is that attempting to load my source file the second time fails
> > (loading the first time having succeeded, albeit with a few warnings
> about
> > replacing symbols from clojure.core), which makes it very difficult for
> me
> > to use swank-clojure, for example, because I can't hit C-c C-k twice on
> the
> > same file.
> > Here is the failure when I try to load the file for the second time:
> > java.lang.IllegalStateException: partition-by already refers to:
> > #'clojure.contrib.seq-utils/partition-by in namespace: test.core
> > (core.clj:1)
> > So here's my main question: If I'm working in the REPL and I edit a file
> > that I've preu'vviously loaded, how can I cause the file to be reloaded
> without
> > hitting that error? If my .clj file doesn't :use any other clojure
> modules
> > then reloading works fine but, if it imports anything, then the second
> > (load-file...) fails.
> > On 30 August 2010 11:05, Robert McIntyre  wrote:
> >>
> >> Yeah, they changed that from clojure 1.1 and it's really annoying ---
> >> as far as I know, your only options right now are to either select
> >> exactly which functions
> >> from seq-utils you want using the :only keyword, or if you really want
> >> to use the seq-utils version
> >> you can use refer-clojure and the :exclude keyword. Or, you can use
> >> the :as keyword in the :use form
> >> to qualify the import so that you don't actually replace anything.
> >>
> >> If you accidently get this warning and don't want to restart the repl
> >> you can do
> >> (ns-unmap 'your-namespace 'offending-function), fix the naked import,
> >> and reload.
> >>
> >> --Robert McIntyre
> >>
> >>
> >>
> >>
> >> On Mon, Aug 30, 2010 at 5:54 AM, Chris Jenkins 
> >> wrote:
> >> > Since I switched to Clojure 1.2, I see an error message whenever I try
> >> > to
> >> > reload a source file that imports anything. The error message is of
> the
> >> > form
> >> > " already refers to xxx", as though it is complaining that it
> can't
> >> > import the same thing twice.
> >> > For example, I have a minimal source file that looks like this:
> >> > (ns test.core
> >> >   (:use clojure.contrib.seq-utils))
> >> > I can load it (once!) into the Clojure REPL successfully:
> >> > $ java -cp lib/clojure-contrib-1.2.0.jar:lib/clojure-1.2.0.jar
> >> > clojure.main
> >> > Clojure 1.2.0
> >> > user=> (load-file "src/test/core.clj")
> >> > WARNING: partition-by already refers to: #'clojure.core/partition-by
> in
> >> > namespace: test.core, being replaced by:
> >> > #'clojure.contrib.seq-utils/partition-by
> >> > WARNING: frequencies already refers to: #'clojure.core/frequencies in
> >> > namespace: test.core, being replaced by:
> >> > #'clojure.contrib.seq-utils/frequencies
> >> > WARNING: shuffle already refers to: #'clojure.core/shuffle in
> namespace:
> >> > test.core, being replaced by: #'clojure.contrib.seq-utils/shuffle
> >> > WARNING: reductions already refers to: #'clojure.core/reductions in
> >> > namespace: test.core, being replaced by:
> >> > #'clojure.contrib.seq-utils/reductions
> >> > WARNING: partition-all already refers to: #'clojure.core/partition-all
> >> > in
> >> > namespace: test.core, being replaced by:
> >> > #'clojure.contrib.seq-utils/partition-all
> >> > WARNING: group-by already refers to: #'clojure.core/group-by in
> >> > namespace:
> >> > test.core, being replaced by: #'clojure.contrib.seq-utils/group-by
> >> > WARNING: flatten already refers to: #'clojure.core/flatten in
> namespace:
> >> > test.core, being replaced by: #'clojure.contrib.seq-utils/flatten
> >> > nil
> >> > If I try to reload it then I see an error message:
> >> > use

Re: Problem reloading source file with imports

2010-08-30 Thread Robert McIntyre
Sorry, I was tired and didn't explain very well.

Right now you have a "naked"
(:use clojure.contrib.seq-utils)
somewhere.

You want to use partition-by, but that's already in core, so you might
just get rid of the :use altogether.

But maybe there are some other functions in seq-utils that you do want
to use --- in that case, do
(:use [clojure.contrib [seq-utils :only [functions you want]]])
or
(:use [clojure.contrib [seq-utils :only []]])

to avoid stepping on core and also to document what you actually use.

If you really want the seq-utils version of partition-by, then you can do:

(:use [clojure.contrib [seq-utils :as whatever]])
whatever/partition-by

And if you really want to replace the core version with the seq
version without any namespacing, do

(:refer-clojure :exclude [partition-by])
(:use [clojure.contrib [seq-utils :only [partition-by]]])

does that help?

--Robert McIntyre






On Mon, Aug 30, 2010 at 2:43 PM, Chris Jenkins  wrote:
> How would using the :only keyword help here? Just to be clear, the problem
> here is that attempting to load my source file the second time fails
> (loading the first time having succeeded, albeit with a few warnings about
> replacing symbols from clojure.core), which makes it very difficult for me
> to use swank-clojure, for example, because I can't hit C-c C-k twice on the
> same file.
> Here is the failure when I try to load the file for the second time:
> java.lang.IllegalStateException: partition-by already refers to:
> #'clojure.contrib.seq-utils/partition-by in namespace: test.core
> (core.clj:1)
> So here's my main question: If I'm working in the REPL and I edit a file
> that I've preu'vviously loaded, how can I cause the file to be reloaded 
> without
> hitting that error? If my .clj file doesn't :use any other clojure modules
> then reloading works fine but, if it imports anything, then the second
> (load-file...) fails.
> On 30 August 2010 11:05, Robert McIntyre  wrote:
>>
>> Yeah, they changed that from clojure 1.1 and it's really annoying ---
>> as far as I know, your only options right now are to either select
>> exactly which functions
>> from seq-utils you want using the :only keyword, or if you really want
>> to use the seq-utils version
>> you can use refer-clojure and the :exclude keyword. Or, you can use
>> the :as keyword in the :use form
>> to qualify the import so that you don't actually replace anything.
>>
>> If you accidently get this warning and don't want to restart the repl
>> you can do
>> (ns-unmap 'your-namespace 'offending-function), fix the naked import,
>> and reload.
>>
>> --Robert McIntyre
>>
>>
>>
>>
>> On Mon, Aug 30, 2010 at 5:54 AM, Chris Jenkins 
>> wrote:
>> > Since I switched to Clojure 1.2, I see an error message whenever I try
>> > to
>> > reload a source file that imports anything. The error message is of the
>> > form
>> > " already refers to xxx", as though it is complaining that it can't
>> > import the same thing twice.
>> > For example, I have a minimal source file that looks like this:
>> > (ns test.core
>> >   (:use clojure.contrib.seq-utils))
>> > I can load it (once!) into the Clojure REPL successfully:
>> > $ java -cp lib/clojure-contrib-1.2.0.jar:lib/clojure-1.2.0.jar
>> > clojure.main
>> > Clojure 1.2.0
>> > user=> (load-file "src/test/core.clj")
>> > WARNING: partition-by already refers to: #'clojure.core/partition-by in
>> > namespace: test.core, being replaced by:
>> > #'clojure.contrib.seq-utils/partition-by
>> > WARNING: frequencies already refers to: #'clojure.core/frequencies in
>> > namespace: test.core, being replaced by:
>> > #'clojure.contrib.seq-utils/frequencies
>> > WARNING: shuffle already refers to: #'clojure.core/shuffle in namespace:
>> > test.core, being replaced by: #'clojure.contrib.seq-utils/shuffle
>> > WARNING: reductions already refers to: #'clojure.core/reductions in
>> > namespace: test.core, being replaced by:
>> > #'clojure.contrib.seq-utils/reductions
>> > WARNING: partition-all already refers to: #'clojure.core/partition-all
>> > in
>> > namespace: test.core, being replaced by:
>> > #'clojure.contrib.seq-utils/partition-all
>> > WARNING: group-by already refers to: #'clojure.core/group-by in
>> > namespace:
>> > test.core, being replaced by: #'clojure.contrib.seq-utils/group-by
>> > WARNING: flatten already refers to: #'clojure.core/flatten in namespace:
>> > test.core, being replaced by: #'clojure.contrib.seq-utils/flatten
>> > nil
>> > If I try to reload it then I see an error message:
>> > user=> (load-file "src/test/core.clj")
>> > java.lang.IllegalStateException: partition-by already refers to:
>> > #'clojure.contrib.seq-utils/partition-by in namespace: test.core
>> > (core.clj:1)
>> > user=>
>> > This error message is seen even if I edit the source file and remove the
>> > (:use ...) clause and then try to load the file again.
>> > Anyone have any idea what is going on? I didn't see this behaviour in
>> > Clojure 1.1 and it would be nice if I could find a way to

Re: Problem reloading source file with imports

2010-08-30 Thread Chris Jenkins
Thanks for the pointers you guys. I changed my code to this:

(ns test.core
  (:use [clojure.contrib.seq :only (indexed)]))

... (indexed being the function that I was interested in) and it now works
ok. I can reload the file as many times as I like.

I must confess that I am rather confused by all this. When I was loading in
the whole of clojure.contrib.seq-utils, it was perfectly possible to load
partition-by once (albeit with a warning) but trying to reload the source
file, causing partition-by to be loaded a second time, failed. Does that
sound right?

Cheers,

Chris


On 30 August 2010 20:31, Phil Hagelberg  wrote:

> On Mon, Aug 30, 2010 at 3:05 AM, Robert McIntyre  wrote:
> > Yeah, they changed that from clojure 1.1 and it's really annoying ---
> > as far as I know, your only options right now are to either select
> > exactly which functions
> > from seq-utils you want using the :only keyword, or if you really want
> > to use the seq-utils version
> > you can use refer-clojure and the :exclude keyword. Or, you can use
> > the :as keyword in the :use form
> > to qualify the import so that you don't actually replace anything.
>
> Actually this namespace was only kept around for
> backwards-compatibility. If you use the new clojure.contrib.seq
> namespace it won't have these issues. Unfortunately while Clojure
> itself had a nice set of release notes documenting these changes, I
> couldn't find one for contrib.
>
> -Phil
>
> --
> 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
>

-- 
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: Problem reloading source file with imports

2010-08-30 Thread Phil Hagelberg
On Mon, Aug 30, 2010 at 3:05 AM, Robert McIntyre  wrote:
> Yeah, they changed that from clojure 1.1 and it's really annoying ---
> as far as I know, your only options right now are to either select
> exactly which functions
> from seq-utils you want using the :only keyword, or if you really want
> to use the seq-utils version
> you can use refer-clojure and the :exclude keyword. Or, you can use
> the :as keyword in the :use form
> to qualify the import so that you don't actually replace anything.

Actually this namespace was only kept around for
backwards-compatibility. If you use the new clojure.contrib.seq
namespace it won't have these issues. Unfortunately while Clojure
itself had a nice set of release notes documenting these changes, I
couldn't find one for contrib.

-Phil

-- 
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: Problem reloading source file with imports

2010-08-30 Thread Meikel Brandmeyer
Hi,

Am 30.08.2010 um 20:43 schrieb Chris Jenkins:

> How would using the :only keyword help here? Just to be clear, the problem 
> here is that attempting to load my source file the second time fails (loading 
> the first time having succeeded, albeit with a few warnings about replacing 
> symbols from clojure.core), which makes it very difficult for me to use 
> swank-clojure, for example, because I can't hit C-c C-k twice on the same 
> file.
> 
> Here is the failure when I try to load the file for the second time:
> 
> java.lang.IllegalStateException: partition-by already refers to: 
> #'clojure.contrib.seq-utils/partition-by in namespace: test.core (core.clj:1)
> 
> So here's my main question: If I'm working in the REPL and I edit a file that 
> I've previously loaded, how can I cause the file to be reloaded without 
> hitting that error? If my .clj file doesn't :use any other clojure modules 
> then reloading works fine but, if it imports anything, then the second 
> (load-file...) fails.

:only helps insofar, that you can say (:use [clojure.contrib.seq-utils :only 
(some thing-else)]). This will prevent partition-by from being loaded form 
seq-utils in the first place. Nothing bad happens. Similar you can say 
(:refer-clojure :exclude (partition-by)]). This will prevent partition-by being 
loaded from core. Both solutions will work. However you will probably want to 
switch your code to use the core version of partition-by.

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


Re: Problem reloading source file with imports

2010-08-30 Thread Chris Jenkins
How would using the :only keyword help here? Just to be clear, the problem
here is that attempting to load my source file the second time fails
(loading the first time having succeeded, albeit with a few warnings about
replacing symbols from clojure.core), which makes it very difficult for me
to use swank-clojure, for example, because I can't hit C-c C-k twice on the
same file.

Here is the failure when I try to load the file for the second time:

java.lang.IllegalStateException: partition-by already refers to:
#'clojure.contrib.seq-utils/partition-by in namespace: test.core
(core.clj:1)

So here's my main question: If I'm working in the REPL and I edit a file
that I've previously loaded, how can I cause the file to be reloaded without
hitting that error? If my .clj file doesn't :use any other clojure modules
then reloading works fine but, if it imports anything, then the second
(load-file...) fails.

On 30 August 2010 11:05, Robert McIntyre  wrote:

> Yeah, they changed that from clojure 1.1 and it's really annoying ---
> as far as I know, your only options right now are to either select
> exactly which functions
> from seq-utils you want using the :only keyword, or if you really want
> to use the seq-utils version
> you can use refer-clojure and the :exclude keyword. Or, you can use
> the :as keyword in the :use form
> to qualify the import so that you don't actually replace anything.
>
> If you accidently get this warning and don't want to restart the repl
> you can do
> (ns-unmap 'your-namespace 'offending-function), fix the naked import,
> and reload.
>
> --Robert McIntyre
>
>
>
>
> On Mon, Aug 30, 2010 at 5:54 AM, Chris Jenkins 
> wrote:
> > Since I switched to Clojure 1.2, I see an error message whenever I try to
> > reload a source file that imports anything. The error message is of the
> form
> > " already refers to xxx", as though it is complaining that it can't
> > import the same thing twice.
> > For example, I have a minimal source file that looks like this:
> > (ns test.core
> >   (:use clojure.contrib.seq-utils))
> > I can load it (once!) into the Clojure REPL successfully:
> > $ java -cp lib/clojure-contrib-1.2.0.jar:lib/clojure-1.2.0.jar
> clojure.main
> > Clojure 1.2.0
> > user=> (load-file "src/test/core.clj")
> > WARNING: partition-by already refers to: #'clojure.core/partition-by in
> > namespace: test.core, being replaced by:
> > #'clojure.contrib.seq-utils/partition-by
> > WARNING: frequencies already refers to: #'clojure.core/frequencies in
> > namespace: test.core, being replaced by:
> > #'clojure.contrib.seq-utils/frequencies
> > WARNING: shuffle already refers to: #'clojure.core/shuffle in namespace:
> > test.core, being replaced by: #'clojure.contrib.seq-utils/shuffle
> > WARNING: reductions already refers to: #'clojure.core/reductions in
> > namespace: test.core, being replaced by:
> > #'clojure.contrib.seq-utils/reductions
> > WARNING: partition-all already refers to: #'clojure.core/partition-all in
> > namespace: test.core, being replaced by:
> > #'clojure.contrib.seq-utils/partition-all
> > WARNING: group-by already refers to: #'clojure.core/group-by in
> namespace:
> > test.core, being replaced by: #'clojure.contrib.seq-utils/group-by
> > WARNING: flatten already refers to: #'clojure.core/flatten in namespace:
> > test.core, being replaced by: #'clojure.contrib.seq-utils/flatten
> > nil
> > If I try to reload it then I see an error message:
> > user=> (load-file "src/test/core.clj")
> > java.lang.IllegalStateException: partition-by already refers to:
> > #'clojure.contrib.seq-utils/partition-by in namespace: test.core
> > (core.clj:1)
> > user=>
> > This error message is seen even if I edit the source file and remove the
> > (:use ...) clause and then try to load the file again.
> > Anyone have any idea what is going on? I didn't see this behaviour in
> > Clojure 1.1 and it would be nice if I could find a way to reload files
> that
> > I'm working on.
> > Cheers,
> > Chris
> >
> > --
> > 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
>
> --
> 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

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send em

Re: Problem reloading source file with imports

2010-08-30 Thread Robert McIntyre
Yeah, they changed that from clojure 1.1 and it's really annoying ---
as far as I know, your only options right now are to either select
exactly which functions
from seq-utils you want using the :only keyword, or if you really want
to use the seq-utils version
you can use refer-clojure and the :exclude keyword. Or, you can use
the :as keyword in the :use form
to qualify the import so that you don't actually replace anything.

If you accidently get this warning and don't want to restart the repl
you can do
(ns-unmap 'your-namespace 'offending-function), fix the naked import,
and reload.

--Robert McIntyre




On Mon, Aug 30, 2010 at 5:54 AM, Chris Jenkins  wrote:
> Since I switched to Clojure 1.2, I see an error message whenever I try to
> reload a source file that imports anything. The error message is of the form
> " already refers to xxx", as though it is complaining that it can't
> import the same thing twice.
> For example, I have a minimal source file that looks like this:
> (ns test.core
>   (:use clojure.contrib.seq-utils))
> I can load it (once!) into the Clojure REPL successfully:
> $ java -cp lib/clojure-contrib-1.2.0.jar:lib/clojure-1.2.0.jar clojure.main
> Clojure 1.2.0
> user=> (load-file "src/test/core.clj")
> WARNING: partition-by already refers to: #'clojure.core/partition-by in
> namespace: test.core, being replaced by:
> #'clojure.contrib.seq-utils/partition-by
> WARNING: frequencies already refers to: #'clojure.core/frequencies in
> namespace: test.core, being replaced by:
> #'clojure.contrib.seq-utils/frequencies
> WARNING: shuffle already refers to: #'clojure.core/shuffle in namespace:
> test.core, being replaced by: #'clojure.contrib.seq-utils/shuffle
> WARNING: reductions already refers to: #'clojure.core/reductions in
> namespace: test.core, being replaced by:
> #'clojure.contrib.seq-utils/reductions
> WARNING: partition-all already refers to: #'clojure.core/partition-all in
> namespace: test.core, being replaced by:
> #'clojure.contrib.seq-utils/partition-all
> WARNING: group-by already refers to: #'clojure.core/group-by in namespace:
> test.core, being replaced by: #'clojure.contrib.seq-utils/group-by
> WARNING: flatten already refers to: #'clojure.core/flatten in namespace:
> test.core, being replaced by: #'clojure.contrib.seq-utils/flatten
> nil
> If I try to reload it then I see an error message:
> user=> (load-file "src/test/core.clj")
> java.lang.IllegalStateException: partition-by already refers to:
> #'clojure.contrib.seq-utils/partition-by in namespace: test.core
> (core.clj:1)
> user=>
> This error message is seen even if I edit the source file and remove the
> (:use ...) clause and then try to load the file again.
> Anyone have any idea what is going on? I didn't see this behaviour in
> Clojure 1.1 and it would be nice if I could find a way to reload files that
> I'm working on.
> Cheers,
> Chris
>
> --
> 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

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


Problem reloading source file with imports

2010-08-30 Thread Chris Jenkins
Since I switched to Clojure 1.2, I see an error message whenever I try to
reload a source file that imports anything. The error message is of the form
" already refers to xxx", as though it is complaining that it can't
import the same thing twice.

For example, I have a minimal source file that looks like this:

(ns test.core
  (:use clojure.contrib.seq-utils))

I can load it (once!) into the Clojure REPL successfully:

$ java -cp lib/clojure-contrib-1.2.0.jar:lib/clojure-1.2.0.jar clojure.main
Clojure 1.2.0
user=> (load-file "src/test/core.clj")
WARNING: partition-by already refers to: #'clojure.core/partition-by in
namespace: test.core, being replaced by:
#'clojure.contrib.seq-utils/partition-by
WARNING: frequencies already refers to: #'clojure.core/frequencies in
namespace: test.core, being replaced by:
#'clojure.contrib.seq-utils/frequencies
WARNING: shuffle already refers to: #'clojure.core/shuffle in namespace:
test.core, being replaced by: #'clojure.contrib.seq-utils/shuffle
WARNING: reductions already refers to: #'clojure.core/reductions in
namespace: test.core, being replaced by:
#'clojure.contrib.seq-utils/reductions
WARNING: partition-all already refers to: #'clojure.core/partition-all in
namespace: test.core, being replaced by:
#'clojure.contrib.seq-utils/partition-all
WARNING: group-by already refers to: #'clojure.core/group-by in namespace:
test.core, being replaced by: #'clojure.contrib.seq-utils/group-by
WARNING: flatten already refers to: #'clojure.core/flatten in namespace:
test.core, being replaced by: #'clojure.contrib.seq-utils/flatten
nil

If I try to reload it then I see an error message:

user=> (load-file "src/test/core.clj")
java.lang.IllegalStateException: partition-by already refers to:
#'clojure.contrib.seq-utils/partition-by in namespace: test.core
(core.clj:1)
user=>

This error message is seen even if I edit the source file and remove the
(:use ...) clause and then try to load the file again.

Anyone have any idea what is going on? I didn't see this behaviour in
Clojure 1.1 and it would be nice if I could find a way to reload files that
I'm working on.

Cheers,

Chris

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