我在 ClojureCLR REPL 中遇到了一个编译器异常,用于基本强制:
=> (class 12)
System.Int64
=> (class 12.34)
System.Double
=> (class (new System.Double 12))
CompilerException System.InvalidOperationException: No constructor in type: Double with 1 arguments
at clojure.lang.CljCompiler.Ast.NewExpr.ComputeCtor() in D:\work\clojure-clr-1.4.1-fix\Clojure\Clojure\CljCompiler\Ast\NewExpr.cs:line 73
at clojure.lang.CljCompiler.Ast.NewExpr..ctor(Type type, List`1 args, IPersistentMap spanMap) in D:\work\clojure-clr-1.4.1-fix\Clojure\Clojure\CljCompiler\Ast\NewExpr.cs:line 49
at clojure.lang.CljCompiler.Ast.NewExpr.Parser.Parse(ParserContext pcon, Object frm) in D:\work\clojure-clr-1.4.1-fix\Clojure\Clojure\CljCompiler\Ast\NewExpr.cs:line 117
at clojure.lang.Compiler.AnalyzeSeq(ParserContext pcon, ISeq form, String name) in D:\work\clojure-clr-1.4.1-fix\Clojure\Clojure\CljCompiler\Compiler.cs:line 1560, compiling: (NO_SOURCE_PATH:60)
抱歉,如果这是一个新问题,但行为与 Java 互操作不同!
.NET 的语法是否不同?