>> (ns one.fresh-server
>>  [core :refer-all [matrix math bs]])
> 
> I like it.

Ideally, the whole thing would be well thought out enough to allow these very 
basic principles to be combined in complicated ways (kinda like the idea behind 
Lisp itself).

Getting rid of ambiguities might help make it more readable and 
"generalizable". For example, it could be specified that vectors can contain 
only namespaces and keywords, and lists can only contain functions.

If that rule is applied, the original example plus the :refer-all keyword would 
look like this:

New School:

(ns two.namespace
  "optional doc string goes here"
  [core :refer-all [matrix math bs]]
  [clojure :refer-all [core :except (ancestors printf)]]
  [ring.adapter.jetty :refer (run-jetty)]
  [ring.middleware.file :refer (wrap-file)]
  [ring.middleware.file-info :refer (wrap-file-info)]
  [ring.middleware.stacktrace :refer (wrap-stacktrace)]
  [ring.util.response :refer (file-response)]
  [one.reload :as-ns]
  [one.middleware :as-ns]
  [net.cgrand.enlive-html :as html]
  [org.apache.maven.artifact.resolver.ArtifactResolver :as-class] 
  [java.io.File :as-class])

Now the functions are emphasized as being functions (because only functions are 
allowed in lists).

Notice that this:

[clojure.core :refer-except (ancestors printf)]

Has now changed to:

[clojure :refer-all [core :except (ancestors printf)]]

What if we want to :refer-all everything that's in the first level of the 
namespace? I see no reason why we couldn't just do this then:

[:refer-all [core]]

Or optionally, in the case where there's just one namespace in the vector:

[:refer-all core]

OK, that's enough from me on this for now, gotta run (lot of work to do!).

- Greg

--
Please do not email me anything that you are not comfortable also sharing with 
the NSA.

On Aug 5, 2013, at 12:59 PM, Lee Spector <lspec...@hampshire.edu> wrote:

> 
> On Aug 5, 2013, at 12:41 PM, Greg wrote:
> 
>>> Can you build in a way to get :require :refer :all to work on a bunch of 
>>> sub-namespaces together on one line, as one currently can with :use, 
>>> without listing each namespace completely on a separate line with a 
>>> separate :refer :all?
>> 
>> Certainly. I'm not saying this is how the exact syntax would go, but the 
>> general idea is to rely on the keywords to specify what (and how) you want 
>> to import stuff:
>> 
>> Instead of:
>> 
>> (ns one.fresh-server
>>  (:use (core matrix math bs))
>> 
>> You could do something like:
>> 
>> (ns one.fresh-server
>>  [core :refer-all [matrix math bs]])
> 
> I like it.
> 
> I can't personally assess the costs and benefits of the overall proposal, but 
> this would address my concern nicely.
> 
> -Lee
> 
> -- 
> -- 
> 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.
> 
> 

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to