开发者

Scala classes in clojure

It's just a stupid qu开发者_JAVA技巧estion that I had this morning : Can we use Scala classes from clojure ?

Because if the answer is yes, I'll definetly learn Clojure ^^


Scala classes are Java classes and you can use Java classes from Clojure quite conveniently.

Have fun learning Clojure. :-)


Scala classes, yes. Scala singleton objects, with the same year signature as from Java. Scala traits, no. Scala implicits, hah, you jest!

So the experience may range from "ok", if it's just your classes, to very disagreeable, in the case of Scala collections, for instance.


Worth saying that Scala classes which take function parameters, such as:

Option.map(f : A => B)

Are unlikely to be very useable from Clojure, because the Clojure compiler will not turn Clojure lambdas into instances of scala.FunctionN. I'm with Daniel - I think interop will be poor.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜