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  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 is created?
> 
> "It depends." Yes if you use (ns foo) ..., but not apparently if you use 
> (in-ns 'foo) which might be done in certain metaprogramming situations, or 
> during repl experimentation. 
>  
> 
> -- 
> 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 a topic in the Google 
> Groups "Clojure" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/clojure/ned76MpB-W0/unsubscribe 
> .
> To unsubscribe from this group and all its topics, send an email to 
> clojure+unsubscr...@googlegroups.com 
> .
> For more options, visit https://groups.google.com/d/optout 
> .

-- 
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: 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 
(in-ns 'foo) which might be done in certain metaprogramming situations, or 
during repl experimentation. 
 

-- 
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: 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  wrote:
> 
> 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, Ritchie Cai  > wrote:
> 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  > > wrote:
> >
> > On Jun 22, 2015, at 2:39 PM, Ritchie Cai  > > 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 [clojure.java.io  :as io]) is equivalent 
> >>> to (:require [clojure.java.io  :as io :refer 
> >>> :all])
> >
> > There’s an :as in both here. :use :as is like :require :as :refer :all
> >
> > Both :use and :refer :all (in :require) are discouraged because they 
> > pollute your namespace with every symbol from the used/required namespace.
> >
> > There’s not much point in specifying an alias (with :as) for :use or 
> > :require :refer :all since those bring in every symbol directly anyway.
> >
> > Sean Corfield -- (904) 302-SEAN
> > An Architect's View -- http://corfield.org/ 
> >
> > "Perfection is the enemy of the good."
> > -- Gustave Flaubert, French realist novelist (1821-1880)
> >
> >
> >
> > --
> > 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 a topic in the 
> > Google Groups "Clojure" group.
> > To unsubscribe from this topic, visit 
> > https://groups.google.com/d/topic/clojure/ned76MpB-W0/unsubscribe 
> > .
> > To unsubscribe from this group and all its topics, send an email to 
> > clojure+unsubscr...@googlegroups.com .
> > For more options, visit https://groups.google.com/d/optout 
> > .
> 
> --
> 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 
> .
> 
> -- 
> 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 a topic in the Google 
> Groups "Clojure" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/clojure/ned76MpB-W0/unsubscribe 
> .
> To unsubscribe from this group and all its topics, send an email to 
> clojure+unsubscr...@googlegroups.com 
> .
> For more options, visit https://groups.google.com/d/optout 
> .

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.co

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, Ritchie Cai  wrote:

> 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  > wrote:
> >
> > On Jun 22, 2015, at 2:39 PM, Ritchie Cai  > 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 [clojure.java.io :as io]) is equivalent to (:require [
> clojure.java.io :as io :refer :all])
> >
> > There’s an :as in both here. :use :as is like :require :as :refer :all
> >
> > Both :use and :refer :all (in :require) are discouraged because they
> pollute your namespace with every symbol from the used/required namespace.
> >
> > There’s not much point in specifying an alias (with :as) for :use or
> :require :refer :all since those bring in every symbol directly anyway.
> >
> > Sean Corfield -- (904) 302-SEAN
> > An Architect's View -- http://corfield.org/
> >
> > "Perfection is the enemy of the good."
> > -- Gustave Flaubert, French realist novelist (1821-1880)
> >
> >
> >
> > --
> > 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 a topic in the
> Google Groups "Clojure" group.
> > To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/clojure/ned76MpB-W0/unsubscribe.
> > To unsubscribe from this group and all its topics, send an email to
> clojure+unsubscr...@googlegroups.com .
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> 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.
>

-- 
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: 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  wrote:
> 
> On Jun 22, 2015, at 2:39 PM, Ritchie Cai  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 [clojure.java.io :as io]) is equivalent to (:require [clojure.java.io 
>>> :as io :refer :all]) 
> 
> There’s an :as in both here. :use :as is like :require :as :refer :all
> 
> Both :use and :refer :all (in :require) are discouraged because they pollute 
> your namespace with every symbol from the used/required namespace.
> 
> There’s not much point in specifying an alias (with :as) for :use or :require 
> :refer :all since those bring in every symbol directly anyway.
> 
> Sean Corfield -- (904) 302-SEAN
> An Architect's View -- http://corfield.org/
> 
> "Perfection is the enemy of the good."
> -- Gustave Flaubert, French realist novelist (1821-1880)
> 
> 
> 
> -- 
> 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 a topic in the Google 
> Groups "Clojure" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/clojure/ned76MpB-W0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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: 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  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 [clojure.java.io :as io]) is equivalent to (:require [clojure.java.io 
>> :as io :refer :all]) 

There’s an :as in both here. :use :as is like :require :as :refer :all

Both :use and :refer :all (in :require) are discouraged because they pollute 
your namespace with every symbol from the used/required namespace.

There’s not much point in specifying an alias (with :as) for :use or :require 
:refer :all since those bring in every symbol directly anyway.

Sean Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)



-- 
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: 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  wrote:
> 
> On Jun 22, 2015, at 2:22 PM, Ritchie Cai  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) 302-SEAN
> An Architect's View -- http://corfield.org/
> 
> "Perfection is the enemy of the good."
> -- Gustave Flaubert, French realist novelist (1821-1880)
> 
> 
> 
> -- 
> 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 a topic in the Google 
> Groups "Clojure" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/clojure/ned76MpB-W0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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: 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  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) 302-SEAN
An Architect's View -- http://corfield.org/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)



-- 
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: 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  wrote:
> 
> On Jun 22, 2015, at 1:50 PM, Ritchie Cai  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/ ... )". Is 
>> there a difference at all?
> 
> Yes, (:use [clojure.java.io :as io]) is equivalent to (:require 
> [clojure.java.io :as io :refer :all]) so it refers in all of the symbols from 
> that namespace directly into your namespace (i.e., they can be referenced 
> even without the io/ prefix).
> 
> Sean Corfield -- (904) 302-SEAN
> An Architect's View -- http://corfield.org/
> 
> "Perfection is the enemy of the good."
> -- Gustave Flaubert, French realist novelist (1821-1880)
> 
> 
> 
> -- 
> 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 a topic in the Google 
> Groups "Clojure" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/clojure/ned76MpB-W0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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: 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  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/ ... )". Is 
> there a difference at all?

Yes, (:use [clojure.java.io :as io]) is equivalent to (:require 
[clojure.java.io :as io :refer :all]) so it refers in all of the symbols from 
that namespace directly into your namespace (i.e., they can be referenced even 
without the io/ prefix).

Sean Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)



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


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/ ... )". Is 
there a difference at all?

Thanks
Ritchie


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