Isn't this a bug?

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

Isn't this a bug?

Ronaldo
$i=1;  
module set() {$i=10; children();}
set() { echo(di=$i); i=$i; echo(i=i);}

// ECHO: di = 10
// ECHO: i = 1



--
Sent from: http://forum.openscad.org/

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

Re: Isn't this a bug?

nophead
This works:
$i=1;
module set() {$i=10; children();}
set() { echo(di=$i); let(i=$i) echo(i=i);}

I think the problem is echo is a module so set() has two children. i=$i is not a child and gets evaluated earlier.

On 4 February 2018 at 16:59, Ronaldo <[hidden email]> wrote:
$i=1;
module set() {$i=10; children();}
set() { echo(di=$i); i=$i; echo(i=i);}

// ECHO: di = 10
// ECHO: i = 1



--
Sent from: http://forum.openscad.org/

_______________________________________________
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