I'm using clojure.core.match and seeing the following error:
Can't let qualified name
My code resembles:
(match [msg-type]
[MsgType/TYPE_1] (do-type-1-thing)
[MsgType/TYPE_2] (do-type-2-thing))
Where MsgType/TYPE_1 comes from a Java class:
public class MsgType {
public static final String TYPE_1 = "1";
public static final String TYPE_2 = "2";
}
What does this error mean, and how can I work around it?
The problem seems related to macro name binding, though I don't understand it deeply as I'm quite new to macros.
Originally I hoped using
caserather thanmatchwould prove a viable workaround:However the above doesn't work.
casematches on the symbolMsgType/TYPE_n, not the evaluation of that symbol.The best I've found so far is to convert the value coming in to a keyword and match that way: