[OpenSCAD] Openscad Indirect Functions

Kuba Marek blue.cube at seznam.cz
Mon Oct 17 04:59:53 EDT 2016

> f = 6;
> function f(x) = 1;
> function call_indirect(func, x) = func(x);
> call_indirect(f); // is that the variable or function?

In my proposal this code would behave exactly as it does now and pass
the value 6.
If you wanted to pass the function, the example would have to look like

// f = 6; // With this line the next one would cause an error
f = function f(x) 1;

> To clarify which one is meant, we either have to use a
> unified namespace, or have the user declare explicitely
> which of the namespaces too choose from.

This is exactly what would be happening -- by using the lambda syntax
instead of the existing syntax you would be saying "this is a
variable with function as a value" instead of "this is a function"


More information about the Discuss mailing list