Project

General

Profile

Support #1287

Better err mesg for easy typo in ring definition

Added by John Abbott almost 5 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
enhancing/improving
Target version:
Start date:
23 May 2019
Due date:
% Done:

100%

Estimated time:
Spent time:

Description

Consider this excerpt:

>>> use P := QQ[x];
--> ERROR: I was expecting a semicolon but I've found ":=" 
--> use P := QQ[x];
-->       ^^

The message should really say "expecting semicolon or ::=".
Or we could even allow := in this context, but that might be confusing?

History

#1 Updated by John Abbott almost 5 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 10

The relevant source code is in Parser.C around line 360 in the function parseUseStatement.

I think it may be reasonable to accept a normal assignment operator := but issue a warning.

No doubt the error message was produced by the call to this->expectingSemicolon; somehow we should supply a better message to be printed (e.g. via an optional string arg?)

#2 Updated by John Abbott over 4 years ago

  • Target version changed from CoCoA-5.3.0 to CoCoA-5.4.0

#3 Updated by John Abbott about 3 years ago

  • Assignee set to John Abbott
  • % Done changed from 10 to 30

I have just modified the parser to print out a warning:

/**/ use P := QQ[x];
--> WARNING: Interpreting := as ::=
--> use P := QQ[x];
-->       ^^
/**/ P;
RingWithID(3, "QQ[x]")

Is this reasonable behaviour? Should I check in?

#4 Updated by John Abbott about 3 years ago

  • Status changed from In Progress to Feedback
  • % Done changed from 30 to 90

Anna approved this change during discussions. The warning has been reworded:

/**/ use P := QQ[x];
--> WARNING: Write ::= instead of := to avoid this warning
--> use P := QQ[x];
-->       ^^

There was also a suggestion simply to allow := without any warning. JAA thinks this could be confusing; Anna thought it would be easier for new users.
We decided to accept the current impl, and possibly open a new issue in future if the warning proves to be irritating.

#5 Updated by Anna Maria Bigatti over 2 years ago

  • Status changed from Feedback to Closed
  • % Done changed from 90 to 100

Also available in: Atom PDF