discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Infamous warnings

RP
Ronaldo Persiano
Thu, Nov 28, 2019 7:19 PM

A very extensive and appreciated work has been done lately to provide the
OpenSCAD users better and detailed warnings and error messages. However
some of them (at least one) are still bothering the debug of codes with no
clues:

DEPRECATED: Using ranges of the form [begin:end] with begin value greater
than the end value is deprecated.

Is there no way to provide some hint were the problem was found?

A very extensive and appreciated work has been done lately to provide the OpenSCAD users better and detailed warnings and error messages. However some of them (at least one) are still bothering the debug of codes with no clues: DEPRECATED: Using ranges of the form [begin:end] with begin value greater than the end value is deprecated. Is there no way to provide some hint were the problem was found?
MF
Michael Frey
Fri, Nov 29, 2019 7:36 PM

On 28.11.19 20:19, Ronaldo Persiano wrote:

DEPRECATED: Using ranges of the form [begin:end] with begin value
greater than the end value is deprecated.

Is there no way to provide some hint were the problem was found?

Hi,

Good idea to tackle that.

I am working on it:

The issue was/is that at the point where DEPRECATED warning is created I
do not have access to context (the context contains the location).

So, I have to move the warning "up to chain".

I need to dwell a bit about the details.

The bold approach would be to change the DEPRECATED to ERROR.

On the other-hand, currently

for(i=[10:1:1]){
    echo(i);
}

is not even a warning.

In this example with constants it is obviously an error, but if the
range is defined with a variable that generated by a loop it can both be
very intentional and hard to debug.

With Kind regards,

Michael Frey

On 28.11.19 20:19, Ronaldo Persiano wrote: > > DEPRECATED: Using ranges of the form [begin:end] with begin value > greater than the end value is deprecated. > > Is there no way to provide some hint were the problem was found? > Hi, Good idea to tackle that. I am working on it: The issue was/is that at the point where DEPRECATED warning is created I do not have access to context (the context contains the location). So, I have to move the warning "up to chain". I need to dwell a bit about the details. The bold approach would be to change the DEPRECATED to ERROR. On the other-hand, currently for(i=[10:1:1]){     echo(i); } is not even a warning. In this example with constants it is obviously an error, but if the range is defined with a variable that generated by a loop it can both be very intentional and hard to debug. With Kind regards, Michael Frey
TP
Torsten Paul
Fri, Nov 29, 2019 8:08 PM

There's also the option to finally remove the range
auto-swapping.

ciao,
Torsten.

There's also the option to finally remove the range auto-swapping. ciao, Torsten.
MF
Michael Frey
Sat, Nov 30, 2019 12:09 PM

Work in progress can be seen at
https://github.com/openscad/openscad/pull/3149

I think cases with literals are distinct from cases with variables.

for([a,b,c]) will not create a warning as that can be very intentional
with nested for loops.

Yeah, it can be hard to debug, but creating warnings can cause issues
with legacy code and it bloats the user code with handling that.

for([100,1,1]) will create a warning, as this most likely a typo and no
outside circumstance can affect this loop.

With Kind regards,

Michael Frey

Work in progress can be seen at https://github.com/openscad/openscad/pull/3149 I think cases with literals are distinct from cases with variables. for([a,b,c]) will not create a warning as that can be very intentional with nested for loops. Yeah, it can be hard to debug, but creating warnings can cause issues with legacy code and it bloats the user code with handling that. for([100,1,1]) will create a warning, as this most likely a typo and no outside circumstance can affect this loop. With Kind regards, Michael Frey