假设我有:
function A(x) {
this.x = x;
}
A.prototype.b = function(y) {
y = y;
};
这转换为
(deftype A [x]
Object
(b (y)
(set! (.-y js/this) y)))
我的问题是 - 我们如何表示嵌套的原型函数?
例如:
function C(s) {
this.s = s;
}
C.prototype.d = function(t) {
t = t;
return e(2);
function e(u) {
return u * u;
}
};
如果我有猜测 - 我会说:
(deftype C [s]
Object
(d (t)
(set! (.-t js/this) t)
(let [e = (fn [u] (* u u))]
(set! (.-e js/this) e)
(e 2))))
你能帮我解决一下如何在ClojureScript中表示e(u)吗?