Hi,
I thought :require with :refer superseded :use :only.
Or am I mistaken?
Las
I'm pretty sure this is still valid
:)
Jim
On 08/11/12 16:57, David McNeil wrote:
I notice the following item at http://dev.clojure.org/display/design/Library+Coding+Standards
"Be explicit and minimalist about dependencies on other packages. (Prefer the :only option to use and require)."
The page was last edited on Mar 29, 2011 and ns usage has been discussed a fair bit since then... this leads to the question:
Is the item quoted above still the standard for Clojure Libraries?
Thanks.
-David
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@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
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 post to this group, send email to clo...@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
I am pragmatic and quite lazy, I use require with an alias
(ns foo.bar(:use [clojure[pprint :only [pprint pp]][repl :only [doc find-doc apropos]]][clojure.java.javadoc :only [javadoc]][clojure.tools.trace :only [trace deftrace trace-forms trace-ns untrace-ns trace-vars]])(:require [clojure[set :as set][string :as str][xml :as xml]][clojure.java[shell :as sh][io :as io]]))
How does that shrink his boilerplate ?
Why such a long boilerplate ? Do you need the string library everywhere ?
Why not drop :only ?
Since you use emacs, why not create a key binding to an expression that would get
evaluated in the REPL ? or to eval the zxcv macro ?
Luc P.
Denis, Mark, could you speak to what sort of things you're using these
for that make it convenient to have them in every namespace?
On Sun, Nov 11, 2012 at 2:26 PM, Mark EngelbergWell, I have to say I was puzzled by Denis' post because I definitely
<mark.en...@gmail.com> wrote:
> I can relate to Denis' issue. I find it pretty common to have a common set
> of dependencies across every file in a project.
don't have common dependencies across every file. Now hearing you say
the same thing I'm doubly puzzled...
I don't like to have anything imported that I'm not explicitly using
(and I regularly double-check after refactoring to make sure I remove
any redundant imports). Preferences aside, however, I'm genuinely
curious as to the sort of program structure that has the same
dependencies in every namespace. I can see how some of Denis' imports
are useful for the repl - but I tend to just import them as needed or
write them out in full (clojure.pprint/pprint is my most common one) -
but I'm a bit surprised to see set, string, xml, sh and io all being
that common (in every file).
Denis, Mark, could you speak to what sort of things you're using these
for that make it convenient to have them in every namespace?
I tend to have I/O isolated to one or two namespaces, the same goes
for shell operations, and XML operations. Maybe we're working in
different enough fields that our use cases are very different (I
suspect that's true for Mark - not sure what area Denis works in?).
--
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)
On Sun, Nov 11, 2012 at 10:31 PM, Denis Labaye <denis....@gmail.com> wrote:Ah, then your use of boilerplate makes sense.
> Most of my Clojure usage is as a scripting language (where other would use
> Python or Ruby).
> I usually don't plan in advance how my program will be splitted in
> namespaces :
> I start from one namespace that does everything, let it grow, and split it
> if it make sense.
Don't you find the startup time of the JVM to be a disadvantage for
using Clojure vs Python / Ruby?
--
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)