Skip to content

Implicit evaluation of arguments #3

@phoe

Description

@phoe

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions