[ASYNC-79] (ClojureScript) go macro not correctly transforming (case) within a macro Created: 23/Jul/14 Updated: 23/Jul/14
(case-let) is a macro to handle messages of the form [:message-tag, arg1, arg2, ...] with the arguments bound to local variables. It fails to work correctly when used within a go block. Note that a simple macro with a case, e.g. (defmacro my-case [expr & cases] `(case ~expr ~@cases)) does work.
(Sample project attached)
ClojureScript test code:
Browser console output:
|Comment by Tom Locke [ 23/Jul/14 3:46 AM ]|
More discussion here: https://groups.google.com/forum/#!topic/clojurescript/w21nNWkKR-c
|Comment by Tom Locke [ 23/Jul/14 1:58 PM ]|
I've discovered an easy workaround for this problem. During macro-expansion core names like case become fully qualified, i.e. cljs.core/case, and it seems that the go macro then fails to recognise the case as such. Replacing case with ~'case in the definition of let-case fixes the problem.
I would hope this leads to an easy fix for someone who knows the core.async codebase.
The working macro is: