On Sat, Feb 18, 2012 at 1:29 PM, ClusterCat <[email protected]> wrote:
> (ns test (:import (java.io File)))

This says import the File class from the package java.io

> (ns test (:import (java.io.File)))

Try:

(ns test (:import java.io.File))

>  (let [filename (first *command-line-args*)]
>    (println filename)
>    (let [file (File. filename)])))
>
>
> I get an
> "Reflection warning, X:\workspace\ClojureTest\bin\test.clj:9 - call to
> java.io.File ctor can't be resolved."
> which I also don't understand.

Clojure relies on type hints to avoid reflection - introspecting Java
class types to figure out calls. If you add ^String in let binding for
filename, it should remove the warning:

(let [^String filename (first *command-line-args*)] ...

HTH?
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
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

Reply via email to