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

Implicit evaluation of arguments #3

Closed
phoe opened this issue Nov 23, 2020 · 1 comment
Closed

Implicit evaluation of arguments #3

phoe opened this issue Nov 23, 2020 · 1 comment

Comments

@phoe
Copy link

phoe commented Nov 23, 2020

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
hipeta added a commit that referenced this issue Nov 26, 2020
…n issue #3

- This fix changes diamond-wands specification (old version's was uncorrect specification for author's misunderstanding).
  Diamond wands arguments are now not evaluated in macroexpand phaze.
- This changes can cut off dependency on code walker so this library become slimer than old.
@hipeta
Copy link
Owner

hipeta commented Nov 26, 2020

Thank you for your helpful report. I think probably have fixed the problem for now.

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

No branches or pull requests

2 participants