4 ms·
Comments in Interlisp weren't really magic. Basically the comment function * was taking unevaluated args as a list. An NLAMBDA. It just returned its arg. (*
by lispm 9y ago
Comments in Interlisp weren't really magic.
Basically the comment function * was taking unevaluated args as a list. An NLAMBDA. It just returned its arg.
(* this is a comment in Interlisp)
This means also comments could also only be used where they fit into the Lisp syntax and not changed the control flow.
In Common Lisp:
(defun comment (words) words)
(defmacro § (&rest words)
`(comment '(,@words)))
(let ((a 20))
(cond ((< 0 a 10) (§ Only when A is between 0 and 10.
This is a typical value.)
(* a 0.1))
(t (§ a is not between 0 and 10)
(* a 0.2))))
Now it would need a special pretty printer command, so that
* comment lines would be layouted such that they are aligned fit on a line.
* the position of the comment should stand out from the code.
Interlisp had a pretty printer macro for it.
It might be better to turn that into a reader macro, so that inside the comment one would then not be constrained by s-expression syntax....
Interlisp has also the feature to store/retrieve the comment text on demand from a file. Thus the comment text might not be needed to be present in the image itself.
- nibbula 9y agoI'm quite thankful that we don't have to worry about the syntactic position of comments, and the wise folks of CL, as you may know, made it so that saving comment text can be as easy as: (defparameter *comments* nil) (defun comment-saver (stream char) (declare (ignore char)) (push (list *load-pathname* (stream-file-position stream) (with-output-to-string (str) (loop :with c :while (char/= #\newline (setf c (read-char stream))) :do (write-char c str)))) *comments*) (values)) (set-macro-character #\; #'comment-saver) With apologies for boring the non-Lisp infatuated.
- mikelevins 9y agoI think that after 30 years of lively interaction, my relationship with Lisp can be considered to have gone beyond infatuation. Whether that's a good thing is debatable, of course.