Thanks, that's definitely a step in the right direction. It still doesn't work, but there is now a function for arity 1 of invoke in the __proto__ map. There's still a `true` value for cljs.core$ifn$-invoke however, which I'm guessing is related to why it's not working.
I would desperately like to make use of the various macroexpands, but so far I have had absolutely zero luck getting a working clojurescript repl that has access to my application code. Going to spend some more time trying to get that working now. On Sunday, October 19, 2014 3:37:54 AM UTC+1, Dom Kiva-Meyer wrote: > You are resolving the protocol method symbol. > > `(-invoke ...) expands to (your.namespace/-invoke ...) > > > To fix this, you need to quote (not syntax-quote) and unquote the symbol. > `(~'-invoke ...) expands to (-invoke ...) > > > Make liberal use of clojure.core/macroexpand, clojure.core/macroexpand-1, and > clojure.walk/macroexpand-all when writing macros. > > > > > On Sat, Oct 18, 2014 at 4:58 PM, Russell Dunphy <rus...@russelldunphy.com> > wrote: > I'm having real difficulty trying to write a macro that creates a defrecord > which implements certain protocols in Clojurescript. > > > > I've created a minimal example project that shows the problem I'm having at > https://github.com/rsslldnphy/cljs-protocols-in-macros > > > > The example has two records, one created with a plain defrecord that > implements IFn, the other that does exactly the same but in a macro. The > plain defrecord works as expected, but the one created in a macro doesn't - > it's not callable as a function. > > > > Weirdly it returns true for (ifn?) however. Looking at the js console > (screenshot in the repository) the macro created record seems to have a value > of `true` in its __proto__ map for cljs.core.IFn (whereas all the other > entries in the __proto__ map are functions, and the plain defrecord has > function entries for the different arities of `invoke`). > > > > I'm lost at this point (and new to Clojurescript). Am I doing something > wrong? Is this even possible? > > > > Thanks, > > > > Russell > > > > -- > > 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 clojurescrip...@googlegroups.com. > > To post to this group, send email to clojur...@googlegroups.com. > > Visit this group at http://groups.google.com/group/clojurescript. -- 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.