discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

lists/vectors

AM
Adrian Mariano
Sun, Jan 12, 2025 11:48 PM

Ray, you never actually said what you want to do, but I think if you can do
it in C, you can do it in OpenSCAD.  It just might be a lot of trouble and
really slow---depending on what you're doing.  You just have to structure
your code recursively instead of procedurally.

On Sun, Jan 12, 2025 at 5:58 PM Raymond West via Discuss <
discuss@lists.openscad.org> wrote:

that is what I inferred from the description in the wiki, that started
this thread

On 12/01/2025 22:10, Father Horton via Discuss wrote:

So it looks like variable a got a new value


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

Ray, you never actually said what you want to do, but I think if you can do it in C, you can do it in OpenSCAD. It just might be a lot of trouble and really slow---depending on what you're doing. You just have to structure your code recursively instead of procedurally. On Sun, Jan 12, 2025 at 5:58 PM Raymond West via Discuss < discuss@lists.openscad.org> wrote: > that is what I inferred from the description in the wiki, that started > this thread > > On 12/01/2025 22:10, Father Horton via Discuss wrote: > > So it looks like variable a got a new value > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
JB
Jordan Brown
Mon, Jan 13, 2025 1:11 AM

On 1/12/2025 2:10 PM, Father Horton via Discuss wrote:

Not to beat a dead horse, but if you run:

a = 10;
echo(a);
a = 20;
echo(a);

You get this:

WARNING: a was assigned on line 1 but was overwritten in file
test.scad, line 3
Compiling design (CSG Tree generation)...
ECHO: 20
ECHO: 20

So it looks like variable a got a new value, but it never did.

This actually demonstrates one of the ... interesting ... behaviors of
OpenSCAD:  in any given scope, assignments happen before module
invocations.  And echo() is a module invocation.

There are several other more subtle ... interesting ... behaviors in
this picture (and I actually wrote up a much longer message before
deciding that it didn't really help).

The biggest lesson is to set "Stop on the first warning", and fix any
problems reported.

On 1/12/2025 2:10 PM, Father Horton via Discuss wrote: > Not to beat a dead horse, but if you run: > > a = 10; > echo(a); > a = 20; > echo(a); > > You get this: > > WARNING: a was assigned on line 1 but was overwritten in file > test.scad, line 3 > Compiling design (CSG Tree generation)... > ECHO: 20 > ECHO: 20 > > So it looks like variable a got a new value, but it never did. This actually demonstrates one of the ... interesting ... behaviors of OpenSCAD:  in any given scope, assignments happen before module invocations.  And echo() is a module invocation. There are several other more subtle ... interesting ... behaviors in this picture (and I actually wrote up a much longer message before deciding that it didn't really help). The biggest lesson is to set "Stop on the first warning", and fix any problems reported.
RW
Raymond West
Mon, Jan 13, 2025 12:31 PM

If you flog a dead horse enough, you get down to the bones.

On 13/01/2025 01:11, Jordan Brown via Discuss wrote:

On 1/12/2025 2:10 PM, Father Horton via Discuss wrote:

Not to beat a dead horse, but if you run:

a = 10;
echo(a);
a = 20;
echo(a);

You get this:

WARNING: a was assigned on line 1 but was overwritten in file
test.scad, line 3
Compiling design (CSG Tree generation)...
ECHO: 20
ECHO: 20

So it looks like variable a got a new value, but it never did.

This actually demonstrates one of the ... interesting ... behaviors of
OpenSCAD:  in any given scope, assignments happen before module
invocations.  And echo() is a module invocation.

There are several other more subtle ... interesting ... behaviors in
this picture (and I actually wrote up a much longer message before
deciding that it didn't really help).

The biggest lesson is to set "Stop on the first warning", and fix any
problems reported.


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

If you flog a dead horse enough, you get down to the bones. On 13/01/2025 01:11, Jordan Brown via Discuss wrote: > On 1/12/2025 2:10 PM, Father Horton via Discuss wrote: >> Not to beat a dead horse, but if you run: >> >> a = 10; >> echo(a); >> a = 20; >> echo(a); >> >> You get this: >> >> WARNING: a was assigned on line 1 but was overwritten in file >> test.scad, line 3 >> Compiling design (CSG Tree generation)... >> ECHO: 20 >> ECHO: 20 >> >> So it looks like variable a got a new value, but it never did. > > This actually demonstrates one of the ... interesting ... behaviors of > OpenSCAD:  in any given scope, assignments happen before module > invocations.  And echo() is a module invocation. > > There are several other more subtle ... interesting ... behaviors in > this picture (and I actually wrote up a much longer message before > deciding that it didn't really help). > > The biggest lesson is to set "Stop on the first warning", and fix any > problems reported. > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email todiscuss-leave@lists.openscad.org