Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

defmacro not defined in ClojureScript?

I'm trying to use defmacro in ClojureScript, but I'm getting a console error:

TypeError: 'undefined' is not an object (evaluating 'crd.core.defmacro.call')

Here's the test code that's generating the error:

(ns crd.core)

(defmacro t [] `())

And the generated JavaScript code:

goog.provide('crd.core');
goog.require('cljs.core');
crd.core.defmacro.call(null,crd.core.t,cljs.core.Vector.fromArray([]),null);

Any pointers on what I'm doing wrong?

like image 313
exupero Avatar asked Jan 18 '23 02:01

exupero


1 Answers

My failure: I didn't read Differences from Clojure. ClojureScript does support macros, but only in .clj files that are imported with require-macros.

like image 154
exupero Avatar answered Jan 21 '23 06:01

exupero