Eh, what's the "profound difference" between a variable and a parameter or
argument? Certainly the "emphatic" difference is not supported by a bit of
poking around.
From wikipedia, for example:
In mathematics https://en.wikipedia.org/wiki/Mathematics, an argument
of a function https://en.wikipedia.org/wiki/Function_(mathematics) is a
value provided to obtain the function's result. It is also called an
independent
variable https://en.wikipedia.org/wiki/Dependent_and_independent_variables
.
Google's AI overview says: "a function's argument is essentially a type of
variable"
In other words, an argument or parameter is just a specific kind of
variable, not some completely different beast. The question really to be
posed with regards to documentation is whether using a bizarre nonstandard
term is likely to increase or decrease confusion. If I jump to some random
part of the docs and see this term, am I going to think WTF? Am I going to
know what it means? What kind of confusion will be created? I think using
some newly invented, unique and nonstandard term also bring the possibility
of confusion.
My suspicion is also that the expectation new users will have around
variables, or things that look like variables, are not easily fought by
simply changing the language that is used in passing. Ultimately,
regardless of what wonky term might be chosen in the docs, they are still
in fact variables in the way that that term is used broadly. It seems like
hyperlinking every use of "variable" to an article entitled "Why can't I
write x=x+1" is going to be more useful than choosing a mystifying term.
Turn it around: suppose a user wants to learn how variables work in
OpenSCAD. What should that user search for? How will they know to look
for "immutable constant handles" or something?
On Sat, Nov 22, 2025 at 10:24 AM Lee DeRaud via Discuss <
discuss@lists.openscad.org> wrote:
In most (all?) languages that use functions/subroutines/modules/whatever,
the ‘x’ in ‘f(x)’ is emphatically NOT a “variable”: it’s an “argument”.
Even in OpenSCAD, there’s a profound difference.
From: Father Horton via Discuss discuss@lists.openscad.org
Sent: Saturday, November 22, 2025 6:48 AM
To: OpenSCAD general discussion Mailing-list <discuss@lists.openscad.org
Cc: Father Horton fatherhorton@gmail.com
Subject: [OpenSCAD] Re: The term "variables"
That said, if there is a term in computer science or some natural language
which succinctly and efficiently conveys the above meaning, I'd be glad to
know of it, and I think a powerful argument could be made for using it in
this context.
There is. That term is "variable".
OpenSCAD is basically a functional language, so it thinks in terms of
functions. If I have a function f(x), what is “x”? It’s a variable — it can
take different values each time the function is called. Yes, at the global
level OpenSCAD treats things differently, but if we start calling “x” one
thing in global scope and something else in a function, even though we use
it the same way in expressions, that just makes the terminology more
confusing, not less.
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
I believe that discussions such as:
https://www.reddit.com/r/openscad/comments/11usftq/how_to_learn_openscad_language_intricacies_ie/
https://stackoverflow.com/questions/68960320/openscad-variable-not-accumulating
https://rasterweb.net/raster/2023/02/20/openscad-local-modules-variables/
should inform this.
My inclination, if there isn't some better term would be to just use "variable", and at the first usage on every page, footnote it with something along the lines of:
1 - variables in OpenSCAD may only have one value for a given scope, and the last declared value will be used for that entire scope.
William
It's interesting to note from the third example that the poster was
confused by being told that you can't change the values of variables into
thinking that you can't even reuse the same variable in a module. This
shows a potential confusion from using terminology that aggressively
declares openscad variables as constant.
On Sat, Nov 22, 2025 at 11:29 AM William F. Adams willadams@aol.com wrote:
I believe that discussions such as:
https://www.reddit.com/r/openscad/comments/11usftq/how_to_learn_openscad_language_intricacies_ie/
https://stackoverflow.com/questions/68960320/openscad-variable-not-accumulating
https://rasterweb.net/raster/2023/02/20/openscad-local-modules-variables/
should inform this.
My inclination, if there isn't some better term would be to just use
"variable", and at the first usage on every page, footnote it with
something along the lines of:
1 - variables in OpenSCAD may only have one value for a given scope, and
the last declared value will be used for that entire scope.
William
I'm not always good with words, so please excuse me if I say this wrong, but I think in OpenSCAD what the best term for a named value depends on it's scope & how it is declared. Because (even with the new object() function) OpenSCAD is not truly an object-oriented language, re-declaring a variable (or whatever we call them) gives a warning. And as stated by others, sometimes it's value depends on when or in what scope it is used (functions, loop iteration variables, recursion). It would probably be very bad programming practice, but there are ways to write some types of nested loops and other parts of code that use the same name in ways that are valid but would make things much more confusing than necessary. OpenSCAD is not a full-fledged programming language, and most users know that, because it was not intended to be. Even when using multiple files (use vs include) where something is located is part of what determines it's value. Another thing that makes variables (or whatever we are calling them) different from other languages is when it called, even if you are not attempting to create any shapes with it yet, just trying to use it as part of assigning a value to another variable during declaration could cause an undefined error. Is variable an appropriate term for OpenSCAD? I'll admit that it took me several days, but once somebody explained to me that OpenSCAD used immutable & non-reference values like all the languages they nailed into me in college, it was not hard, so I think that what term you use in discussions & forums (like these) shouldn't usually matter.
Nathan Sokalski
njsokalski@hotmail.commailto:njsokalski@hotmail.com
From: Adrian Mariano via Discuss discuss@lists.openscad.org
Sent: Saturday, November 22, 2025 7:58 AM
To: OpenSCAD general discussion Mailing-list discuss@lists.openscad.org
Cc: Adrian Mariano avm4@cornell.edu
Subject: [OpenSCAD] Re: The term "variables"
Another observation here is that the value of "x" in an OpenSCAD program does in fact vary. It's not the same in every program, nor in every scope of a single program. Also you have the option of running your program with "x" set to a different value, so its value does in fact potentially vary from program invocation to program invocation. In contrast, you don't generally change the value of PI. In mathematics the term "variable" is used for values that do not change during a particular analysis or calculation. It's considered bad practice in a mathematical paper to reassign a variable to a different value. We still call them variables. The term constant is generally reserved for values like pi that fundamentally do not change.
That said, I don't know what the implications are for the best documentation. There's also the question of how you would get new people to actually read the documentation section that goes over this topic. I'd think that is really the question. If you have a documentation heading like "You can't (usually) write x=x+1" that might attract people's attention, for example. Most users are not going to read this documentation; they'll just try to write x=x+1 and get confused with it doesn't behave as expected.
But if you lean too hard into the "constant" idea then code like:
module foo(x)
{
x=abs(x);
....
}
becomes kind of puzzling. I write code with this form all the time while handling arguments.
There's also
function foo(x) =
let(x=2x)
let(x=2x)
let(x=2*x)
x;
in which 4 values of x exist. So is x an immutable constant? Looks kind of variable to me. You have to get very technical about scopes and build up this idea that there are 4 different "x" values with the same label that are somehow still different objects in order to preserve the concept of immutability. That's technically correct, but that's not how I think about code like this intuitively, nor do I feel that the full technical conception has much advantage over the simpler intuitive one.
On Sat, Nov 22, 2025 at 7:14 AM Jon Bondy via Discuss <discuss@lists.openscad.orgmailto:discuss@lists.openscad.org> wrote:
If those working in functional programming choose to call immutable values "variables", that is unfathomable and incorrect, but I don't think we need to adopt or encourage that misleading nomenclature.
I agree that SOME of the named values that we use are actually variables, while most of them are immutable. This, of course, only adds to the confusion. We could attempt to manage this in the documentation by specifically calling THOSE values "variables", and noting the difference. I assume that none of the proposed language changes will create actual variables, but I could be wrong.
The term "named constant", however awkward, seems to capture how OpenSCAD works, and does not require a knowledge of C or Pascal or Modula2, all of which have "const"s.
If we keep writing documentation referring to named constants as if they were variables, then we should not be surprised by on ongoing confusion by new adapters, and perhaps by some who give up on OpenSCAD because of their confusion and frustration. If that is an acceptable penalty to pay for the simplicity of the term "variable", then let's proceed with no change
Jon
On 11/22/2025 1:33 AM, Jordan Brown via Discuss wrote:
On 11/21/2025 6:40 PM, Father Horton via Discuss wrote:
In functional programming, they’re called variables, despite their immutability. I think we are stuck with the term.
Perhaps more importantly, different runs through the same snippet of the program may have different values for the same name.
for (i = [0:10]) echo(i);
function inc(j) = j + 1;
module kube(k) cube(k);
Are i, j, and k variables or constants?
(OpenSCAD behavior actually aligns with the C/C++ "const" modifier, but I think that expecting OpenSCAD users to be familiar with C or C++ is a stretch.)
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.orgmailto:discuss-leave@lists.openscad.org
[https://s-install.avcdn.net/ipm/preview/icons/icon-envelope-tick-green-avg-v1.png]http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient Virus-free.www.avg.comhttp://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.orgmailto:discuss-leave@lists.openscad.org
XSLT has things you can assign values to but can't reassign. They're called
"variables". (When I was trying to learn XSLT, I found a free book on
Amazon written by someone who was doing his best to use it as a procedural
language. He almost succeeded.)
Haskell has things you can assign values to but can't reassign. They're
called "variables".
Erlang has things you can assign values to but can't reassign. They're
called "variables."
Etc. for any language that uses the functional paradigm.
So OpenSCAD can invent a name that no one else in the computer world is
using, or use the term "variable" like everyone else does for this, at the
cost of some initial confusion.
I think that the term "variable" is imperfect for OpenSCAD (especially
given the larger context of programming languages), but it's the
least-wrong word available.
I agree.
On Sat, Nov 22, 2025 at 7:45 PM Jordan Brown openscad@jordan.maileater.net
wrote:
I think that the term "variable" is imperfect for OpenSCAD (especially
given the larger context of programming languages), but it's the
least-wrong word available.
Call them "immutables" to indicate they are not subject to variation.
On 2025-11-23 02:44, Jordan Brown via Discuss wrote:
I think that the term "variable" is imperfect for OpenSCAD (especially
given the larger context of programming languages), but it's the
least-wrong word available.
On Sat, Nov 22, 2025 at 12:52 PM Father Horton via Discuss
discuss@lists.openscad.org wrote:
XSLT has things you can assign values to but can't reassign. They're called "variables". (When I was trying to learn XSLT, I found a free book on Amazon written by someone who was doing his best to use it as a procedural language. He almost succeeded.)
Haskell has things you can assign values to but can't reassign. They're called "variables".
Erlang has things you can assign values to but can't reassign. They're called "variables."
Etc. for any language that uses the functional paradigm.
So OpenSCAD can invent a name that no one else in the computer world is using, or use the term "variable" like everyone else does for this, at the cost of some initial confusion.
People who don't know XSLT, Haskell, Erlang, etc. won't care. People
who do know, are likely knowledgeable enough to quickly figure the
similarities out.
(I've always hated getting books or other documentation on new
languages or applications that start out by telling you how much
better they are than language X or application Y, but in order to
learn to use the next great language or application, you must first
learn the language or application that this new great thing is
replacing, because all of the documentation is written based on the
assumption you know the older, lesser software thoroughly, not merely
having a passing familiarity with it.)
OpenSCAD is NOT a programming language... It is a Hardware Definition
Language. It took me a while to get that, but once it did, things made a
LOT more sense.
Of course, if you don't really know how an HDL is different from software,
that doesn't help.
On Sun, Nov 23, 2025 at 7:27 AM Carsten Arnholm via Discuss <
discuss@lists.openscad.org> wrote:
Call them "immutables" to indicate they are not subject to variation.
On 2025-11-23 02:44, Jordan Brown via Discuss wrote:
I think that the term "variable" is imperfect for OpenSCAD (especially
given the larger context of programming languages), but it's the
least-wrong word available.
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org