-
Notifications
You must be signed in to change notification settings - Fork 6
Closed
Description
In Clojure, arrow macros operate purely on syntax and do not evaluate arguments passed to them.
This is not the case with arrow macros, where me and @digikar99 have found a case of a part of being evaluated, which prevents arrow macros from being used with data that is not supposed to be evaluated.
For example, in Clojure, the below is valid code:
(-> foo (defn [x] (+ x 42)))
(println (foo 24))
;; => 66
arrows
do a valid expansion of this example:
CL-USER> (macroexpand-1 '(arrows:-<> foo (defun <> (bar) (1+ bar))))
(DEFUN FOO (BAR) (1+ BAR))
T
arrow-macros
perform an invalid expansion:
CL-USER> (macroexpand-1 '(m:-<> foo (defun m:<> (bar) (1+ bar))))
(LET ((M:<> FOO))
M:<>
(M:-> M:<>
(DEFUN M:<> (BAR) (1+ BAR))))
T
Metadata
Metadata
Assignees
Labels
No labels