Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#537 Comment syntax confused

closed
nobody
Lisp Core (472)
2
2011-02-10
2004-03-16
Stavros Macrakis
No

The comment syntax /* ... */ is used in many places in
the documentation, but nowhere explicitly described.

The sequence /*/ seems to parse as a comment:

(C23) a/*/+b;
(D23) b + a

I think that is a bug. Two *'s should be required.

Peculiarly, it can be redefined as an infix operator:

(C24) infix("/*/")$
(C29) a/*/+b;
(D29) a /*/ b

It is even possible to redefine "/*" as an infix operator!

(C31) infix("/*");
(D31) "/*"
(C32) a /* b;
(D32) a /* b

This doesn't seem like a good idea....

-s

Discussion

  • Robert Dodier
    Robert Dodier
    2005-04-12

    • labels: --> 460524
     
  • Robert Dodier
    Robert Dodier
    2005-09-28

    Logged In: YES
    user_id=501686

    In fact Maxima lets me do this ...

    matchfix ("/*", "*/");

    /* 1, 2, 3, 4 */;

    :lisp $% => (($/* SIMP) 1 2 3 4)

    I agree that /*/ should not parse as a comment, but I'm
    inclined to allow /*/, /*, and /* ... */ as operators. I
    like Maxima's laissez faire attitude.

     
  • Logged In: YES
    user_id=588346

    > I'm inclined to allow /*/, /*, and /* ... */ as operators.
    I like Maxima's laissez faire attitude.

    The problem with that is that different people's files
    become incompatible.... I suppose I could go along with
    this if there were a warning, e.g.:

    infix("/*")$

    WARNING: You are redefining part of Maxima's built-in
    syntax. This may cause compatibility problems with parts of
    Maxima written in the Maxima language.

     
  • Robert Dodier
    Robert Dodier
    2008-01-07

    • labels: 460524 --> Lisp Core
    • summary: Comment syntax confused, undocumented --> Comment syntax confused
     
  • Robert Dodier
    Robert Dodier
    2008-01-07

    Logged In: YES
    user_id=501686
    Originator: NO

    Comment syntax is now described in ref manual.

    ? comments

    shows the text. Adjusting title of this item accordingly (striking out "undocumented"). Changing category to "Lisp core" since remaining issues are related to parser. (I still don't consider the "/*" redefinition stuff a bug.)

     
  • Dieter Kaiser
    Dieter Kaiser
    2011-02-10

    • status: open --> closed
     
  • Dieter Kaiser
    Dieter Kaiser
    2011-02-10

    Fixed in nparse.lisp revision 1.61.

    Maxima reads in addition the following examples correctly:

    (%i2) a/*/**/*/+b;
    (%o2) b+a

    (%i3) a/*/**/*/+/*/**/*/b;
    (%o3) b+a

    The possibility to redefine "/*" is not considered as a bug.

    Closing this bug report as fixed.
    Dieter Kaiser