Permalink
Browse files

CLJS-752: implement specify!

redefine specify in terms of specify! which directly modifies instances.
  • Loading branch information...
1 parent 905c644 commit 6e5896cb6cd3549d069473e86e424104c107223d @swannodette swannodette committed Jan 29, 2014
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/clj/cljs/core.clj
View
@@ -607,12 +607,16 @@
~@impls))
(new ~t ~@locals nil))))
-(defmacro specify [expr & impls]
+(defmacro specify! [expr & impls]
(let [x (with-meta (gensym "x") {:extend :instance})]
- `(let [~x (cljs.core/clone ~expr)]
+ `(let [~x ~expr]
(extend-type ~x ~@impls)
~x)))
+(defmacro specify [expr & impls]
+ `(cljs.core/specify! (cljs.core/clone ~expr)
+ ~@impls))
+
(defmacro ^:private js-this []
(core/list 'js* "this"))

0 comments on commit 6e5896c

Please sign in to comment.