This code used to work but doesn't now.

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

This code used to work but doesn't now.

nophead
for(i = [0 : 3], $colour = ["royalblue", "springgreen", "red", "yellow"][i], $value = ["120","330","500","120"][i]) echo($colour, $value);

This used to work, giving colours and three digit strings but now it does this:

ECHO: "r", "1"

ECHO: "r", "2"

ECHO: "r", "0"

ECHO: "o", "1"

ECHO: "o", "2"

ECHO: "o", "0"

ECHO: "y", "1"

ECHO: "y", "2"

ECHO: "y", "0"

ECHO: "a", "1"

ECHO: "a", "2"

ECHO: "a", "0"

ECHO: "l", "1"

ECHO: "l", "2"

ECHO: "l", "0"

ECHO: "b", "1"

ECHO: "b", "2"

ECHO: "b", "0"

ECHO: "l", "1"

ECHO: "l", "2"

ECHO: "l", "0"

ECHO: "u", "1"

ECHO: "u", "2"

ECHO: "u", "0"

ECHO: "e", "1"

ECHO: "e", "2"

ECHO: "e", "0"

ECHO: "s", "3"

ECHO: "s", "3"

ECHO: "s", "0"

ECHO: "p", "3"

ECHO: "p", "3"

ECHO: "p", "0"

ECHO: "r", "3"

ECHO: "r", "3"

ECHO: "r", "0"

ECHO: "i", "3"

ECHO: "i", "3"

ECHO: "i", "0"

ECHO: "n", "3"

ECHO: "n", "3"

ECHO: "n", "0"

ECHO: "g", "3"

ECHO: "g", "3"

ECHO: "g", "0"

ECHO: "g", "3"

ECHO: "g", "3"

ECHO: "g", "0"

ECHO: "r", "3"

ECHO: "r", "3"

ECHO: "r", "0"

ECHO: "e", "3"

ECHO: "e", "3"

ECHO: "e", "0"

ECHO: "e", "3"

ECHO: "e", "3"

ECHO: "e", "0"

ECHO: "n", "3"

ECHO: "n", "3"

ECHO: "n", "0"

ECHO: "r", "5"

ECHO: "r", "0"

ECHO: "r", "0"

ECHO: "e", "5"

ECHO: "e", "0"

ECHO: "e", "0"

ECHO: "d", "5"

ECHO: "d", "0"

ECHO: "d", "0"

ECHO: "y", "1"

ECHO: "y", "2"

ECHO: "y", "0"

ECHO: "e", "1"

ECHO: "e", "2"

ECHO: "e", "0"

ECHO: "l", "1"

ECHO: "l", "2"

ECHO: "l", "0"

ECHO: "l", "1"

ECHO: "l", "2"

ECHO: "l", "0"

ECHO: "o", "1"

ECHO: "o", "2"

ECHO: "o", "0"

ECHO: "w", "1"

ECHO: "w", "2"

ECHO: "w", "0"


I fixed it by using let but what changed?

for(i = [0 : 3], $colour = ["royalblue", "springgreen", "red", "yellow"][i], $value = ["120","330","500","120"][i]) echo($colour, $value);

ECHO: "royalblue", "120"

ECHO: "springgreen", "330"

ECHO: "red", "500"

ECHO: "yellow", "120"





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

Re: This code used to work but doesn't now.

tp3
On 11.02.19 23:20, nop head wrote:
> I fixed it by using let but what changed?

That is due to https://github.com/openscad/openscad/pull/2509

ciao,
   Torsten.


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

Re: This code used to work but doesn't now.

Parkinbot
In reply to this post by nophead
looks like you need to write now:
for(i = [0 : 3], $colour = [["royalblue", "springgreen", "red",
"yellow"][i]], $value = [["120","330","500","120"][i]]) echo($colour,
$value);




--
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: This code used to work but doesn't now.

nophead
In reply to this post by tp3
I see. It is is becoming a full time job to keep my projects working with OpenSCAD these days. Good job I am retired and have nothing better to do.

On Mon, 11 Feb 2019 at 22:39, Torsten Paul <[hidden email]> wrote:
On 11.02.19 23:20, nop head wrote:
> I fixed it by using let but what changed?

That is due to https://github.com/openscad/openscad/pull/2509

ciao,
   Torsten.


_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: This code used to work but doesn't now.

kintel
Administrator

> On Feb 11, 2019, at 17:45, nop head <[hidden email]> wrote:
>
> I see. It is is becoming a full time job to keep my projects working with OpenSCAD these days. Good job I am retired and have nothing better to do.
>
Heh, we try really hard to maintain old behavior, but sometimes we decide that the intended use-case was too narrow.
I guess you're the one person with the largest OpenSCAD codebase out there. I'm sorry you have to suffer, but it's for the greater good :)

 -Marius


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

Re: This code used to work but doesn't now.

nophead
In reply to this post by Parkinbot
Yes that works around it but the cleanest solutions is with let. I.e.
for(i = [0 : 3]) 
    let($colour = ["royalblue", "springgreen", "red", "yellow"][i], $value = ["120","330","500","120"][i]) 
        echo($colour, $value);

image.png

On Mon, 11 Feb 2019 at 22:46, Parkinbot <[hidden email]> wrote:
looks like you need to write now:
for(i = [0 : 3], $colour = [["royalblue", "springgreen", "red",
"yellow"][i]], $value = [["120","330","500","120"][i]]) echo($colour,
$value);




--
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
Reply | Threaded
Open this post in threaded view
|

Re: This code used to work but doesn't now.

oystein.krog
In reply to this post by kintel
I actually also ran in this problem, and I predict many others will in the future.
I am not opposed to all these changes, but I do think it would be great if there was a public list of such "breaking changes" with examples and workarounds.
The changes required to silence all warnings in my project are significant, but the majority of them are actual bugs in my code, so I'm really happy to finally have a good way to detect and fix such bugs :)

On Tue, Feb 12, 2019 at 3:21 AM Marius Kintel <[hidden email]> wrote:

> On Feb 11, 2019, at 17:45, nop head <[hidden email]> wrote:
>
> I see. It is is becoming a full time job to keep my projects working with OpenSCAD these days. Good job I am retired and have nothing better to do.
>
Heh, we try really hard to maintain old behavior, but sometimes we decide that the intended use-case was too narrow.
I guess you're the one person with the largest OpenSCAD codebase out there. I'm sorry you have to suffer, but it's for the greater good :)

 -Marius


_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: This code used to work but doesn't now.

nophead
Yes when warnings first started to be added it found many bugs in my code, nearly all of which were inconsequential but nevertheless mistakes. But latterly I am fixing things I don't regard as bugs such as len(scalar) and shapes with zero size. These were accepted practice and fixing the warnings makes my code longer.

This change makes sense for consistency though.

On Tue, 12 Feb 2019 at 09:19, Øystein E. Krog <[hidden email]> wrote:
I actually also ran in this problem, and I predict many others will in the future.
I am not opposed to all these changes, but I do think it would be great if there was a public list of such "breaking changes" with examples and workarounds.
The changes required to silence all warnings in my project are significant, but the majority of them are actual bugs in my code, so I'm really happy to finally have a good way to detect and fix such bugs :)

On Tue, Feb 12, 2019 at 3:21 AM Marius Kintel <[hidden email]> wrote:

> On Feb 11, 2019, at 17:45, nop head <[hidden email]> wrote:
>
> I see. It is is becoming a full time job to keep my projects working with OpenSCAD these days. Good job I am retired and have nothing better to do.
>
Heh, we try really hard to maintain old behavior, but sometimes we decide that the intended use-case was too narrow.
I guess you're the one person with the largest OpenSCAD codebase out there. I'm sorry you have to suffer, but it's for the greater good :)

 -Marius


_______________________________________________
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

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

Re: This code used to work but doesn't now.

kintel
Administrator
In reply to this post by oystein.krog

> On Feb 12, 2019, at 04:17, Øystein E. Krog <[hidden email]> wrote:
>
> I am not opposed to all these changes, but I do think it would be great if there was a public list of such "breaking changes" with examples and workarounds.


Yes, we'll definitely add a "breaking changes" section to the release notes!

 -Marius


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