> 
> var x = T
> x.prototype.whatAmI()
> prints: {type: "[object Object]", isEqualToPrototype: true}  <---- because 
> 'this' in whatAmI now points to T.prototype
> 

The thing is that you are not supposed to call methods on the prototype 
directly.

Your code has this in it:

Object.prototype.toString.call(this)

which is something you usually do not do. The first argument to the .call 
function becomes "this" in the context of the function which is "cheating" and 
bypassing prototype inheritance. I consider .call equal to reflection in Java. 
You should be doing this.toString().

I cannot explain prototype inheritance well enough and will probably only cause 
more confusion at this point. [1] does a way better job than I ever could.

Cheers,
/thomas

[1] 
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Inheritance_and_the_prototype_chain

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to