Greg <g...@kinostudios.com> writes:
> New School:
>
> (ns two.namespace
>   [clojure [core :except (ancestors printf)]]
>   [core [matrix math bs]] ; same as (:use (core matrix math bs))
>   [[some-ns]] ; same as (:use some-ns)
>   [ring.adapter.jetty (run-jetty :as jetty)]
>   [ring.middleware.file ("warp-*")] ; refers all functions beginning with 
> "wrap-"
>                                     ; regex not supported because too 
> confusing
>   [ring.middleware.file-info (wrap-file-info)]
>   [ring.middleware.stacktrace (wrap-stacktrace)]
>   [ring.util.response (file-response)]
>   [one reload middleware]
>   [net.cgrand enlive-html :as html]
>   [org.apache.maven.artifact.resolver ArtifactResolver] 
>   [java.io File InputStream])
>
> Four key rules to the new syntax:
>
> 1) vectors can only contain namespaces and the keywords :as and :except
> 2) vectors within vectors will refer everything in the the namespaces 
> specified in them
> 3) lists can only contain functions and the keyword :as to rename functions.


I am dubious about distinguishing between lists and vectors. Currently,
as far as I can tell, the ns is agnostic, and only cares about them
being sequential. This is probably one of the sources of confusion for
beginners -- they see both and don't see why, when in fact on the outer
brackets are necessarily round. 

Also, I am confused as to how you distinguish between 

[core [matrix math bs]] being equivalent to :use while

Is [one reload middleware] also :use? Or :require?

If there was one thing I would deprecate it's that the first element of
the vector is special.

I find the fact that these two:

(ns bob [:require [tawny owl reasoner]])
(ns john [:require [tawny.owl reasoner]])

are totally different, very confusing. Throw in this

(ns john [:require [tawny.owl]])

In the first case "tawny.owl" is a prefix, and in the second it means
"require tawny.owl".

Phil





> 4) namespaces are referred by placing a space after the namespace prefix
>
> Also, an added feature/rule is that globbing-based strings can be used to 
> save on typing (as shown in the example above).
>
> - Greg
>
> --
> Please do not email me anything that you are not comfortable also sharing 
> with the NSA.
>
> On Aug 6, 2013, at 7:55 AM, Curtis Summers <curtis.summ...@gmail.com> wrote:
>
>> I agree that wildcards make it "easy" (in the nearness sense), but from a 
>> long-term maintainability standpoint, I'd prefer to have explicit imports as 
>> is.  When I'm reading your code a year from now and need to look-up the docs 
>> on a class, wildcards make me (and anyone else in the future) have to do 
>> that look-up every time.  It's almost the same argument as to why (:use) is 
>> a bad idea--you're dumping a bunch of symbols into your namespace.  So, 
>> you're trading some upfront ease for some long-term simplicity.
>> 
>> Yes, lots of Java tutorials are of no help in this endeavor :(  (Again, see 
>> the parallel in the Clojure world with so much "getting started/example" 
>> code showing :use instead of :require).
>> 
>> -Curtis
>> 
>> 
>> The argument for wildcards is very simple.  Go to just about any Java 
>> tutorial, for example:
>> http://docs.oracle.com/javase/tutorial/displayCode.html?code=http://docs.oracle.com/javase/tutorial/2d/images/examples/LoadImageApp.java
>> 
>> The sample code starts off with a dozen wildcard imports.  If I want to try 
>> to use these techniques in Clojure, I have absolutely no idea which specific 
>> classes to require.  This creates a tremendous obstacle to consuming Java 
>> libraries.  This has affected me personally on several occasions, preventing 
>> me from successfully figuring out how to use some Java library from Clojure.
>> 
>> Maybe it's not ideal if Clojure has to walk the classpath, but the 
>> alternative is that I have to manually walk the classpath and jars myself 
>> with no idea what I'm looking for.  Surely it's better for this to be 
>> handled through an automated process.
>> 
>> -- 
>> -- 
>> 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/groups/opt_out.
>>  
>>  
>

-- 
Phillip Lord,                           Phone: +44 (0) 191 222 7827
Lecturer in Bioinformatics,             Email: phillip.l...@newcastle.ac.uk
School of Computing Science,            
http://homepages.cs.ncl.ac.uk/phillip.lord
Room 914 Claremont Tower,               skype: russet_apples
Newcastle University,                   twitter: phillord
NE1 7RU                                 

-- 
-- 
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/groups/opt_out.


Reply via email to