#790 # (comment to end of line) strangeness

closed
nobody
Lisp Core (471)
3
2012-12-04
2005-09-28
No

In addition to being the not-equals symbol, # can start
a comment. The following is copied verbatim from the
mailing list:
(http://www.math.utexas.edu/pipermail/maxima/2003/003979.html)

------------- begin quoted text (Stavros Macrakis)
-------------
Pound-sign (#) comments are only supposed to work at
the beginning of a line (possibly preceded by
whitespace). Note that pound sign is normally the
Maxima "not equal" operator.

I find this convention inconsistent and confusing, and
it is never used in Maxima source. Is it used in any
user batch files as far as we know? My tendency would
be to deprecate it and eventually eliminate it: /* ...
*/ should be fine in all cases. If we decide we really
do need an end-of-line comment convention, let's find a
better one....

What's more, the processing of "#" (in
gobble-whitespace) is buggy, and # comments only work
on the second or later line of a statement, and only if
the preceding lines contain at least one character. I
don't know how long that has been true. Does it work
in commercial Macsyma?

In 5.9.0, this works:

>>>>>>>>>>>>>>>>
<spc>
# A comment here
5 +
# A comment here
6
# A comment here
;
<<<<<<<<<<<<<<<<

but none of the following do:

>>>>>>>>>>>>>>>>>
# Comment on first line
5+6;

5+6 # Not at beginning of line
;

5+6; # Not at beginning of line

# Previous line empty (needs at least one char in it)
5+6;

<<<<<<<<<<<<<<<<<<
------------------ end quoted text ------------------

Discussion

  • Dieter Kaiser

    Dieter Kaiser - 2011-04-22
    • milestone: --> Includes_proposed_fix
     
  • Dieter Kaiser

    Dieter Kaiser - 2011-04-22

    I would like to suggest to cut out the possibility to start a comment with #.

    Comments with the char # are not documented and not used in Maxima. The function gobble-whitespace can be simplified accordingly.

    (defun gobble-whitespace ()
    (do ((ch (parse-tyipeek) (parse-tyipeek)))
    ((not (member ch '(#\tab #\space #\linefeed #\return #\page #\newline))))
    (parse-tyi)))

    Dieter Kaiser

     
  • Dieter Kaiser

    Dieter Kaiser - 2011-04-23
    • status: open --> closed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks