On Monday, September 26, 2016 at 1:24:27 PM UTC-5, mars0i wrote:
> On Monday, September 26, 2016 at 10:13:58 AM UTC-5, Alex Miller wrote:
> > I think this would do what you want:
> > 
> > (ns free.matrix-arithmetic
> >   (:require [clojure.core.matrix :as mx])
> >   (:refer clojure.core.matrix :exclude [e*]))
> 
> Thanks very much.  I didn't understand that the :refer expression is separate 
> from the :require expression in an ns statement.
> 
> This still produces an error in Clojurescript 1.9.229.  It seems to say that 
> :refer is not allowed in ns:
> 
> clojure.lang.ExceptionInfo: Only :refer-clojure, :require, :require-macros, 
> :use, :use-macros, and :import libspecs supported at line 1 ... :tag 
> :cljs/analysis-error

This may be one area where Clojure and ClojureScript differ (I don't follow 
ClojureScript with close enough attention to know). It's also possible that the 
spec is wrong and it should *not* include refer at all. In that case, I run the 
risk that my suggestion above that will be deemed invalid in a later alpha. :)  
You can also do the refer outside the ns as another (perhaps preferred) 
alternative:

(refer 'clojure.core.matrix :exclude '[e*])

> I just noticed some things about ns docstrings:
> 
> The docstrings for ns in Clojure 1.8.0 and 1.9.0-alpha12 don't mention :refer 
> at all.

Yeah, there are a number of places where the docstrings are imprecise. We are 
trying to bring more precision by defining specs here. The specs should help 
achieve greater alignment over time. 

> The docstring in Clojurescript 1.9.299 says that ":require supports :as, 
> :refer, and :rename", which I would read as implying that :refer belongs 
> somewhere inside a :require expression.  However, :exclude is only mentioned 
> in relation to :refer-clojure.

:require has support for some (but not all) refer functionality. :refer-clojure 
is just refer applied specifically to clojure.core so they share the same 
options pretty much.

Does this all make perfect sense? Perhaps not. Unfortunately ns and friends 
were added early in Clojure with perhaps less scrutiny than was prudent given 
their importance and they have evolved in non-optimal ways.

> At this point, :exclude is just something to be curious about for me, since I 
> rarely pull all or almost all of a namespace into another one.  Maybe I'll 
> leave it alone now that I've flagged some questions?  I don't understand 
> enough to submit relevant tickets.

I don't know that anything needs to be followed. If anything, I think a CLJ 
ticket about whether :refer should be supported in the ns spec is my biggest 
question.


-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at https://groups.google.com/group/clojurescript.

Reply via email to