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

Should not suggest eta-reduction for macros #253

Open
pkalliok opened this issue May 11, 2023 · 2 comments
Open

Should not suggest eta-reduction for macros #253

pkalliok opened this issue May 11, 2023 · 2 comments

Comments

@pkalliok
Copy link

Kibit 0.1.8 makes this suggestion:

Consider using:
  or
instead of:
  #(or %1 %2)

I don't think there is any context where this suggestion makes sense: or is not a function and cannot be passed as one. And if it's used as a head of an expression (like (#(or %1 %2) (something 1) (something 2))), then it changes the semantics by adding short circuiting.

So I think eta-reduction should not be suggested for macros at all. It's really hard to prove that the macro works the same way in eta expanded and reducted form, and chances are slim that someone wrote it in the harder way by accident.

@NoahTheDuke
Copy link
Collaborator

Kibit is run form-by-form with no tracking of variable state. We can't know which forms are macros (except for the built-in ones). We could potentially exclude those. Would that be acceptable?

@pkalliok
Copy link
Author

definitely! I'm happy for whatever improvement there might be, and most of the exclude-able cases are builtin well known macros anyway, because it's extremely unlikely anyone would need to turn a self made macro into a function by eta expanding it.

Thanks for the insight!

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