Error formatting macro: pagetree: java.lang.NullPointerException

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


UPDATE 06052013 - Herwig

Updated the page with input from David Nolen, the description of the prototype is left intact at the end of the page.


The docstring of specify! should make it clear that it's not intended for data objects outside the ClojureScript compilation process and suggest reify for those cases. - David

I'm not exactly happy with that, but I think its manageable, given that clojurescript has still some way to go towards 1.0 - Herwig

Object methods and IFn

As per the refactoring from CLJS-414, generating (unmangled) Object methods is possible with (the private version of) specify.


I don't see why you need to generate .apply instead of cljs$lang$applyTo. We do probably need to generate .call, this is mostly needed for compilation mode other than advanced - David

1. pass a function-like object into jquery 2. jquery calls .apply on it. ... We don't need to generate .apply for every specify IFn; a single .apply method that calls .call or .cljs$lang$applyTo can be assigned to all implementors of IFn. Maybe just Function.prototype.apply - Herwig

Method names

Should the method names be written as symbols instead of keywords? extend has keywords, but it's a function.


Code Block
(specify x IFoo {:m1 existing-fn}) ; existing-fn is lexically bound and could be an arbitrary expression. Remember, I'm referring to existing-fn as method-fn - Herwig


UPDATE 06052013-3 - Herwig

Most major decisions seem to be ironed out. I'll start with the ground work for:

  1. Implementing protocol methods with the arity-methods of a regular fn
  2. Emitting arity-dispatch for .call outside of cljs.compiler/emit for use in specify!

There is still time to chime in on the design; it might take a week or two before I can allocate another time block like this to start pushing patches

Proposal Description of prototype implementation as part of refactoring: CLJS-414