discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: [OpenSCAD] assert documentation.

DM
Doug Moen
Sat, Jan 26, 2019 6:58 PM

Michael Frey wrote:

I do not like the idea of increasing the parser complexity by
duplicating part of it.

Do you actually need to change the parser in order to issue the error messages that nop head has asked for? Why not issue the error messages at run time? These would be actual syntax error messages that terminate the program, instead of warnings.

Michael Frey wrote: > I do not like the idea of increasing the parser complexity by > duplicating part of it. Do you actually need to change the parser in order to issue the error messages that nop head has asked for? Why not issue the error messages at run time? These would be actual syntax error messages that terminate the program, instead of warnings.
MF
Michael Frey
Sat, Jan 26, 2019 7:13 PM

On 26.01.19 19:58, Doug Moen wrote:

Michael Frey wrote:

I do not like the idea of increasing the parser complexity by
duplicating part of it.

Do you actually need to change the parser in order to issue the error messages that nop head has asked for? Why not issue the error messages at run time? These would be actual syntax error messages that terminate the program, instead of warnings.

There is no need to touch the parser and I implemented it in runtime:

https://github.com/openscad/openscad/pull/2720

Having that runtime check might also catch other weird things in the
future, so that  is the right thing in some regards "anyway".

If it would have been easy, implementing it in the parser would cause
the warning to appear earlier.

Warning earlier is usually a good idea, as "at the earliest detectable
point in time" we tend to have access to most relevant information.
Catching issues later can force us to weird error messages, where we can
only explain the symptom, not the cause.

Also the parser is able to mark the line that has the error. (not just
output the line number)

With Kind Regards,

Michael Frey

On 26.01.19 19:58, Doug Moen wrote: > Michael Frey wrote: >> I do not like the idea of increasing the parser complexity by >> duplicating part of it. > Do you actually need to change the parser in order to issue the error messages that nop head has asked for? Why not issue the error messages at run time? These would be actual syntax error messages that terminate the program, instead of warnings. There is no need to touch the parser and I implemented it in runtime: https://github.com/openscad/openscad/pull/2720 Having that runtime check might also catch other weird things in the future, so that  is the right thing in some regards "anyway". If it would have been easy, implementing it in the parser would cause the warning to appear earlier. Warning earlier is usually a good idea, as "at the earliest detectable point in time" we tend to have access to most relevant information. Catching issues later can force us to weird error messages, where we can only explain the symptom, not the cause. Also the parser is able to mark the line that has the error. (not just output the line number) With Kind Regards, Michael Frey