discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Syntax documentation

JL
Jamie Larkby-Lahet
Mon, Dec 1, 2025 5:03 PM

what about an implied let(){...} ? should be innocuous and still allow any
contained variable declarations to fall out of scope.

On Mon, Dec 1, 2025, 10:21 Jordan Brown via Discuss <
discuss@lists.openscad.org> wrote:

On 11/30/2025 4:38 AM, Jon Bondy via Discuss wrote:

I find that
!{
some code
}

gets a compiler error, but
!translate([0, 0, 0]){
some code
}

is OK.  Is this what would be expected?

It doesn't surprise me.  "Anonymous scopes" are very much a second-class
citizen.  I think we'd be better off if they were an implied union(), but
in theory that's incompatible with somebody who just used them for visual
grouping and collapsing in the editor.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

what about an implied let(){...} ? should be innocuous and still allow any contained variable declarations to fall out of scope. On Mon, Dec 1, 2025, 10:21 Jordan Brown via Discuss < discuss@lists.openscad.org> wrote: > On 11/30/2025 4:38 AM, Jon Bondy via Discuss wrote: > > I find that > !{ > some code > } > > gets a compiler error, but > !translate([0, 0, 0]){ > some code > } > > is OK. Is this what would be expected? > > > It doesn't surprise me. "Anonymous scopes" are very much a second-class > citizen. I think we'd be better off if they were an implied union(), but > in theory that's incompatible with somebody who just used them for visual > grouping and collapsing in the editor. > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
JB
Jordan Brown
Mon, Dec 1, 2025 6:29 PM

On 12/1/2025 9:03 AM, Jamie Larkby-Lahet via Discuss wrote:

what about an implied let(){...} ? should be innocuous and still allow
any contained variable declarations to fall out of scope.

{
    a = 1;
}
echo(a);

ECHO: 1

let() {
    a = 1;
}
echo(a);

WARNING: Ignoring unknown variable "a" in file ., line 4

"Anonymous scopes", what I sometimes call "naked braces", are not
scopes.  Everything else that looks like a scope... is a scope.

On 12/1/2025 9:03 AM, Jamie Larkby-Lahet via Discuss wrote: > what about an implied let(){...} ? should be innocuous and still allow > any contained variable declarations to fall out of scope. { a = 1; } echo(a); ECHO: 1 let() {     a = 1; } echo(a); WARNING: Ignoring unknown variable "a" in file ., line 4 "Anonymous scopes", what I sometimes call "naked braces", are not scopes.  Everything else that looks like a scope... is a scope.
JB
Jordan Brown
Mon, Dec 1, 2025 6:40 PM

Also:  let() {...} is an implied union(), like almost all other built-in
operators.  (difference, intersection, intersection_for, and minkowski
excepted.)  Naked braces say nothing about geometry.

intersection() {
    {
        cube(10);
        sphere(10);
    }
}

intersection() {
    let() {
        cube(10);
        sphere(10);
    }
}



module count() {
    echo($children);
}

count() {
    {
        cube();
        sphere();
    }
}

count() {
    let() {
        cube();
        sphere();
    }
}

ECHO: 2
ECHO: 1
Also:  let() {...} is an implied union(), like almost all other built-in operators.  (difference, intersection, intersection_for, and minkowski excepted.)  Naked braces say nothing about geometry. intersection() { { cube(10); sphere(10); } } intersection() { let() { cube(10); sphere(10); } } module count() { echo($children); } count() { { cube(); sphere(); } } count() { let() { cube(); sphere(); } } ECHO: 2 ECHO: 1
MM
Michael Marx (spintel)
Tue, Dec 2, 2025 1:11 AM

let() {...} is an implied union()

Unless the lazy union feature is enabled.
Is that going to go forward?


From: Jordan Brown via Discuss [mailto:discuss@lists.openscad.org]

Also:  let() {...} is an implied union(), like almost all other built-in operators.  (difference, intersection, intersection_for, and minkowski excepted.)  Naked braces say nothing about geometry.

> let() {...} is an implied union() Unless the lazy union feature is enabled. Is that going to go forward? _____ From: Jordan Brown via Discuss [mailto:discuss@lists.openscad.org] Also: let() {...} is an implied union(), like almost all other built-in operators. (difference, intersection, intersection_for, and minkowski excepted.) Naked braces say nothing about geometry.
AM
Adrian Mariano
Tue, Dec 2, 2025 2:30 AM

The indication from the devs is that the lazy union feature is almost
certainly dead.  It was introduced for performance reasons and with
manifold now is seen as unnecessary.  Furthermore, it breaks existing
models.

On Mon, Dec 1, 2025 at 8:12 PM Michael Marx (spintel) via Discuss <
discuss@lists.openscad.org> wrote:

let() {...} is an implied union()

Unless the lazy union feature is enabled.
Is that going to go forward?


From: Jordan Brown via Discuss [mailto:discuss@lists.openscad.org]

Also:  let() {...} is an implied union(), like almost all other built-in
operators.  (difference, intersection, intersection_for, and minkowski
excepted.)  Naked braces say nothing about geometry.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

The indication from the devs is that the lazy union feature is almost certainly dead. It was introduced for performance reasons and with manifold now is seen as unnecessary. Furthermore, it breaks existing models. On Mon, Dec 1, 2025 at 8:12 PM Michael Marx (spintel) via Discuss < discuss@lists.openscad.org> wrote: > > let() {...} is an implied union() > > Unless the lazy union feature is enabled. > Is that going to go forward? > > > ------------------------------ > > *From:* Jordan Brown via Discuss [mailto:discuss@lists.openscad.org] > > Also: let() {...} is an implied union(), like almost all other built-in > operators. (difference, intersection, intersection_for, and minkowski > excepted.) Naked braces say nothing about geometry. > > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
JB
Jordan Brown
Wed, Dec 3, 2025 8:26 AM

On 12/1/2025 5:11 PM, Michael Marx (spintel) via Discuss wrote:

let() {...} is an implied union()

Unless the lazy union feature is enabled.

OK, let() is a geometric grouping operation like most of the others. 
Without lazy union, it's an implied union.  With or without lazy union,
it groups geometry into one child.

Is that going to go forward?

My understanding is "no", but I am not an authority.

On 12/1/2025 5:11 PM, Michael Marx (spintel) via Discuss wrote: > > > let() {...} is an implied union() > > Unless the lazy union feature is enabled. > OK, let() is a geometric grouping operation like most of the others.  Without lazy union, it's an implied union.  With or without lazy union, it groups geometry into one child. > Is that going to go forward? > My understanding is "no", but I am not an authority.