Re: :require farms in Clojure?

2011-07-25 Thread Laurent PETIT
And then goodbye statical analysis ... :-)

2011/7/20 Meikel Brandmeyer m...@kotka.de

 Hi,

 Am Mittwoch, 20. Juli 2011 06:38:27 UTC+2 schrieb Chas Emerick:

 Try:

 (ns myfuns
(:require
(foo.baz [a :as a]
 [b :as b]
 [c :as c]))

 I think he wants more something like this:

 (ns require.farm)

 (def xxx '[[foo.bar [a :as a] [b :as b]] frob.nicate])
 (def yyy '[[foo.bar.c :as c]])

 (ns require.userA
   (:require [require.farm :as requires]))

 (apply require requires/xxx)

 (ns require.userB
   (:require [require.farm :as requires]))

 (apply require requires/xxx)
 (apply require requires/yyy)

 Sincerely
 Meikel



 --
 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 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

Re: :require farms in Clojure?

2011-07-25 Thread Meikel Brandmeyer
Salut Laurent,

Am 25.07.2011 um 18:54 schrieb Laurent PETIT:

 And then goodbye statical analysis ... :-)

I didn't say, that I think it's a good idea to do this. :)

On the other hand I'm not afraid of dynamic analysis either. That's what 
VimClojure does at the moment anyway. Static analysis is – in general – 
confined to special cases known to the analyzer in the presence of macros. In 
practice it's probably doable in a reasonable way.

Cordialement
Meikel

-- 
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


Re: :require farms in Clojure?

2011-07-25 Thread Laurent PETIT
2011/7/25 Meikel Brandmeyer m...@kotka.de

 Salut Laurent,

 Am 25.07.2011 um 18:54 schrieb Laurent PETIT:

  And then goodbye statical analysis ... :-)

 I didn't say, that I think it's a good idea to do this. :)

 On the other hand I'm not afraid of dynamic analysis either. That's what
 VimClojure does at the moment anyway. Static analysis is – in general –
 confined to special cases known to the analyzer in the presence of macros.
 In practice it's probably doable in a reasonable way.


Certainly, ccw/eclipse also does dynamic analysis currently, but I still
have the idea of using static analysis for when no REPL is started, for some
kinds of refactorings, etc. In the end, I find it interesting to be able to
reconcile the static  dynamic views, maybe eventually being able to say to
the user: beware, you're looking at a function definition in a file that's
more recent in the repl, would you like to update, etc.



 Cordialement
 Meikel

 --
 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 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

Re: :require farms in Clojure?

2011-07-24 Thread OGINO Masanori
Hello.

Is (:require ...) better than (:use [... :only (...)])?

Though I've never worked on large Clojure program, sometimes I want
to know something like namespaces using the function foo.
When I move functions to better place, when I add a new arity and
search somewhere suitable with new one, when I mark something
duplicated, ...

With :require, I grep awesome/foo, but there may be a/foo, or, if
there required two a*, aw/foo.
I also can grep :require clause, but :require clause don't tell me
whether foo is used or not.

With :use+:only, I grep a pattern like awesome :only
\(.*\s?foo\s?.*\) (actually I may consider multi-lines).
Of course there may be (:use [another.awesome :only (foo)]), but I
read around the matched line and then I know the answer.

Moreover, when I open other's code, on top of screen :require tells me
something in awesome is used. In order to know what is used, read
below.
In contrast, :use+:only tells me foo in awesome is used.

Any thoughts?

Thanks.

-- 
Name:  OGINO Masanori (荻野 雅紀)
E-mail: masanori.og...@gmail.com

-- 
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


Re: :require farms in Clojure?

2011-07-21 Thread pmbauer
Something akin to the clj-nstools ns+ in clojure proper would sure make life 
easier.

-- 
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

Re: :require farms in Clojure?

2011-07-21 Thread Chas Emerick

On Jul 21, 2011, at 2:31 AM, pmbauer wrote:

 Something akin to the clj-nstools ns+ in clojure proper would sure make life 
 easier.

There's no way that `ns` and its constituent pieces are the last word in 
defining/managing codebase topologies, but they are a bit of a local maxima.  
ns+ looks nice (I'm surprised I haven't come across it so far), but I'm 
surprised that there haven't been more attempts to cut a better ns out there. 
 As shown in the hello world example for ns+, it's trivial to augment or 
entirely replace ns, potentially with very different semantics for e.g. how 
namespaces map to files, what constitutes a lib, etc.

- Chas

-- 
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


Re: :require farms in Clojure?

2011-07-21 Thread Phil Hagelberg
On Thu, Jul 21, 2011 at 5:59 AM, Chas Emerick cemer...@snowtide.com wrote:
 There's no way that `ns` and its constituent pieces are the last word in 
 defining/managing codebase topologies, but they are a bit of a local maxima.  
 ns+ looks nice (I'm surprised I haven't come across it so far), but I'm 
 surprised that there haven't been more attempts to cut a better ns out 
 there.  As shown in the hello world example for ns+, it's trivial to 
 augment or entirely replace ns

Bootstrapping is still a problem as clojure.core/ns is special-cased
to always be available in every namespace ever. In our application at
work we had to resort to defing ns+ in clojure.core inside user.clj in
order for it to be available across the board--pretty cringe-worthy
and doesn't compose. Would be happy to come up with a satisfactory
solution to this. But nstools addresses one of my one remaining major
pain points surrounding Clojure, and I'm looking forward to making
better use of it.

-Phil

-- 
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


Re: :require farms in Clojure?

2011-07-20 Thread Meikel Brandmeyer
Hi,

Am Mittwoch, 20. Juli 2011 06:38:27 UTC+2 schrieb Chas Emerick:

 Try:

 (ns myfuns
(:require
(foo.baz [a :as a]
 [b :as b]
 [c :as c]))

I think he wants more something like this:

(ns require.farm)

(def xxx '[[foo.bar [a :as a] [b :as b]] frob.nicate])
(def yyy '[[foo.bar.c :as c]])

(ns require.userA
  (:require [require.farm :as requires]))

(apply require requires/xxx)

(ns require.userB
  (:require [require.farm :as requires]))

(apply require requires/xxx)
(apply require requires/yyy)

Sincerely
Meikel

 

-- 
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

Re: :require farms in Clojure?

2011-07-20 Thread stu
On Jul 20, 4:19 pm, Meikel Brandmeyer m...@kotka.de wrote:

 I think he wants more something like this:

 (ns require.farm)

 (def xxx '[[foo.bar [a :as a] [b :as b]] frob.nicate])
 (def yyy '[[foo.bar.c :as c]])

 (ns require.userA
   (:require [require.farm :as requires]))

 (apply require requires/xxx)

Yes -- this is the kind of thing I was wondering about (although
Chas' answer is immediately useful too--thanks).

At this point I'm wondering if this is an idiomatic way to work
with Clojure namespaces especially in larger projects with many sub-
components as namespaces?  Maybe one day we could have:

(ns myproject
(:require subproject.* :as :suffix) to require subproject.foo1
subproject.foo2...


Thanks

Stu

-- 
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


Re: :require farms in Clojure?

2011-07-20 Thread Phil Hagelberg
stu stuart.hungerf...@gmail.com writes:

 Yes -- this is the kind of thing I was wondering about (although
 Chas' answer is immediately useful too--thanks).

 At this point I'm wondering if this is an idiomatic way to work
 with Clojure namespaces especially in larger projects with many sub-
 components as namespaces?

I've found this to be an annoyance on large projects too. At work we've
started experimenting with nstools, and it looks very promising:

http://code.google.com/p/clj-nstools/

-Phil

-- 
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


:require farms in Clojure?

2011-07-19 Thread stu
Hi,

In larger Clojure projects with nested namespaces I've found there are
less namespace pollution issues if I avoid (ns... :use...) forms in
preference to (ns... :require...) forms.  This approach sometimes
leads to namespace constructs like:

(ns myfuns
(:require
[foo.baz.a :as a]
[foo.baz.b :as b]
[foo.baz.c :as c...]))

Is there an idiomatic way of coalescing these :require clauses into
a :require farm that can be simply :require'd or is this the wrong
way to manage namespaces in Clojure projects?

Any advice much appreciated,

Stu


-- 
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


Re: :require farms in Clojure?

2011-07-19 Thread Chas Emerick
Stu,

Try:

(ns myfuns
   (:require
   (foo.baz [a :as a]
[b :as b]
[c :as c]))

Cheers,

- Chas

On Jul 20, 2011, at 12:36 AM, stu wrote:

 Hi,
 
 In larger Clojure projects with nested namespaces I've found there are
 less namespace pollution issues if I avoid (ns... :use...) forms in
 preference to (ns... :require...) forms.  This approach sometimes
 leads to namespace constructs like:
 
 (ns myfuns
(:require
[foo.baz.a :as a]
[foo.baz.b :as b]
[foo.baz.c :as c...]))
 
 Is there an idiomatic way of coalescing these :require clauses into
 a :require farm that can be simply :require'd or is this the wrong
 way to manage namespaces in Clojure projects?
 
 Any advice much appreciated,
 
 Stu
 
 
 -- 
 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 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