t x <[email protected]> writes:
> (ns foo.bar
> ...
> ...
> ... )
>
> There's basically 10 lines of require that I want as part of nearly _every_
> ns I declare is there a way to define some soft of alias / abbrevraviation
> that is used in namespaces at will?
>
> For example:
>
> ## somewhere, in a magic file:
>
> (def require-standard
> (require [ ... :as ... ])
> (require [ ... :as ... ])
> (require [ ... :as ... ])
> (require [ ... :as ... ]))
>
> (ns foo.bar
> require-standard
> ...)
Not inside the ns macro, no.
(ns foo.bar
[:require [my-standard-requires])
(my-standard-requires/require-standard)
I wrote a toy implementation of a ns form which was extensible in this
way; the idea is that you could define a set of standard import or
require statements in one place and reuse them. It might even be
possible to store imports in a flat file, or to drag imports directly
from a jar file.
https://github.com/phillord/namespace-experiments
There's been lots of discussion on the namespace macro here previously;
to my mind the biggest problem is that it only does what it does, and
nothing else. I routinely use a java library with 150 interfaces, and
the inability to import * is beyond a PITA. If slamhound worked for me,
it might help a bit, but I'd still end up with 150 imported classes in
my ns form which isn't ideal.
Phil
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.