The main page of the manual:
http://en.wikibooks.org/wiki/OpenSCAD_User_Manual
refers to an openscad source file as a script. The word script makes it
sound iterative to me. Is there a better way to explain it?
"Anonymous scopes are not considered scopes":
{
angle = 45;
}
IMO this should be a separate scope, or give an error.
--
View this message in context: http://forum.openscad.org/A-A-1-tp11385p11439.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
In a functional programming language, a 'constant' is an expression
like '42' which always has the same value, in every run of the
program. A 'variable' is a named value that can have different values
in different runs of the program. Even if you have a top level
definition like
x = 0;
this can still vary, in OpenSCAD, because you can override the value
'0' in several ways, eg by invoking openscad with -Dx=1.
Like Bananapeel said, OpenSCAD is a functional programming language.
There are many others, such as Haskell, Ocaml, F#, ML, Erlang, and so
on. The word 'variable' is used in all of these languages to describe
what OpenSCAD calls a variable. And there isn't really a good
alternative to the word 'variable'. So we need to do what Bananapeel
said: fix the documentation and fix the error reporting so that
OpenSCAD can be more easily understood by people coming from an
imperative programming background.
On 4 February 2015 at 08:34, Richard Benjamin richard@digicalm.com wrote:
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