Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:require-macros trigger an error #154

Closed
mraveloarinjaka opened this issue Mar 27, 2022 · 0 comments · Fixed by #155
Closed

:require-macros trigger an error #154

mraveloarinjaka opened this issue Mar 27, 2022 · 0 comments · Fixed by #155

Comments

@mraveloarinjaka
Copy link
Contributor

nbb: "0.3.1"
node: "v16.3.1"
platform: "Linux 5.10.60.1-microsoft-standard-WSL2"

problem

When consuming clojurescript libraries that define macros there is an error thrown.

----- Error --------------------------------------
Message:  No matching clause: require-macros
No matching clause: require-macros

Since nbb supports first class macros a workaround would be to adapt the library using reader-conditionals

 (ns vvvvalvalval.supdate.api
   (:require [vvvvalvalval.supdate.impl :as impl])
   (:refer-clojure :exclude [compile])
-  #?(:cljs (:require-macros vvvvalvalval.supdate.api)))
+  #?(:org.babashka/nbb (:require [promesa.core :as p]) 
+     :cljs (:require-macros [vvvvalvalval.supdate.api])))

repro

paste and load the snippet below in a cljc file.

(ns ignore-require-macros
  (:require-macros ignore-require-macros))

(defmacro add
  [a b]
  `(+ ~a ~b))

(defn subtract
  [a b]
  (- a b))

{:add (add 2 3)
 :subtract (subtract 3 2)}

expected behavior

The following result is expected.

{:add 5
 :subtract 1}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant