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.
I really think we should use 'constant' or some equally descriptive term.
(define value? like #define)?
Bite the bullet, this keeps coming up so often...
But we need to clarify the iterative list comprehension/recursion in
expressions, v's the for() loops/if() in geometry... I think we are
having/approaching a clash of terminology of module geometry instantiation
v's expression evaluation.
Let the battle begin....
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/A-A-1-tp11385p11388.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
MichaelAtOz wrote
I really think we should use 'constant' or some equally descriptive term.
(define value? like #define)?
Bite the bullet, this keeps coming up so often...
But we need to clarify the iterative list comprehension/recursion in
expressions, v's the for() loops/if() in geometry... I think we are
having/approaching a clash of terminology of module geometry instantiation
v's expression evaluation.
Let the battle begin....
Yes we have been over this before
http://forum.openscad.org/Plans-to-change-variable-behavior-td9647.html#a9663
more than once
http://forum.openscad.org/Assignment-semantics-td7913.html#a7999 .
Once you grok OpenSCAD it all makes sense.
Unless I see objections, I will start a project to change the wiki to use
'identifier', 'definition', 'constant' and 're-definable' as needed, and
point out the -D rationale. [eventually...]
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/A-A-1-tp11385p11424.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
MichaelAtOz wrote
Unless I see objections, I will start a project to change the wiki to use
'identifier', 'definition', 'constant' and 're-definable' as needed, and
point out the -D rationale. [eventually...]
You have my objection. They are variables in the mathematical sense. A
symbol that represents a quantity in a mathematical expression.
http://en.wikipedia.org/wiki/Variable
Variable (mathematics), a symbol that represents a quantity in a
mathematical expression, as used in many sciences
Variable (computer science), a symbolic name associated with a value and
whose associated value may be changed
--
View this message in context: http://forum.openscad.org/A-A-1-tp11385p11425.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
I'm comfortable with calling them variables, but I suppose they could be
called parameters instead. The wikipedia definition suggests that
"parameter" might be appropriate in a mathematical sense:
http://en.wikipedia.org/wiki/Parameter#Mathematical_functions
"Mathematical functions have one or more arguments that are designated in
the definition by variables. A function definition can also contain
parameters, but unlike variables, parameters are not listed among the
arguments that the function takes. When parameters are present, the
definition actually defines a whole family of functions, one for every valid
set of values of the parameters."
The Variable wikipedia page defines parameters as a subclass of variables:
http://en.wikipedia.org/wiki/Variable_%28mathematics%29#Specific_kinds_of_variables
"To distinguish them, the variable x is called a unknown, and the other
variables are called parameters or coefficients, or sometimes constants,
although this last terminology is incorrect for an equation and should be
reserved for the function defined by the left-hand side of this equation."
It also works well with calling OpenSCAD files "parametric designs".
However, "parameters" and "unknowns" are indistinguishable in code (and in a
formula, for that matter), which would make explaining the difference a
little bit more difficult to a naive person: unknowns appear in the argument
list of the function.
--
View this message in context: http://forum.openscad.org/A-A-1-tp11385p11426.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
The "constants" that are used in OpenSCAD cannot be changed, so they are
not "variable" or "variables".
These discussions about "variables" come up once a month. They consume
time. And they frustrate many people away from OpenSCAD (I assume that
for every newbie who persists in asking questions here, a dozen simply
give up and wander off).
In my opinion, the OpenSCAD community needs to explain the language in a
way that is accessible to the average programmer (think "C" rather than
"declarative") without many newbies having to re-invent the variable
wheel. The discussion around OpenSCAD " variables" in the
manual/documentation needs to include the meat of the discussions that
we have on a regular basis with newbies.
Jon
On 2/3/2015 6:36 PM, Bananapeel wrote:
MichaelAtOz wrote
Unless I see objections, I will start a project to change the wiki to use
'identifier', 'definition', 'constant' and 're-definable' as needed, and
point out the -D rationale. [eventually...]
You have my objection. They are variables in the mathematical sense. A
symbol that represents a quantity in a mathematical expression.
http://en.wikipedia.org/wiki/Variable
Variable (mathematics), a symbol that represents a quantity in a
mathematical expression, as used in many sciences
Variable (computer science), a symbolic name associated with a value and
whose associated value may be changed
--
View this message in context: http://forum.openscad.org/A-A-1-tp11385p11425.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
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2015.0.5646 / Virus Database: 4281/9052 - Release Date: 02/03/15
/"You have my objection. They are variables in the mathematical sense. A
symbol that represents a quantity in a mathematical expression."/
I agree with Mr. Peel and cast my vote similarly.
--
View this message in context: http://forum.openscad.org/A-A-1-tp11385p11429.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Yes, but using the mathematical definition contributed to this problem.
To the layperson variable usually implies, in this context, a programming
variable. While that person is also wrong, I think it is pragmatic to avoid
confusion in the users if it is inexpensive to do so.
On Feb 3, 2015 6:59 PM, "Michele" denber@mindspring.com wrote:
/"You have my objection. They are variables in the mathematical sense. A
symbol that represents a quantity in a mathematical expression."/
I agree with Mr. Peel and cast my vote similarly.
--
View this message in context:
http://forum.openscad.org/A-A-1-tp11385p11429.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
Every other language without destructive update operator (c-style assign)
calls them variables, I don't see why OpenSCAD should be different.
They aren't "constant", because a constant is a value that never changes.
function square(s) = s*s;
b = 6;
a = square(b);
The variable a's value isn't constant - it changes according to the value of
b.
What's really needed is:
Have a nice day,
Bananapeel :)
--
View this message in context: http://forum.openscad.org/A-A-1-tp11385p11436.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Hmm, I am no expert, but in your example below, 'a' is not varying, it
is constant - it gets calculated once and set up for use.
It would only be a variable if it varies during the program run, eg if
'b' changes at certain points in time....but openscad never 'runs' it
just puts the STL together, and 'b' is always the same.
On 04/02/2015 13:03, Bananapeel wrote:
Every other language without destructive update operator (c-style assign)
calls them variables, I don't see why OpenSCAD should be different.
They aren't "constant", because a constant is a value that never changes.
function square(s) = s*s;
b = 6;
a = square(b);
The variable a's value isn't constant - it changes according to the value of
b.
What's really needed is:
Have a nice day,
Bananapeel :)
--
View this message in context: http://forum.openscad.org/A-A-1-tp11385p11436.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