Re: `remove-ns' prevents namespace from being reloaded by `require' in clj 1.5.1 and 1.6

2014-09-23 Thread Laurent PETIT
Hello,

Le mardi 23 septembre 2014, Stuart Sierra the.stuart.sie...@gmail.com a
écrit :

 I'm not sure I understand what you mean.

 `remove-ns` does not remove the namespace from the set of loaded
 namespaces kept by `require`.  tools.namespace
 https://github.com/clojure/tools.namespace has a hack
 https://github.com/clojure/tools.namespace/blob/a166936bd757b71348c7c1608569fc0fcb1318bd/src/main/clojure/clojure/tools/namespace/reload.clj#L19
 to work around this.


Can this be fixed for clojure 1.7 (integrate clojure.namespace hack into
'remove-ns)? Or is there a reason I can't see right now in favor of the
current behavior?


 But `require ... :reload` should still work.

 -S


 On Monday, September 22, 2014 10:04:49 AM UTC-4, Daniel König wrote:

 Hi,

 after removing a namespace with the remove-ns form, I am not able to
 require it a second time.
 From what I can tell, I should be able to reload a namespace after
 removing it.
 This behaviour was found in Clojure 1.5.1 and Clojure 1.6.

 Example:

 = (require 'config :reload)
 nil
 = (remove-ns 'config)
 #Namespace config
 = (require 'config :reload)
 nil
 = (remove-ns 'config)
 nil



 Is this intentional or can it be considered broken?

 Best regards,
 Daniel




  --
 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
 javascript:_e(%7B%7D,'cvml','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
 javascript:_e(%7B%7D,'cvml','clojure%2bunsubscr...@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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com
 javascript:_e(%7B%7D,'cvml','clojure%2bunsubscr...@googlegroups.com');.
 For more options, visit https://groups.google.com/d/optout.



-- 
Laurent Petit

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: `remove-ns' prevents namespace from being reloaded by `require' in clj 1.5.1 and 1.6

2014-09-23 Thread Hugo Duncan

laurent.pe...@gmail.com writes:

 Le mardi 23 septembre 2014, Stuart Sierra the.stuart.sie...@gmail.com a
 écrit :

 I'm not sure I understand what you mean.

 `remove-ns` does not remove the namespace from the set of loaded
 namespaces kept by `require`.  tools.namespace
 https://github.com/clojure/tools.namespace has a hack
 https://github.com/clojure/tools.namespace/blob/a166936bd757b71348c7c1608569fc0fcb1318bd/src/main/clojure/clojure/tools/namespace/reload.clj#L19
 to work around this.


 Can this be fixed for clojure 1.7 (integrate clojure.namespace hack into
 'remove-ns)? Or is there a reason I can't see right now in favor of the
 current behavior?

Or a new function added, e.g. `unload-ns`, that combines remove-ns with
updating the ref.

Hugo


signature.asc
Description: PGP signature


Re: `remove-ns' prevents namespace from being reloaded by `require' in clj 1.5.1 and 1.6

2014-09-23 Thread Laurent PETIT
2014-09-23 12:53 GMT+02:00 Hugo Duncan duncan.h...@gmail.com:


 laurent.pe...@gmail.com writes:

  Le mardi 23 septembre 2014, Stuart Sierra the.stuart.sie...@gmail.com
 a
  écrit :
 
  I'm not sure I understand what you mean.
 
  `remove-ns` does not remove the namespace from the set of loaded
  namespaces kept by `require`.  tools.namespace
  https://github.com/clojure/tools.namespace has a hack
  
 https://github.com/clojure/tools.namespace/blob/a166936bd757b71348c7c1608569fc0fcb1318bd/src/main/clojure/clojure/tools/namespace/reload.clj#L19
 
  to work around this.
 
 
  Can this be fixed for clojure 1.7 (integrate clojure.namespace hack into
  'remove-ns)? Or is there a reason I can't see right now in favor of the
  current behavior?

 Or a new function added, e.g. `unload-ns`, that combines remove-ns with
 updating the ref.


Yeah, sure.

Just a question so my understanding levels up: are there usecases where one
would use the current behavior of removing a namespace not also removing it
from *loaded-libs* (and thus preventing it from being required without
:reload) ?




 Hugo




-- 
Laurent Petit

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: `remove-ns' prevents namespace from being reloaded by `require' in clj 1.5.1 and 1.6

2014-09-23 Thread Hugo Duncan

laurent.pe...@gmail.com writes:

 Just a question so my understanding levels up: are there usecases where one
 would use the current behavior of removing a namespace not also removing it
 from *loaded-libs* (and thus preventing it from being required without
 :reload) ?

You can create namespaces without touching `require`, so I think it is
reasonable to expect you can remove them too, without any side effects
that will affect what `require` does.

Hugo


signature.asc
Description: PGP signature


Re: `remove-ns' prevents namespace from being reloaded by `require' in clj 1.5.1 and 1.6

2014-09-23 Thread Laurent PETIT
Le mardi 23 septembre 2014, Hugo Duncan duncan.h...@gmail.com a écrit :


 laurent.pe...@gmail.com javascript:; writes:

  Just a question so my understanding levels up: are there usecases where
 one
  would use the current behavior of removing a namespace not also removing
 it
  from *loaded-libs* (and thus preventing it from being required without
  :reload) ?

 You can create namespaces without touching `require`, so I think it is
 reasonable to expect you can remove them too, without any side effects
 that will affect what `require` does.


*sigh* all this ns / lib dichotomy seems so unnecessarily complex


 Hugo



-- 
Laurent Petit

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: `remove-ns' prevents namespace from being reloaded by `require' in clj 1.5.1 and 1.6

2014-09-22 Thread Laurent PETIT
I think it is broken, and I think I know who the culprit may be (me).

Before 1.5.1 (I guess), it was impossible to do things like that from e.g.
a live repl session:

(ns a)

(ns b (:require a))


because somehow the filesystem for ns a would be checked, no file found.

So a check was added to see whether ns a is already loaded or not, and if
already loaded, not try to reach for the filesystem.

It's weird, because I think I had checked that it wouldn't affect :reload /
:reload-all options, and all unit tests passed at that time.











2014-09-22 16:04 GMT+02:00 Daniel König perpl...@gmail.com:

 Hi,

 after removing a namespace with the remove-ns form, I am not able to
 require it a second time.
 From what I can tell, I should be able to reload a namespace after
 removing it.
 This behaviour was found in Clojure 1.5.1 and Clojure 1.6.

 Example:

 = (require 'config :reload)
 nil
 = (remove-ns 'config)
 #Namespace config
 = (require 'config :reload)
 nil
 = (remove-ns 'config)
 nil



 Is this intentional or can it be considered broken?

 Best regards,
 Daniel

 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.




-- 
Laurent Petit

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: `remove-ns' prevents namespace from being reloaded by `require' in clj 1.5.1 and 1.6

2014-09-22 Thread Stuart Sierra
I'm not sure I understand what you mean.

`remove-ns` does not remove the namespace from the set of loaded 
namespaces kept by `require`.  tools.namespace 
https://github.com/clojure/tools.namespace has a hack 
https://github.com/clojure/tools.namespace/blob/a166936bd757b71348c7c1608569fc0fcb1318bd/src/main/clojure/clojure/tools/namespace/reload.clj#L19
 
to work around this.

But `require ... :reload` should still work.

-S


On Monday, September 22, 2014 10:04:49 AM UTC-4, Daniel König wrote:

 Hi,

 after removing a namespace with the remove-ns form, I am not able to 
 require it a second time.
 From what I can tell, I should be able to reload a namespace after 
 removing it.
 This behaviour was found in Clojure 1.5.1 and Clojure 1.6.

 Example:

 = (require 'config :reload)
 nil
 = (remove-ns 'config)
 #Namespace config
 = (require 'config :reload)
 nil
 = (remove-ns 'config)
 nil



 Is this intentional or can it be considered broken?

 Best regards,
 Daniel


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.