Replies: 6 comments 34 replies
-
Something like this would have worked until recently: (defmacro ignore [& body]
~;[])
(pp (ignore
this is just a comment.)
:ok)
However, this will throw an error as a top level expression:
|
Beta Was this translation helpful? Give feedback.
-
Just my two cents, but for this purpose, I use good old |
Beta Was this translation helpful? Give feedback.
-
I am not opposed to the idea of block comments that don't evaluate to nil, but I'm not enthusiastic about new syntax. I can imagine using such a feature and can relate, but so far have survived without it. I don't know what costs might be involved in carrying out something like this though -- both within Janet itself but also to adapting existing tooling. AFAIU neither Clojure nor Emacs Lisp have something like this [2] and Scheme does [1], so some Lisp-using folks seem to get by with less. It might be that spelling out (in some detail) the kinds of situations where this idea would be useful could be helpful in getting support. I think sometimes you don't know what you're missing until you see good uses for it, though of course not always (^^; Regarding new syntax, this issue contains a fairly recent discussion. It might be helpful background in understanding various folks' views. Update: added footnote [2] after reducing own confusion. [1] No clue about Common Lisp. [2] Actually, Clojure has |
Beta Was this translation helpful? Give feedback.
-
Possibly this is a good use (if somewhat underwhelming) of our last free special character in the janet syntax, Something like (def \(This is just a fancy comment) a 10) Would discard the comment during reading. Backwards compatible and simple. |
Beta Was this translation helpful? Give feedback.
-
Slightly related: Scheme's myriad reader syntax. In Scheme, We don't have such a convention in Janet yet, so it's difficult to add new syntax. P.S. Common Lisp has |
Beta Was this translation helpful? Give feedback.
-
So to clarify, IIUC -- SRFI 62's
This is different from typical multi-line comment constructs (e.g. Some examples (
A demo of primo-ppcg's comment:
(I'm writing this here because stuff can become obscure and hidden in GH discussions (at lower levels) and I was confused about what was being proposed in the OP (perhaps it was just me (^^; ).) [1] Note that "stacking" can happen. For example, for:
the inner
The net result is:
[2] (Note: this footnote was added hours after the initial series of edits -- sorry, primo-ppcg (^^; ) As implied by others ("underwhelming"), I think using If Using |
Beta Was this translation helpful? Give feedback.
-
Scheme has
#;(...)
that allows a block of code to be commented easily.Please share your idea about how such syntax would be in Janet.
(comment ...)
is not the same, since it returnsnil
.Beta Was this translation helpful? Give feedback.
All reactions