Re: CLJS Macro

69 views
Skip to first unread message

Herwig Hochleitner

unread,
Nov 8, 2012, 12:04:41 PM11/8/12
to clo...@googlegroups.com
2012/11/8 Thomas Heller <th.h...@gmail.com>
I'm trying to write a Macro for CLJS which calls a Javascript Function directly in the generated code (NOT in the macro). But since the javascript function (and namespace) is unknown to Clojure it fails trying to resolve it.

Syntax quote (`) doesn't resolve namespace qualified symbols. Also it's even less concerned with functions or whether they exists. What kind of error do you see?
 
Another problem will be the missing goog.require('goog.something') but thats something I can work arround.

Ack, that's a problem. I think it's advisable to have an accompanying cljs file for every macro file for now.
 
wait-success being the macro, hiding all the CombinedResult wrapping and unwrapping. Trying to coordinate 2 seperate async requests is annoying with callbacks.

Also ack. I've implemented channels for that purpose. Incidentally, the syntax works pretty much like what you've sketched here. 

Thomas Heller

unread,
Nov 8, 2012, 4:23:26 PM11/8/12
to clo...@googlegroups.com
Finished the Macro, probably not the best solution but certainly beats the plain JavaScript Version.

https://gist.github.com/4041597 if anyones interested.

Not yet usable via lein-cljsbuild or any official clojurescript release, since the goog.result stuff is pretty new and not officially released yet. The xhr stuff still lives in goog.labs.net which probably means its gonna be a while.

Cheers,
/thomas


On Thursday, November 8, 2012 8:51:03 PM UTC+1, Thomas Heller wrote:
Doh, just me being stupid again.

I write macros by macroexpand-1'ing it over and over until I get what I want, used macroexpand this time which caused my problem.

Thanks.

Reply all
Reply to author
Forward
0 new messages