janet-lang / janet

A dynamic language and bytecode vm
https://janet-lang.org
MIT License
3.43k stars 221 forks source link

(comment) does not work as inline comment #1271

Closed iacore closed 12 months ago

iacore commented 12 months ago

(comment x) returns nil. I don't think it should be the case, since it should just be ignored like comment.

The following should work

(def a (comment hi) 1)
sogaiu commented 12 months ago

FWIW, that's how it also works in Clojure.

A similar form in Emacs Lisp called ignore also works that way.

I would prefer that the current behavior not change.

I wouldn't mind an additional form that behaves differently though.

iacore commented 12 months ago

I don't think special form or defmacro can work like I proposed. It has to be in the parser.

I don't know about closure. Scheme has #;(...). It's convenient when writing code, to disable a part of code with that.

iacore commented 12 months ago

Closing for now. Discussion: #1272