That's how you see the openscad program. I see is as 'add this body, then intersect with this, then add this' and so on. It is a constructive/descriptive incremental approach. If you insist there is no 'time' in openscad, can you start in the middle of your program and wrap around from beginning? Would you get the same object, will it even make sense? The program is an algorirhmic description of a 3d body. An algorithm is a sequence of instructions finite in space, and its execution finite in time.
-------- Original message --------
From: "G. Wade Johnson" gwadej@anomaly.org
Date:03/02/2015 12:21 (GMT-05:00)
To: discuss@lists.openscad.org
Cc:
Subject: Re: [OpenSCAD] A = A + 1;
On Tue, 03 Feb 2015 11:40:48 -0500
Adrian Grajdeanu adriang0@cox.net wrote:
You may beat this into me, but you will not squash most people's
expectation. Hence you will have no peace.
As a long-time programmer, I understand what you are saying. However,
an OpenSCAD file is not a program. It does not execute. I think many of
us agree that "constant" would be a better name than "variable" for
this concept.
Like many have said, the variable concept makes no sense in OpenSCAD,
because the file is not a program executing in time.
Think of it as a description of a physical object. I can't have a
physical sphere with a variable diameter (barring inflatables, and
such). I describe the sphere with a dimension and it does not change.
What OpenSCAD calls variables are really named constants. Since
variables do not exist in the language, there is no "crippling" of them.
Why is there this stubborness to cripple variables? Is there a
technical reason, or is merely adherence to some purist dogma?
The technical reason is that the file does not execute in time. Several
people have pointed this out.
I can understand the tree structure of an openscad 'program'. Not
only can i understand it, but appreciate it enormously. This paradigm
simplifies things and enables caching of geometrical elements.
However programers feel the need for variables (in the classical
way). If at some point you accept this statement, and endeavor to
As I said, decades of programming experience here and I have not felt
limited in my OpenSCAD designs by a lack of variables.
G. Wade
provide variables in a languge, then embrace it all the way and
support variables in a manner free of gotchas or arbitrarily seeming
limitation.
-------- Original message --------
From: Alan Cox alan@lxorguk.ukuu.org.uk
Date:03/02/2015 11:19 (GMT-05:00)
To: Adrian Grajdeanu adriang0@cox.net
Cc: OpenSCAD general discussion discuss@lists.openscad.org
Subject: Re: [OpenSCAD] A = A + 1;
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
--
There will always be things we wish to say in our programs that in all
known languages can only be said poorly. -- Alan Perlis
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
How you see things is not how it really is. You should be able to permute
the position of any block anywhere in the same scope and it should still
work the same.
Minor caveats for difference() which has special syntax and
functions/modules that probably have to be defined before they are used as
a limitation of the parser.
On Feb 3, 2015 11:35 AM, "Adrian Grajdeanu" adriang0@cox.net wrote:
That's how you see the openscad program. I see is as 'add this body, then
intersect with this, then add this' and so on. It is a
constructive/descriptive incremental approach. If you insist there is no
'time' in openscad, can you start in the middle of your program and wrap
around from beginning? Would you get the same object, will it even make
sense? The program is an algorirhmic description of a 3d body. An algorithm
is a sequence of instructions finite in space, and its execution finite in
time.
-------- Original message --------
From: "G. Wade Johnson" gwadej@anomaly.org
Date:03/02/2015 12:21 (GMT-05:00)
To: discuss@lists.openscad.org
Cc:
Subject: Re: [OpenSCAD] A = A + 1;
On Tue, 03 Feb 2015 11:40:48 -0500
Adrian Grajdeanu adriang0@cox.net wrote:
You may beat this into me, but you will not squash most people's
expectation. Hence you will have no peace.
As a long-time programmer, I understand what you are saying. However,
an OpenSCAD file is not a program. It does not execute. I think many of
us agree that "constant" would be a better name than "variable" for
this concept.
Like many have said, the variable concept makes no sense in OpenSCAD,
because the file is not a program executing in time.
Think of it as a description of a physical object. I can't have a
physical sphere with a variable diameter (barring inflatables, and
such). I describe the sphere with a dimension and it does not change.
What OpenSCAD calls variables are really named constants. Since
variables do not exist in the language, there is no "crippling" of them.
Why is there this stubborness to cripple variables? Is there a
technical reason, or is merely adherence to some purist dogma?
The technical reason is that the file does not execute in time. Several
people have pointed this out.
I can understand the tree structure of an openscad 'program'. Not
only can i understand it, but appreciate it enormously. This paradigm
simplifies things and enables caching of geometrical elements.
However programers feel the need for variables (in the classical
way). If at some point you accept this statement, and endeavor to
As I said, decades of programming experience here and I have not felt
limited in my OpenSCAD designs by a lack of variables.
G. Wade
provide variables in a languge, then embrace it all the way and
support variables in a manner free of gotchas or arbitrarily seeming
limitation.
-------- Original message --------
From: Alan Cox alan@lxorguk.ukuu.org.uk
Date:03/02/2015 11:19 (GMT-05:00)
To: Adrian Grajdeanu adriang0@cox.net
Cc: OpenSCAD general discussion discuss@lists.openscad.org
Subject: Re: [OpenSCAD] A = A + 1;
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
--
There will always be things we wish to say in our programs that in all
known languages can only be said poorly. -- Alan Perlis
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
In all the years I have been following OpenSCAD new people have been
buffeled about the lack of x=x+1.
But I cant remember ever anybody trying to re-program OpenSCAD to make it
possible.
Surprisingly everything can be done without it.
And if you really,really want to use x=x+1, you can use SolidCode/SolidPython
to generate Openscad programs.
2015-02-03 18:56 GMT+01:00 Joseph Lenox lenox.joseph@gmail.com:
How you see things is not how it really is. You should be able to permute
the position of any block anywhere in the same scope and it should still
work the same.
Minor caveats for difference() which has special syntax and
functions/modules that probably have to be defined before they are used as
a limitation of the parser.
On Feb 3, 2015 11:35 AM, "Adrian Grajdeanu" adriang0@cox.net wrote:
That's how you see the openscad program. I see is as 'add this body, then
intersect with this, then add this' and so on. It is a
constructive/descriptive incremental approach. If you insist there is no
'time' in openscad, can you start in the middle of your program and wrap
around from beginning? Would you get the same object, will it even make
sense? The program is an algorirhmic description of a 3d body. An algorithm
is a sequence of instructions finite in space, and its execution finite in
time.
-------- Original message --------
From: "G. Wade Johnson" gwadej@anomaly.org
Date:03/02/2015 12:21 (GMT-05:00)
To: discuss@lists.openscad.org
Cc:
Subject: Re: [OpenSCAD] A = A + 1;
On Tue, 03 Feb 2015 11:40:48 -0500
Adrian Grajdeanu adriang0@cox.net wrote:
You may beat this into me, but you will not squash most people's
expectation. Hence you will have no peace.
As a long-time programmer, I understand what you are saying. However,
an OpenSCAD file is not a program. It does not execute. I think many of
us agree that "constant" would be a better name than "variable" for
this concept.
Like many have said, the variable concept makes no sense in OpenSCAD,
because the file is not a program executing in time.
Think of it as a description of a physical object. I can't have a
physical sphere with a variable diameter (barring inflatables, and
such). I describe the sphere with a dimension and it does not change.
What OpenSCAD calls variables are really named constants. Since
variables do not exist in the language, there is no "crippling" of them.
Why is there this stubborness to cripple variables? Is there a
technical reason, or is merely adherence to some purist dogma?
The technical reason is that the file does not execute in time. Several
people have pointed this out.
I can understand the tree structure of an openscad 'program'. Not
only can i understand it, but appreciate it enormously. This paradigm
simplifies things and enables caching of geometrical elements.
However programers feel the need for variables (in the classical
way). If at some point you accept this statement, and endeavor to
As I said, decades of programming experience here and I have not felt
limited in my OpenSCAD designs by a lack of variables.
G. Wade
provide variables in a languge, then embrace it all the way and
support variables in a manner free of gotchas or arbitrarily seeming
limitation.
-------- Original message --------
From: Alan Cox alan@lxorguk.ukuu.org.uk
Date:03/02/2015 11:19 (GMT-05:00)
To: Adrian Grajdeanu adriang0@cox.net
Cc: OpenSCAD general discussion discuss@lists.openscad.org
Subject: Re: [OpenSCAD] A = A + 1;
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
--
There will always be things we wish to say in our programs that in all
known languages can only be said poorly. -- Alan Perlis
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
--
stempeldergeschichte@googlemail.com karsten@rohrbach.de
P.S. Falls meine E-Mail kürzer ausfällt als Dir angenehm ist:
Ich probiere gerade aus kurze Antworten statt gar keine Antworten zu
schreiben.
Wenn Du gerne mehr lesen möchtest, dann lass es mich bitte wissen.
P.S. In case my e-mail is shorter than you enjoy:
I am currently trying short replies instead of no replies at all.
Please let me know, if you like to read more.
Enjoy!
I see three complaints.
OpenSCADs handling of variables is suboptimal. True, although there were
some large improvements recently.
OpenSCAD is lacking as a functional language. True.
OpenSCAD lacks a destructive update operator (c-style assignment). This is
inherent to the way Openscad models the target domain (constructive solid
geometry) and it can not possibly change, because it would violate that
union is a commutative operator.
A destructive update operator would have to be valid only in certain very
limited places, causing even more confusion.
Example:
b = 5;
union() { // Union operator
// Operand A
union() {
b = b + 5;
sphere(d=b, $fn=50);
}
// Operand B
union() {
b = b + 5;
translate([40, 0, 0])
cube(b, center=true);
}
}
Both shapes have size 10, because each sub-union() creates its own variable
b that shadows the global b. In C you would be able to re-assign the global
b. In this case the sphere would have d=5+5=10, and the cube would get size
5+5+5 = 15.
By swapping the order of operand a and b, the sphere would be 15 and the
cube 10.
Union() is a commutative operator, meaning that the result does not depend
on the order of the operands. Allowing reassignment breaks this fundamental
property of union().
Have a nice day,
Bananapeel :)
--
View this message in context: http://forum.openscad.org/A-A-1-tp11385p11423.html
Sent from the OpenSCAD mailing list archive at Nabble.com.