I haven't used Xerox Lisp enough to remember whether the Common Lisp side did keep comments in a similar way to InterLisp-D.
I haven't used Xerox Lisp enough to remember whether the Common Lisp side did keep comments in a similar way to InterLisp-D.
On the other hand, nothing in the standard forbids an implementation from keeping comments around in the image. Off the top of my head I don't know of an implementation that does it, but it might be a handy feature to have.
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.
(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.Whether that's a good thing is debatable, of course.