On Sat, Nov 21, 2009 at 11:43 PM, Alex Osborne <a...@meshy.org> wrote:

> John Harrop wrote:
> > On Sat, Nov 21, 2009 at 9:03 PM, Alex Osborne <a...@meshy.org
> >
> > (:import package1 class class class) (:import package2 class class)
> >
> >
> > I am. Especially since the latter already works.
> >
> > Alternatively, force (or at least allow!) square brackets, like
> > elsewhere in Clojure when a list is data rather than starting with
> > something operator-ish. Here, :import at least is operator-ish in its
> >  semantics; package1 and package2 are not.
> >
>
> To me the paren syntax makes more sense as there is something special
> about the first thing in the list:
>
> (pkg class class) => [pkg.class pkg.class]
>
> While I normally expect vectors to be just a list of things, no special
> meaning:
>
> [class class] => [class class]
>

An excellent argument in favor of either

(:import pkg class class class)

or

(:import pkg [class class class])

I'd prefer the former. If you don't allow multi-imports in one :import, you
don't need any delimiters; :import comes first, then a package, and then
unqualified class names. If you do, then maybe

(:import pkg1 [class class class]
            pkg2 [class class class])

so it's clear what's what -- each package is followed by a vector of
classes, then perhaps another package.

This is the structure adopted for cond:

(cond test1 expr1
         test2 expr2)

Allow dropping the brackets if only importing one class, e.g.

(:import pkg1 aclass
            pkg2 [bclass cclass dclass])

and it's even closer.

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

Reply via email to