Wednesday, 15 August 2012

javascript - Nested prototypes in Clojurescript -



javascript - Nested prototypes in Clojurescript -

suppose have:

function a(x) { this.x = x; } a.prototype.b = function(y) { y = y; };

this translates

(deftype [x] object (b (y) (set! (.-y js/this) y)))

my question - how represent nested prototype functions?

for example:

function c(s) { this.s = s; } c.prototype.d = function(t) { t = t; homecoming e(2); function e(u) { homecoming u * u; } };

if have guess - say:

(deftype c [s] object (d (t) (set! (.-t js/this) t) (let [e = (fn [u] (* u u))] (set! (.-e js/this) e) (e 2))))

can please help me out how represent e(u) in clojurescript?

javascript clojure prototype clojurescript nested-function

No comments:

Post a Comment