by stevelosh · 14y ago · 0 comments
sjl at grendel in ~/s/caves
><((°> lein2 repl
caves.core=> (use 'caves.world)
nil
caves.core=> (new World [:foo])
CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: World, compiling:(NO_SOURCE_PATH:1)
caves.core=> (import '[caves.world World])
caves.world.World
caves.core=> (new World [:foo])
#caves.world.World{:tiles [:foo]}
caves.core=> Bye for now!
sjl at grendel in ~/s/caves
><((°> lein2 repl
caves.core=> (use 'caves.world)
nil
caves.core=> (World. [:foo])
CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: World, compiling:(NO_SOURCE_PATH:1)
caves.core=>
Is there another way to create record instances that doesn't involve that warty (import) call that I'm not aware of? (->World [:foo])
(->World {:tiles [:foo]})
More details here:http://dev.clojure.org/display/design/defrecord+improvements
It's good to know that progress toward patching all the places Java tends to leak through into Clojure is happening.
I can't say I'm a fan of the punctuation-laden syntax, but I'll pick my battles and not complain about it.
I'll switch over to this new form tonight and mention it in one of the later posts. Thanks!