On Sep 6, 12:23 am, Rich Hickey <[EMAIL PROTECTED]> wrote:
> On Sep 5, 7:06 am, Christopher Taylor <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi,
>
> > this is my first post to the list (though I've been lurking for a
> > while) and I'm not yet actively working with Clojure, so take what I
> > say here with a grain of salt :).
>
> > On Sep 4, 2008, at 3:28 PM, Rich Hickey wrote:
>
> > > On Sep 3, 7:51 pm, Rich Hickey <[EMAIL PROTECTED]> wrote:
> > >> On Sep 3, 5:14 pm, Chouser <[EMAIL PROTECTED]> wrote:
>
> > >>> On Wed, Sep 3, 2008 at 4:36 PM, Stephen C. Gilardi
> > >>> <[EMAIL PROTECTED]> wrote:
>
> > >>>> I saw some discussion of how to fix this on the IRC log but I
> > >>>> can't get on
> > >>>> at the moment.
> > >>>> It looks like the current plan is to change "ns" to remove the
> > >>>> sensitivity
> > >>>> to "the namespace is already defined" and add "(:refer-
> > >>>> clojure ...)" to the
> > >>>> list of supported reference arguments.
>
> > >>> Well, here's a patch for the behavior discussed on IRC. I'm posting
> > >>> it only because it's complete and working, not in any attempt to
> > >>> stifle further discussion. If we settle on any alternate solution,
> > >>> this patch can just be ignored.
>
> > >> I think the only problem is in the case of subsequent use of ns. I
> > >> originally envisioned the 'main' .clj file doing an involved ns and
> > >> subsequent files just doing (ns foo), as well as the use of ns at the
> > >> repl to change namespaces. Now, if you did
>
> > >> (ns foo (:refer-clojure ...) ...)
>
> > >> any later (ns foo) is going to bring in all of clojure. I'd prefer it
> > >> did nothing but change *ns*.
>
> > > After sleeping on it, I think what we have been calling ns should be
> > > called defns instead, and ns should just set *ns*. Thus there should
> > > be only one defns for any particular namespace, and (ns foo) can be
> > > used to set the namespace for a file and/or change the namespace at
> > > the repl.
>
> > > Thoughts?
>
> > So, if I understand this correctly, you'd have a file myns/myns.clj
> > containing (defns myns) along with :require and/or :use clauses for
> > the dependencies of the whole ns. Other files under myns/ would
> > contain just the statement (ns myns).
>
> Right.
>
> > Personally, from a separations-of-concerns standpoint, I'd prefer if
> > every file were responsible for getting access to all the libs it needs.
>
> Being an interactive language, hanging such dependencies on files
> doesn't really work, since bits and pieces of things originally
> defined in files might be fixed/redefined in the repl etc. So the unit
> of reference is the namespace, and all code in the same namespace
> shares the same references and name resolution. This aids
> introspection as well.
>
> > Oh, one (tiny) niggle wrt the name "defns": it looks a bit like the
> > plural form of "defn", so it might be confused with defmulti or
> > something that defines a bunch of functions at once.
>
> I didn't think about the plural angle - anyone else bothered by that?
> The alternative is defnamespace.
>
I like the idea of having a defxxx to define a name space as its
consistent with the rest of the API. Thanks Rich.
Regarding the name, actually, I didn't realize plural angle till
it was pointed out. However, I feel defns is a good enough name
as there isn't a 's' being used for plural by any of the other defs to
my knowledge.
If a need arises to use s for plurals in some future def it may
become confusing.
defnamespace will make be inconsistent with 'ns', 'in-ns' etc.
Putting a - as 'def-ns' will also make it somewhat different from
the other defs IMHO.
Parth
> Rich
--~--~---------~--~----~------------~-------~--~----~
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
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
-~----------~----~----~----~------~----~------~--~---