Some js frameworks require you to implement 'methods' and those methods need to access js this. Currelty this forces you to js*.
the following is handled by CLJS-83
Currently deftype only supports implementing protocol functions. It could be enhanced to support 'method' fns, possibly by using the Object section:
(deftype Foo [a]
(anyArbitraryMethod [a-name-for-this] ...))
Note that the arity of the actual fn would be one less than for protocol 'methods'.
Explore other options before going this way.
Supporting access to 'this' in stand-alone functions may cause gclosure to complain (it only wants to see traditional methods on prototypes), and is a non-objective for now.
The plan is to start with a pair, this-as and extend-object!. used as such:
I am going to split out the (deftype T ... Object ...) capability into its own ticket as it's scope is greater than the accessing of this. It's likely that the new ticket will eliminate the need for extend-object!.
Added note about related ticket. (CLJS-83)
The this-as macro provides a scoped way to access the implicit this.