I have some code that has a default module parameter that works in version
2016.10.04 (git 7e0935d) but doesn't work in 2017.01.20.
foot = [25, 12, 3, 2, M4_cap_screw, 10];
module foot_assembly(t, type = foot) {
...
}
When this module is used by another module and foot_assembly() is called
then foot is undefined. So it seems that the scope lookup rules have
changed recently. Obviously foot is defined where foot_assembly is defined
but it isn't where it is called.
Which version is correct? Which scope should default parameters be looked
up in? Seems to me it should be static scope, so this is a regression.
Thanks for the report!
This is most definitely a regression.
I’ve created a new issue: https://github.com/openscad/openscad/issues/1923
I’m surprised we don’t have a test for this, but that will change soon :)
FYI: Any snapshot 2016.10.16 or older should work.
-Marius
On Jan 30, 2017, at 06:56, nop head nop.head@gmail.com wrote:
I have some code that has a default module parameter that works in version 2016.10.04 (git 7e0935d) but doesn't work in 2017.01.20.
foot = [25, 12, 3, 2, M4_cap_screw, 10];
module foot_assembly(t, type = foot) {
...
}
When this module is used by another module and foot_assembly() is called then foot is undefined. So it seems that the scope lookup rules have changed recently. Obviously foot is defined where foot_assembly is defined but it isn't where it is called.
Which version is correct? Which scope should default parameters be looked up in? Seems to me it should be static scope, so this is a regression.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org