Thanks for your quick responses. I guess having clojure behave this
way is obvious and consistent (with having to explicitly fill in the
vararg).

Sometimes I forget that Java does things that are syntactically 'nice'
but otherwise unexpected which often isn't ideal to emulate in other
languages... but I have mixed thoughts if this is actually the best
stance in this case.

I guess if I felt strongly enough I could always fork and submit a
patch...

Again thanks for clarifying and the suggested solution.
B.

On Jan 10, 10:45 pm, Tassilo Horn <tass...@member.fsf.org> wrote:
> bjconlan <bcon...@gmail.com> writes:
>
> Hi,
>
> > Just writing that feels confusing (let alone the quasi techno babble)
> > so here is the example:
>
> >http://docs.oracle.com/javase/7/docs/api/java/nio/file/Paths.html
>
> > there are 2 static methods in the class "Path".
>
> > Path.get(String first, String... more): usage examples:
> >   Path.get("foo");
> >   Path.get("foo", new String[] {"bar", "baz"});
>
> Why not just Path.get("foo", "bar", "baz");
>
> > and
>
> > Path.get(URI uri)
>
> > Now when trying to use the first function in clojure such as
> > (Path/get "foo")
> > the Path.get(URI) method will be resolved.
>
> > Now my question(s):
> > Is there a clean way to call this function (beside my current work
> > around "(Path/get "foo" (make-array String 0))"). Is this a bug? Is
> > this just me being idealistic in the way I want this to work? Is there
> > an undocumented (or simply unread) way to make type-hinting work for
> > me in this case?
>
> I think, from a clojure perspective, any varargs java method parameter
> is just one ordinary array type parameter, cause that's what it is in
> the byte-code.
>
> If you need that method frequently, a slight wrapper might be
> convenient:
>
> (defn paths-get [s & more]
>   (java.nio.file.Paths/get s (into-array String more)))
>
> Bye,
> Tassilo

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