discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Scope rules broken

NH
nop head
Sun, Jan 10, 2016 9:08 PM

I don't understand what is meant by "grouping variables". Do anonymous
braces do anything at all when applied around variables?

Scad:
{ a = 1; b = 2; cube();}
{ c = 3; d = 4; sphere();}

AST:
a = 1;

b = 2;

c = 3;

d = 4;

cube();

sphere();

CSG:

group() {

cube(size = [1, 1, 1], center = false);

sphere($fn = 0, $fa = 12, $fs = 2, r = 1);

}

They look like they do nothing at all to me.

On 10 January 2016 at 20:07, Marius Kintel marius@kintel.net wrote:

To confirm/clarify:

The anonymous scopes was a design mistake in early OpenSCAD, where scopes
didn’t have a function.
I don’t know how often people use that feature to group variables, so I
haven’t dared changing that yet, but I do agree that ideally this should be
a true scope.

Deprecating assert() was indeed a bit premature, but it functions well as
a way of telling people to avoid using it.
The parallel assignment behavior was an extra motivator to deprecate it.
Adding let() makes sense to me and that would also be another baby step
towards OpenSCAD2 :)

-Marius


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

I don't understand what is meant by "grouping variables". Do anonymous braces do anything at all when applied around variables? Scad: { a = 1; b = 2; cube();} { c = 3; d = 4; sphere();} AST: a = 1; b = 2; c = 3; d = 4; cube(); sphere(); CSG: group() { cube(size = [1, 1, 1], center = false); sphere($fn = 0, $fa = 12, $fs = 2, r = 1); } They look like they do nothing at all to me. On 10 January 2016 at 20:07, Marius Kintel <marius@kintel.net> wrote: > To confirm/clarify: > > The anonymous scopes was a design mistake in early OpenSCAD, where scopes > didn’t have a function. > I don’t know how often people use that feature to group variables, so I > haven’t dared changing that yet, but I do agree that ideally this should be > a true scope. > > Deprecating assert() was indeed a bit premature, but it functions well as > a way of telling people to avoid using it. > The parallel assignment behavior was an extra motivator to deprecate it. > Adding let() makes sense to me and that would also be another baby step > towards OpenSCAD2 :) > > -Marius > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
TP
Torsten Paul
Sun, Jan 10, 2016 9:14 PM

On 01/10/2016 10:08 PM, nop head wrote:

I don't understand what is meant by "grouping variables". Do
anonymous braces do anything at all when applied around variables?

On 01/10/2016 10:08 PM, nop head wrote: > I don't understand what is meant by "grouping variables". Do > anonymous braces do anything at all when applied around variables? > http://forum.openscad.org/OpenSCAD2-design-docs-td13019.html#a13225 ciao, Torsten.
NH
nop head
Sun, Jan 10, 2016 9:27 PM

I see, so for folding in an editor, no effect in OpenScad at all.

Considering I have spent days trying to sort out the mess created by
updating to an OpenScad version that is supposed to be backwards compatible
I think having to remove a few braces is not much hardship. You can program
editors to fold on special comments anyway.

On 10 January 2016 at 21:14, Torsten Paul Torsten.Paul@gmx.de wrote:

On 01/10/2016 10:08 PM, nop head wrote:

I don't understand what is meant by "grouping variables". Do
anonymous braces do anything at all when applied around variables?

I see, so for folding in an editor, no effect in OpenScad at all. Considering I have spent days trying to sort out the mess created by updating to an OpenScad version that is supposed to be backwards compatible I think having to remove a few braces is not much hardship. You can program editors to fold on special comments anyway. On 10 January 2016 at 21:14, Torsten Paul <Torsten.Paul@gmx.de> wrote: > On 01/10/2016 10:08 PM, nop head wrote: > > I don't understand what is meant by "grouping variables". Do > > anonymous braces do anything at all when applied around variables? > > > http://forum.openscad.org/OpenSCAD2-design-docs-td13019.html#a13225 > > ciao, > Torsten. > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >