The wish for reassigning variables comes again and again.
And apart from the discussion weather or not reassignment is needed or not
I would like to think about what the necessary steps would be to make it
happen.
In my simple understanding of programming, only a simple pre-execution of
the code is needed, that ignores all geometrical calculation and just
generates an intermediate code were every occurrence of a reassigned
variable is overwritten with its explicit value at that time.
--
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!
On Feb 11, 2015, at 14:46 PM, Peter Falke stempeldergeschichte@googlemail.com wrote:
In my simple understanding of programming, only a simple pre-execution of the code is needed, that ignores all geometrical calculation and just generates an intermediate code were every occurrence of a reassigned variable is overwritten with its explicit value at that time.
Preprocessing might be the logical way to do it.
One way to think about it is that you want to turn this:
a=1;
a=a+1;
a=a+1;
myshape(a);
into:
assign(a=1)
assign(a=a+1)
assign(a=a+1)
sphere(a);
..where the latter is correct OpenSCAD syntax.
While this is perfectly doable, keep in mind that one of the reasons for not changing this behavior is that cmd-line overrides using -D needs to be resolved properly, preferably in a backwards-compatible way.
-Marius
One solution for -D cmd-line would be to assign the first occurrence of the
variable to the -D parameter.
One has to think about the reassignment by libraries as well.
2015-02-11 21:34 GMT+01:00 Marius Kintel marius@kintel.net:
On Feb 11, 2015, at 14:46 PM, Peter Falke <
stempeldergeschichte@googlemail.com> wrote:
In my simple understanding of programming, only a simple pre-execution
of the code is needed, that ignores all geometrical calculation and just
generates an intermediate code were every occurrence of a reassigned
variable is overwritten with its explicit value at that time.
Preprocessing might be the logical way to do it.
One way to think about it is that you want to turn this:
a=1;
a=a+1;
a=a+1;
myshape(a);
into:
assign(a=1)
assign(a=a+1)
assign(a=a+1)
sphere(a);
..where the latter is correct OpenSCAD syntax.
While this is perfectly doable, keep in mind that one of the reasons for
not changing this behavior is that cmd-line overrides using -D needs to be
resolved properly, preferably in a backwards-compatible way.
-Marius
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!
Perhaps it is too soon to consider some form of automatic namespacing?
Like if a is included from b.scad, you can refer to it directly as b:a?
Includes from includes could either be part of the last include's namespace
or the file they came from. So if c defines a and b includes c and the user
has included b, either still b:a or b:c:a. I am less enamored of the second
as it implies a lot more coupling to libraries.
Obviously a namespace block would be useful as well.
This, I think is a useful balance between library name collisions and
compatibility with existing libs.
Overrides with -D are still pretty dirty (but entirely in keeping with the
syntax restrictions to its loose cousin, the c preprocessor)
On Feb 11, 2015 3:30 PM, "Peter Falke" stempeldergeschichte@googlemail.com
wrote:
One solution for -D cmd-line would be to assign the first occurrence of
the variable to the -D parameter.
One has to think about the reassignment by libraries as well.
2015-02-11 21:34 GMT+01:00 Marius Kintel marius@kintel.net:
On Feb 11, 2015, at 14:46 PM, Peter Falke <
stempeldergeschichte@googlemail.com> wrote:
In my simple understanding of programming, only a simple pre-execution
of the code is needed, that ignores all geometrical calculation and just
generates an intermediate code were every occurrence of a reassigned
variable is overwritten with its explicit value at that time.
Preprocessing might be the logical way to do it.
One way to think about it is that you want to turn this:
a=1;
a=a+1;
a=a+1;
myshape(a);
into:
assign(a=1)
assign(a=a+1)
assign(a=a+1)
sphere(a);
..where the latter is correct OpenSCAD syntax.
While this is perfectly doable, keep in mind that one of the reasons for
not changing this behavior is that cmd-line overrides using -D needs to be
resolved properly, preferably in a backwards-compatible way.
-Marius
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!
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
You are starting to get into the territory of "shouldn't someone just use
solid python instead", imho.
On Feb 11, 2015 3:30 PM, "Peter Falke" stempeldergeschichte@googlemail.com
wrote:
One solution for -D cmd-line would be to assign the first occurrence of
the variable to the -D parameter.
One has to think about the reassignment by libraries as well.
2015-02-11 21:34 GMT+01:00 Marius Kintel marius@kintel.net:
On Feb 11, 2015, at 14:46 PM, Peter Falke <
stempeldergeschichte@googlemail.com> wrote:
In my simple understanding of programming, only a simple pre-execution
of the code is needed, that ignores all geometrical calculation and just
generates an intermediate code were every occurrence of a reassigned
variable is overwritten with its explicit value at that time.
Preprocessing might be the logical way to do it.
One way to think about it is that you want to turn this:
a=1;
a=a+1;
a=a+1;
myshape(a);
into:
assign(a=1)
assign(a=a+1)
assign(a=a+1)
sphere(a);
..where the latter is correct OpenSCAD syntax.
While this is perfectly doable, keep in mind that one of the reasons for
not changing this behavior is that cmd-line overrides using -D needs to be
resolved properly, preferably in a backwards-compatible way.
-Marius
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!
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Once it looks like you can do x=x+1, then you will want
if (expr)
x=x+1;
else
x=x+2;
cube(x);
Unless specifically shown otherwise above, my contribution is in the Public Domain; To the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. This work is published globally via the internet. :) Inclusion of works of previous authors is not included in the above.
View this message in context: http://forum.openscad.org/What-are-the-steps-needed-to-make-reassignments-of-variables-possible-tp11611p11618.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
On Wed, 11 Feb 2015 16:34:45 -0600
Joseph Lenox lenox.joseph@gmail.com wrote:
Perhaps it is too soon to consider some form of automatic namespacing?
Like if a is included from b.scad, you can refer to it directly as
b:a?
Includes from includes could either be part of the last include's
namespace or the file they came from. So if c defines a and b
includes c and the user has included b, either still b:a or b:c:a. I
am less enamored of the second as it implies a lot more coupling to
libraries.
Obviously a namespace block would be useful as well.
This, I think is a useful balance between library name collisions and
compatibility with existing libs.
Overrides with -D are still pretty dirty (but entirely in keeping
with the syntax restrictions to its loose cousin, the c preprocessor)
But it really makes generating multiple prints from one file easy with
the command line version.
I have many designs with multiple STL files generated from one design
via a "plate" constant/variable. I reset on the command line to
generate the one I want. (From a Makefile, if you want to realize just
how much of a programmer I am.<shrug/>)
Not allowing the -D option would really make for a messier workflow, or
a bunch of small files that do the equivalent.
Just my 2 cents.
G. Wade
On Feb 11, 2015 3:30 PM, "Peter Falke"
stempeldergeschichte@googlemail.com wrote:
One solution for -D cmd-line would be to assign the first
occurrence of the variable to the -D parameter.
One has to think about the reassignment by libraries as well.
2015-02-11 21:34 GMT+01:00 Marius Kintel marius@kintel.net:
On Feb 11, 2015, at 14:46 PM, Peter Falke <
stempeldergeschichte@googlemail.com> wrote:
In my simple understanding of programming, only a simple
pre-execution
of the code is needed, that ignores all geometrical calculation
and just generates an intermediate code were every occurrence of a
reassigned variable is overwritten with its explicit value at that
time.
Preprocessing might be the logical way to do it.
One way to think about it is that you want to turn this:
a=1;
a=a+1;
a=a+1;
myshape(a);
into:
assign(a=1)
assign(a=a+1)
assign(a=a+1)
sphere(a);
..where the latter is correct OpenSCAD syntax.
While this is perfectly doable, keep in mind that one of the
reasons for not changing this behavior is that cmd-line overrides
using -D needs to be resolved properly, preferably in a
backwards-compatible way.
-Marius
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!
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
--
Why do your people ask if someone's ready right before you are going to
do something massively unwise? -- Delenn - "The War without End"
Perhaps I'm missing something, but I don't really get the need for
variable re-assignment, and it seems that it would break the functional
nature of the OpenSCAD language.
Variable mutation basically means that OpenSCAD would no longer be a
tree-description language and would become an imperative language that
has functions to build a geometry tree (see Josheph's comment about
geometric python).
When these requests come up, I would suggest referring people to
documentation about functional languages and focus the effort on making
OpenSCAD a better functional language, as opposed to making a chimera
that might make some folks happy in the short-term.
MichaelAtOz mailto:oz.at.michael@gmail.com
February 11, 2015 at 15:10
Once it looks like you can do x=x+1, then you will want
if (expr)
x=x+1;
else
x=x+2;
cube(x);
Unless specifically shown otherwise above, my contribution is in the
Public Domain; To the extent possible under law, I have waived all
copyright and related or neighbouring rights to this work. This work
is published globally via the internet. :) Inclusion of works of
previous authors is not included in the above.
View this message in context:
http://forum.openscad.org/What-are-the-steps-needed-to-make-reassignments-of-variables-possible-tp11611p11618.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
Joseph Lenox mailto:lenox.joseph@gmail.com
February 11, 2015 at 14:36
You are starting to get into the territory of "shouldn't someone just
use solid python instead", imho.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Peter Falke mailto:stempeldergeschichte@googlemail.com
February 11, 2015 at 13:30
One solution for -D cmd-line would be to assign the first occurrence
of the variable to the -D parameter.
One has to think about the reassignment by libraries as well.
--
stempeldergeschichte@googlemail.com mailto: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!
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Marius Kintel mailto:marius@kintel.net
February 11, 2015 at 12:34
Preprocessing might be the logical way to do it.
One way to think about it is that you want to turn this:
a=1;
a=a+1;
a=a+1;
myshape(a);
into:
assign(a=1)
assign(a=a+1)
assign(a=a+1)
sphere(a);
..where the latter is correct OpenSCAD syntax.
While this is perfectly doable, keep in mind that one of the reasons
for not changing this behavior is that cmd-line overrides using -D
needs to be resolved properly, preferably in a backwards-compatible way.
-Marius
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Peter Falke mailto:stempeldergeschichte@googlemail.com
February 11, 2015 at 11:46
The wish for reassigning variables comes again and again.
And apart from the discussion weather or not reassignment is needed or
not I would like to think about what the necessary steps would be to
make it happen.
In my simple understanding of programming, only a simple pre-execution
of the code is needed, that ignores all geometrical calculation and
just generates an intermediate code were every occurrence of a
reassigned variable is overwritten with its explicit value at that time.
--
stempeldergeschichte@googlemail.com mailto: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!
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Even Lisp, the canonical functional language has SETQ.
--
View this message in context: http://forum.openscad.org/What-are-the-steps-needed-to-make-reassignments-of-variables-possible-tp11611p11621.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Well general purpose programming languages need to be able to remember and
manipulate state for a lot of applications but a description of a 3D object
is not one of them.
On 12 February 2015 at 01:04, Michele denber@mindspring.com wrote:
Even Lisp, the canonical functional language has SETQ.
--
View this message in context:
http://forum.openscad.org/What-are-the-steps-needed-to-make-reassignments-of-variables-possible-tp11611p11621.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