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