[OpenSCAD] Proposal for extensions to the OpenSCAD syntax

Torsten Paul Torsten.Paul at gmx.de
Mon Oct 28 13:54:56 EDT 2019

On 28.10.19 05:24, Hugo Jackson wrote:
> valueC = foo(offset = 7).valueA + foo(offset = 7).myFunc(valueB) …
> or literally valueC = foo(7).valueA + foot(7).myFunc(valueB)
> Perhaps that would lead to a preponderance of code that would
> only serve to make code look more tortuous than it already does.
> Yet I think the proposed ‘dot’ syntax would lead to more
> insightful coding that would tend to mitigate the damage that
> might occur.

I guess that would make it also impossible to change, so
that's not a good solution.

That does not mean the 'dot' syntax can't be used though.
It simply means we need to find a way to access the
instantiated modules and functions, not the declaration.

The incomplete/proposed object literals would allow that
this way with functions:

o = {
    var = 3;
    func = function(x) x + var;

Now we have a nested structure named o which has both a
variable 'var' and a function 'func'.

Accessing both can go via the common 'dot' notation:

echo(o.var); // ECHO: 3
echo(o.func(5)); // ECHO: 8

and that works just as expected when passing this thing
called 'o' to a module:

module mod(thing) {


The current struggle is how to fit modules and therefor
the geometry generation into that design.


More information about the Discuss mailing list