4

Clojure と ClojureScript の両方にコンパイルされる cljc ファイルにいくつかのコードがあります。

protocol.cljc 内

(defprotocol Transformable ".." 
    (scale [this scalar] "" ) ...)

pattern.cljc 内

(defrecord APattern [paths]
    Transformable
      (scale [this s] (...)) ...)

another.cljc で

(defn f [pattern] (.scale pattern (/ 1 2)) )

そしてcore.cljsで

(another/f pattern)

ただし、ブラウザ コンソールでエラーが発生します。

TypeError: pattern.scale is not a function

(js-keys を使用して) core.cljs のパターン オブジェクトのフィールドを確認すると、オブジェクトに何かがあることがわかります。

"patterning$protocols$Transformable$scale$arity$2"

私の機能のように見えます。ClojureScriptでアクセスするのに何か間違っているのでしょうか? します。表記が効かない?他に何かする必要がありますか?

4

1 に答える 1