-
Notifications
You must be signed in to change notification settings - Fork 137
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
Add -comment macro #403
base: master
Are you sure you want to change the base?
Add -comment macro #403
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
Any chance we could have some tests in dev/examples.el
? Either as a user-visible defexamples
in one of the def-example-group
s, or as a non-user-visible ert-deftest
. I don't have an opinion on which of the two is more appropriate in this case.
Hi @basil-conto I have tried adding a test. Thank you! |
This macro makes development so much quicker and more convenient. I keep defining it in each package and setup I use, and then use it for interactive development. Since I always use dash.el, it would be so great to have it in it. |
@basil-conto do I need to do anything else for you to merge this? It's a very simple addition, really... |
I question the value of this macro. In Emacs, it's trivial to comment or uncomment a Lisp form--two keystrokes, at most, which is less than it would take to wrap it in this macro. And commented forms are clearly, visibly commented, so they won't be conflated with uncommented code--while this macro would leave its body appearing as normal, uncommented code, more likely to lead to mistakes. @licht1stein If you like using this macro in your code, that's great, but I don't think it belongs in this library. Instead you could publish it in a library that you install into your configs so it's always available to you. |
Thanks @alphapapa I will do as you suggest. However, I would like to point out the value of this macro, the same as it's in Clojure — interactive development. You can develop within the comment macro, and then keep the code within it for future reference — easy to evaluate and edit. It has a much different merrit, then just commenting code out, and creates a possibility for a much more dynamic workflow. |
@licht1stein Again, I question the value of that workflow. Keeping old code in non-commented form, inside a macro, amidst code that is actually used, seems like a bad idea to me, because it still appears to be non-commented code. It only acquires the status of being non-executed code when the macro is expanded. If code retains value for future reference, it can be kept in a comment, in a commit message, or in a separate file (e.g. in my projects, I keep a |
The pertinent question is not which workflow is best, as that is clearly subjective. It is clear that The question is whether That said, and FWIW: the most idiomatic analogue of For example, the following two definitions result in equivalent byte-code: (defun foo (x)
(-comment (message ">>> %s" x))
(if x (1+ x) 0))
(defun bar (x)
(quote (message ">>> %s" x))
(if x (1+ x) 0)) BTW, sorry @licht1stein for my slow responses - I'm AFK on and off until November with limited free time, so I can't guarantee how helpful I'll be in maintaining Dash until then. |
Personally I am a big fan of the Clojure-esque end-of-file As for the comment macro, I just have this in my own emacs.d:
Couldn't get much simpler than that. |
The threading macros and other parts of dashade coding in elisp fun for me, thank you for that. I think that actually turning dash into a port of clojure.core to elisp is not a mess, but something that immensely benefits all the developers and both languages. But that's my selfish opinion. 😋 |
That's an interesting idea, but despite the similarities and inspiration, dash.el is its own thing now. It would be a fine idea to write a new library to actually port Clojure to Elisp; maybe it could be called |
@alphapapa I actually started thinking about that. Having functions that would allow convenient work with hash-maps, for example, would allow for more complex programs to be written easier. |
@licht1stein Yes, but first see the libraries |
|
|
@alphapapa these two look great, thank you! |
|
I find the
-comment
macro to be as usefule in Elisp, as the comment macro is in Clojure. I think it deserves to be part of the dash.el.