Re: Basic question: what's the difference between require as and use as?

2015-06-23 Thread Ritchie Cai
I always have (:use clojure.core) in a new namespace. Is that necessary or is clojure.core is automatically interned when a new namespace is created? On Jun 23, 2015, at 6:37 AM, Gary Verhaegen gary.verhae...@gmail.com wrote: Unless you have a very compelling reason, just don't use use. It's

Re: Basic question: what's the difference between require as and use as?

2015-06-23 Thread Ritchie Cai
I see. Thanks. On Jun 23, 2015, at 11:02 AM, Fluid Dynamics a2093...@trbvm.com wrote: On Tuesday, June 23, 2015 at 10:40:25 AM UTC-4, Ritchie Cai wrote: I always have (:use clojure.core) in a new namespace. Is that necessary or is clojure.core is automatically interned when a new namespace

Re: Basic question: what's the difference between require as and use as?

2015-06-23 Thread Fluid Dynamics
On Tuesday, June 23, 2015 at 10:40:25 AM UTC-4, Ritchie Cai wrote: I always have (:use clojure.core) in a new namespace. Is that necessary or is clojure.core is automatically interned when a new namespace is created? It depends. Yes if you use (ns foo) ..., but not apparently if you use

Re: Basic question: what's the difference between require as and use as?

2015-06-23 Thread Gary Verhaegen
Unless you have a very compelling reason, just don't use use. It's mostly a historical accident that's kept there for backwards compatibility. And try to avoid :refer :all if possible. There are legitimate use-cases for it, but outside the REPL they are pretty rare. On Tuesday, 23 June 2015,

Basic question: what's the difference between require as and use as?

2015-06-22 Thread Ritchie Cai
For example: (:require [clojure.java.io :as io]) vs (:use [clojure.java.io :as io]) In both cases, we can end up using it with (io/function name ... ). Is there a difference at all? Thanks Ritchie -- You received this message because you are subscribed to the Google Groups Clojure group. To

Re: Basic question: what's the difference between require as and use as?

2015-06-22 Thread Sean Corfield
On Jun 22, 2015, at 1:50 PM, Ritchie Cai ritchie...@gmail.com wrote: For example: (:require [clojure.java.io :as io]) vs (:use [clojure.java.io :as io]) In both cases, we can end up using it with (io/function name ... ). Is there a difference at all? Yes, (:use [clojure.java.io :as io])

Re: Basic question: what's the difference between require as and use as?

2015-06-22 Thread Ritchie Cai
Ok, so require without :refer will default to :refer :all? On Jun 22, 2015, at 4:32 PM, Sean Corfield s...@corfield.org wrote: On Jun 22, 2015, at 2:22 PM, Ritchie Cai ritchie...@gmail.com wrote: You mean (:use [clojure.java.io]) is equivalent to (:require [clojure.java.io :as io :refer

Re: Basic question: what's the difference between require as and use as?

2015-06-22 Thread Ritchie Cai
You mean (:use [clojure.java.io]) is equivalent to (:require [clojure.java.io :as io :refer :all])? Ritchie On Jun 22, 2015, at 4:15 PM, Sean Corfield s...@corfield.org wrote: On Jun 22, 2015, at 1:50 PM, Ritchie Cai ritchie...@gmail.com wrote: For example: (:require [clojure.java.io :as

Re: Basic question: what's the difference between require as and use as?

2015-06-22 Thread Sean Corfield
On Jun 22, 2015, at 2:39 PM, Ritchie Cai ritchie...@gmail.com wrote: Ok, so require without :refer will default to :refer :all? No. (:use [clojure.java.io]) is equivalent to (:require [clojure.java.io :refer :all]) There’s no :as here. :use is like :require :refer :all. (:use

Re: Basic question: what's the difference between require as and use as?

2015-06-22 Thread Ritchie Cai
Ah, I see. I thought “use :as” will not intern all the symbols into current namespace, apparently that’s not the case. Thanks for clearing this up. Ritchie On Jun 22, 2015, at 4:52 PM, Sean Corfield s...@corfield.org wrote: On Jun 22, 2015, at 2:39 PM, Ritchie Cai ritchie...@gmail.com

Re: Basic question: what's the difference between require as and use as?

2015-06-22 Thread Sean Corfield
On Jun 22, 2015, at 2:22 PM, Ritchie Cai ritchie...@gmail.com wrote: You mean (:use [clojure.java.io]) is equivalent to (:require [clojure.java.io :as io :refer :all])? Not quite, (:use [clojure.java.io]) is equivalent to (:require [clojure.java.io :refer :all]) Sean Corfield -- (904)