Multiple assignment warnings

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Multiple assignment warnings

nophead
I get dozens of warning like this on Mendel90 now:

WARNING: pulley_type was assigned on line 78 of "config.scad" but was overwritten on line 64 of "dibond_config.scad"


This is deliberate, values are given a default that can be overridden in a specific machine configuration or not. I thought that it was only supposed to only warn if you redefined in the same file?


Other observations are that the console should be a lot bigger now that we have a lot more warnings.


There should be a stop on first error option as well as stop on first warning as I had so many warnings I could not see an error.




_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Multiple assignment warnings

nophead
Actually I see that it always stops on the first error. The problem I had was I had two windows open, so the error occurred in the first one and it stopped but the second one used the cached module, so doesn't see the error and just carries on.

On Sat, 19 Jan 2019 at 09:31, nop head <[hidden email]> wrote:
I get dozens of warning like this on Mendel90 now:

WARNING: pulley_type was assigned on line 78 of "config.scad" but was overwritten on line 64 of "dibond_config.scad"


This is deliberate, values are given a default that can be overridden in a specific machine configuration or not. I thought that it was only supposed to only warn if you redefined in the same file?


Other observations are that the console should be a lot bigger now that we have a lot more warnings.


There should be a stop on first error option as well as stop on first warning as I had so many warnings I could not see an error.




_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Multiple assignment warnings

MichaelPFrey
In reply to this post by nophead
On 19.01.19 10:31, nop head wrote:

WARNING: pulley_type was assigned on line 78 of "config.scad" but was overwritten on line 64 of "dibond_config.scad"

This is deliberate, values are given a default that can be overridden in a specific machine configuration or not. I thought that it was only supposed to only warn if you redefined in the same file?

I would like to see the minimum example that causes this warning so that we can discuss whether the warning is justified or not.

here is the whole code

https://github.com/openscad/openscad/blob/707043efe658e9bf41ea102fafad1c093c7fdbfd/src/parser.y#L218-L246

I think you are running into that one:

https://github.com/openscad/openscad/blob/707043efe658e9bf41ea102fafad1c093c7fdbfd/src/parser.y#L238

I would like to see an example, where is makes sense to assign a variable in the currently open main file beeing overwritten by an include. The assignment in the main file should not have any effect, as it is always overwritten by the included file.

(except when you start commenting out includes to get different configs)

Note that the reverse (included variable overwritten by the main file) should not cause a warning.

Maybe it is an issue with use<>;, nested use and include are tricky to setup and test.

On 19.01.19 10:31, nop head wrote:
Other observations are that the console should be a lot bigger now that we have a lot more warnings.

Trace (https://github.com/openscad/openscad/pull/2645) should motivate people to turn on stopp on first warning


On 19.01.19 10:31, nop head wrote:
There should be a stop on first error option as well as stop on first warning as I had so many warnings I could not see an error.

I agree with that, but the Error Messages are a bit more complicated then the warnings.


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Multiple assignment warnings

nophead
I include config.scad in every file of my project. It defines default values and then includes machine.scad, which is generated by Python and simply includes any one of several machine specific configurations that override some of the defaults. In this case dibond_config.scad.

It does normally work as expected. In this case I opened config.scad in OpenSCAD to look for an error, so in that window it was the main file, so it generated a wall of warnings.

It is probably quite an unusual use case and I don't normally open config.scad in OpenSCAD because I use an external editor to modify it, so I can live with it now that I know the reason why.

The console is limited to 500 lines, which is totally arbitrary. It could easily be 100 times bigger and not cause any performance issues.




On Sat, 19 Jan 2019 at 13:53, Michael Frey <[hidden email]> wrote:
On 19.01.19 10:31, nop head wrote:

WARNING: pulley_type was assigned on line 78 of "config.scad" but was overwritten on line 64 of "dibond_config.scad"

This is deliberate, values are given a default that can be overridden in a specific machine configuration or not. I thought that it was only supposed to only warn if you redefined in the same file?

I would like to see the minimum example that causes this warning so that we can discuss whether the warning is justified or not.

here is the whole code

https://github.com/openscad/openscad/blob/707043efe658e9bf41ea102fafad1c093c7fdbfd/src/parser.y#L218-L246

I think you are running into that one:

https://github.com/openscad/openscad/blob/707043efe658e9bf41ea102fafad1c093c7fdbfd/src/parser.y#L238

I would like to see an example, where is makes sense to assign a variable in the currently open main file beeing overwritten by an include. The assignment in the main file should not have any effect, as it is always overwritten by the included file.

(except when you start commenting out includes to get different configs)

Note that the reverse (included variable overwritten by the main file) should not cause a warning.

Maybe it is an issue with use<>;, nested use and include are tricky to setup and test.

On 19.01.19 10:31, nop head wrote:
Other observations are that the console should be a lot bigger now that we have a lot more warnings.

Trace (https://github.com/openscad/openscad/pull/2645) should motivate people to turn on stopp on first warning


On 19.01.19 10:31, nop head wrote:
There should be a stop on first error option as well as stop on first warning as I had so many warnings I could not see an error.

I agree with that, but the Error Messages are a bit more complicated then the warnings.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org