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

macro to set all the def-ed vars to nil #13

Open
AbhinavOmprakash opened this issue Mar 14, 2022 · 5 comments
Open

macro to set all the def-ed vars to nil #13

AbhinavOmprakash opened this issue Mar 14, 2022 · 5 comments

Comments

@AbhinavOmprakash
Copy link
Owner

No description provided.

@dotemacs
Copy link

dotemacs commented Oct 5, 2022

Hey @AbhinavOmprakash

Thanks for this library, it looks fun & useful! 😄

About this issue: How were you thinking that it would work?

Say that you're defn*-ing foo, a foo< would keep the result of the defn* foo.

Would keeping the list of def-ed vars be the way to go? In say foo-def-ed-vars?
So when it came to calling foo<-nil! (made up function name for the sake of this argument), foo-<nil! would use the list of vars that were stored in foo-def-ed-vars var?

Let me know, thanks

@AbhinavOmprakash
Copy link
Owner Author

AbhinavOmprakash commented Oct 6, 2022

hey, @dotemacs I hope you found it helpful.

Initially, I thought I could write a macro that would set the def-ed vars to nil when the function was called, but now that I think of it, your idea is better.

we could keep a list of vars that the defined function has. and call a function like foo-nil! (or a smaller name, the fewer characters the better. easier to remember, and more ergonomic)

Is this something you'd like to work on ?

@dotemacs
Copy link

dotemacs commented Oct 8, 2022 via email

@AbhinavOmprakash
Copy link
Owner Author

Great, thanks!

do you have an approach in mind?

@bpringe
Copy link

bpringe commented Nov 30, 2023

I'd like to suggest using clojure.core/ns-unmap to unmap the vars def'd by snitch, rather than setting them to nil.

My reasoning is that while using snitch, once vars have been def'd, sometimes after making changes, I don't realize that the code where that var was bound is not being hit any more (it was def'd from an earlier evaluation). When the var cannot be resolved, I know that the code was not hit. If the value were set to nil, it wouldn't be clear if the code were not hit, or if the code was hit and the binding was just set to nil by the code itself (not by snitch).

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

3 participants