VLISP treats any AutoLISP statement beginning with a semicolon as a comment. The last two code examples contained a lot of comments. A comment in an AutoLISP program is something you write for yourself, not for the program. Commenting code is one of the best programming practices you can establish for yourself. Why write comments?
- To explain the code to yourself when you are editing the program nine months in the future, adding all those features your users have been asking you about. Memory fades, and the most apparent sequence of functions can easily turn into an unrecognizable tangle of parentheses.
- To explain the code to others who inherit the responsibility of updating the program. Reading someone else's code is an extremely frustrating experience, especially if the code contains very few comments.
VLISP contains some utilities that help you as you comment your code. Notice some comments in the examples begin with three semicolons (;;;), sometimes two (;;), and sometimes just one (;). Refer to “Applying Visual LISP Comment Styles” in the AutoLISP Developer's Guide to see how VLISP treats the different comments.
To save space, the remaining code examples in this tutorial do not include all the comments in the sample source files. It is assumed you have already established the beneficial habit of extensive commenting and will do so without any prompting.