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

Ability to expand macros which use &env #77

Closed
darkleaf opened this issue Nov 6, 2019 · 5 comments
Closed

Ability to expand macros which use &env #77

darkleaf opened this issue Nov 6, 2019 · 5 comments

Comments

@darkleaf
Copy link

darkleaf commented Nov 6, 2019

Hi!
Is any plans to use ztellman/riddley for macro expansion and debugging?

Related to

@darkleaf darkleaf changed the title macroexpand-all with &env Using ztellman/riddley Nov 6, 2019
@bbatsov
Copy link
Member

bbatsov commented Dec 24, 2019

Hey there!

There are no plans to use it (I'm not familiar with the library). In general 3rd party libraries can be integrated only at the middleware level, as Orchard is supposed to be self-contained by design.

@darkleaf
Copy link
Author

Cider can't debug and expand macros which uses &env argument. Riddley can expand such macros correctly.

@bbatsov
Copy link
Member

bbatsov commented Dec 31, 2019

Understood. I'll take a closer look at the issue when I can, but everyone's more than welcome to beat me to it. I see riddley is a small library, so we can either emulate its approach in Orchard or leverage it directly in cider-nrepl.

@Cartmanishere
Copy link

I think there are challenges in directly using ridley.walk/macroexpand-all instead of orchard.meta/macroexpand-all.

In the library's macroexpand function, even inline function call are checked for macroexpansion.
E.g

(ridley.walk/macroexpand-all '(+ 1 2)
=> (. clojure.lang.Numbers (add 1 2))

(orchard.meta/macroexpand-all '(+ 1 2)
=> (+ 1 2)

This change in behavior will break some things down the line in debugging.

One other problem is that orchard's macroexpand attaches the original-form in the metadata. Technically there is a way to be figured out to do the same thing using the predicate and handler provided by ridley.walk/macroexpand-all. But again, there is potential for breaking the further debugging code.

Related:
clojure-emacs/cider#1775
clojure-emacs/cider-nrepl#373

@vemv vemv changed the title Using ztellman/riddley Ability to expand macros which use &env Jan 8, 2022
@vemv vemv changed the title Ability to expand macros which use &env Ability to expand macros which use &env Jan 8, 2022
@vemv
Copy link
Member

vemv commented Jan 16, 2022

In face of the caveats that @Cartmanishere mentions, and observing that riddley hasn't been maintained for a while and that clojure-emacs/cider#1775 is closed, we can close this one as well.

Of course, a motivated hacker can pick up the task but it doesn't look like we gain much by tracking it today.

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

4 participants