rhombus-prototype
rhombus-prototype copied to clipboard
Quasicomment?
Not sure if it's a good idea, but sometimes I want to comment (a (b) c)
out, but want to leave (b)
uncommented. Currently, I would comment the whole thing (with #;
) and then make another copy of (b)
. With quasicomment, inspired by quasiquote, I would be able to write:
#;(a #+(b) c)
or something like this.
(also not sure if this still makes sense in non S-exp land).
Have you ever used this before in another language? I would be worried that I'd forget to uncomment, or forget that I did not comment out everything. Even now I find myself forgetting to uncomment some parts after commenting them out for debugging.
It definitely shouldn't be the default method of commenting. There are situations where it would be useful, so as a separate form of comment it may be worth it.
Add an use case for this kind of commenting:
For example:
(define testo
(λ (x)
(onceo
(conde
((== 'tea x) succeed)
((== 'cup x) succeed)
(else fail)))))
I'd like just to comment the onceo
.
The effect is a bit like:
(define testo
(λ (x)
;; (onceo
(conde
((== 'tea x) succeed)
((== 'cup x) succeed)
(else fail))
;; )
))
"paredit" can raise a sexp though, not comment.
For such cases usually I just do:
(define testo
(λ (x)
(values ;onceo
(conde
((== 'tea x) succeed)
((== 'cup x) succeed)
(else fail)))))
#;
would in principle be better than ;
but it breaks the indentation in DrRacket at least.
@Metaxal It makes the code less readable imo.
The original purpose was just to comment, now a new construct values
has been introduced.
values
isn't a new construct, it defines a multiple value return (which in this case is a single value) and in this case acts as a no-op so that your indentation doesn't change. This approach would fail if onceo
took more than one argument.