discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: [OpenSCAD] A = A + 1;

AG
Adrian Grajdeanu
Tue, Feb 3, 2015 3:20 PM

If this were an equation, you'd be right. But it isn't an equation. It is an assignment. If you continue to support a paradigm that runs counter to people's expectation, you will have no piece.

-------- Original message --------
From: Bananapeel lunatica.xiaoyu@gmail.com
Date:03/02/2015  07:25  (GMT-05:00)
To: discuss@lists.openscad.org
Cc:
Subject: Re: [OpenSCAD] A = A + 1;

You don't. An OpenSCAD program is like a big math equation. x = x + 1 is
illegal because x can't have two values at once.

--
View this message in context: http://forum.openscad.org/A-A-1-tp11385p11386.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


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

If this were an equation, you'd be right. But it isn't an equation. It is an assignment. If you continue to support a paradigm that runs counter to people's expectation, you will have no piece. -------- Original message -------- From: Bananapeel <lunatica.xiaoyu@gmail.com> Date:03/02/2015 07:25 (GMT-05:00) To: discuss@lists.openscad.org Cc: Subject: Re: [OpenSCAD] A = A + 1; You don't. An OpenSCAD program is like a big math equation. x = x + 1 is illegal because x can't have two values at once. -- View this message in context: http://forum.openscad.org/A-A-1-tp11385p11386.html Sent from the OpenSCAD mailing list archive at Nabble.com. _______________________________________________ OpenSCAD mailing list Discuss@lists.openscad.org http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
AC
Alan Cox
Tue, Feb 3, 2015 4:19 PM

On Tue, 03 Feb 2015 10:20:53 -0500
Adrian Grajdeanu adriang0@cox.net wrote:

If this were an equation, you'd be right. But it isn't an equation. It is an assignment.

Depending how you look at it the statements in question are either
equations or just definitions.

In openscad  X = Y + 1 is a definition of X with a scope.

You cannot define X to be two things at once any more than you can define
anything else in life to be two conflicting things at once.

If you see it as an assignment you are going to continue suffering from
iterative programmer disease. Think of it as #define

Alan

On Tue, 03 Feb 2015 10:20:53 -0500 Adrian Grajdeanu <adriang0@cox.net> wrote: > If this were an equation, you'd be right. But it isn't an equation. It is an assignment. Depending how you look at it the statements in question are either equations or just definitions. In openscad X = Y + 1 is a definition of X with a scope. You cannot define X to be two things at once any more than you can define anything else in life to be two conflicting things at once. If you see it as an assignment you are going to continue suffering from iterative programmer disease. Think of it as #define Alan
RB
Richard Benjamin
Tue, Feb 3, 2015 4:34 PM

Back in the old days, I was introduced to Pascal and Modular-2, where
the assignment was ' := ' to make it clear that it was different.

The thing to remember with OpenSCAD is that it is timeless. The cad
script you write is to describe an object that simply 'is'. there is no
'now' object and no 'later' object.

The use of loops is simply to describe a set of similar parts, not to go
back and do something different with the same parts. Think of the  loop
structures as a convenient way of shortening the ammount of typing - it
simply unwinds as a list all at once to produce a logical hierarchy of
lumps of STL triangles.

As such, the 'variables' are also all the same everywhere, as there is
no earlier or later as there is no program flow. Perhaps 'Operand' would
be better than 'variable' or 'constant'.

On 03/02/2015 16:19, Alan Cox wrote:

On Tue, 03 Feb 2015 10:20:53 -0500
Adrian Grajdeanu adriang0@cox.net wrote:

If this were an equation, you'd be right. But it isn't an equation. It is an assignment.

Depending how you look at it the statements in question are either
equations or just definitions.

In openscad  X = Y + 1 is a definition of X with a scope.

You cannot define X to be two things at once any more than you can define
anything else in life to be two conflicting things at once.

If you see it as an assignment you are going to continue suffering from
iterative programmer disease. Think of it as #define

Alan


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

Back in the old days, I was introduced to Pascal and Modular-2, where the assignment was ' := ' to make it clear that it was different. The thing to remember with OpenSCAD is that it is timeless. The cad script you write is to describe an object that simply 'is'. there is no 'now' object and no 'later' object. The use of loops is simply to describe a set of similar parts, not to go back and do something different with the same parts. Think of the loop structures as a convenient way of shortening the ammount of typing - it simply unwinds as a list all at once to produce a logical hierarchy of lumps of STL triangles. As such, the 'variables' are also all the same everywhere, as there is no earlier or later as there is no program flow. Perhaps 'Operand' would be better than 'variable' or 'constant'. On 03/02/2015 16:19, Alan Cox wrote: > On Tue, 03 Feb 2015 10:20:53 -0500 > Adrian Grajdeanu <adriang0@cox.net> wrote: > >> If this were an equation, you'd be right. But it isn't an equation. It is an assignment. > Depending how you look at it the statements in question are either > equations or just definitions. > > In openscad X = Y + 1 is a definition of X with a scope. > > You cannot define X to be two things at once any more than you can define > anything else in life to be two conflicting things at once. > > If you see it as an assignment you are going to continue suffering from > iterative programmer disease. Think of it as #define > > Alan > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >