I am having trouble using ClojureScript to call JavaScript functions that exploit prototype injection. If I'm reading `defmethod :emit invoke` correctly,
https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/compiler.clj#L513 ClojureScript always seems to compile f(x) JavaScript calls as f.call(null, x) which trip up any functions that rely on `this` to have certain properties. I have two questions: 1) why are function calls compiled to the `f.call(null, ...)` form rather than just `f(...)`? Is it to support the Closure Compiler? 2) What is the appropriate way to use JavaScript functions that rely on `this`? Is there some way to emit `f.call(f, ...)`, or do I need to use `(js* "f(...)")`? For reference, here is a minimal JavaScript example of the JavaScript prototype injection pattern: var p_injection = function(){}; p_injection.one = function(){ return 1; }; var MyClass = function(){}; var x = new MyClass(); x.two = function(){ return this.one() + 1; }; x.__proto__ = p_injection; x.two(); // 2 x.two.call(null); // error, object has no method "one()" -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en