Branching off of the "Can we please deprecate the :use directive ?" thread, I 
was wondering what the Clojure community thinks of radically simplifying the 
"ns" declaration while keeping all of its power.

Old School:

(ns one.fresh-server
  (:refer-clojure :exclude [ancestors printf])
  (:use core.matrix
        [ring.adapter.jetty :only (run-jetty)]
        [ring.middleware.file :only (wrap-file)]
        [ring.middleware.file-info :only (wrap-file-info)]
        [ring.middleware.stacktrace :only (wrap-stacktrace)]
        [ring.util.response :only (file-response)])
  (:require [one.reload :as reload]
            [one.middleware :as middleware]
            [net.cgrand.enlive-html :as html])
  (:import (org.apache.maven.artifact.resolver ArtifactResolver)
           (java.io File))))

New School:

(ns one.fresh-server
  "optional doc string goes here"
  [clojure.core :refer-except [ancestors printf]]
  [core.matrix :refer :all]
  [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])

I haven't put enough thought into this as I could, but this seems good enough 
already to kick the ball rolling.

If the above syntax can't be made to support the old school syntax as well, 
another thought would be to create a new name for the declaration, calling it 
"include" or something like that instead of "ns".

Thoughts?

- Greg

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

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

Reply via email to