[OpenSCAD] Openscad Indirect Functions

arnholm at arnholm.org arnholm at arnholm.org
Tue Oct 11 04:20:17 EDT 2016

On 2016-10-10 23:57, otto wrote:
> That is very similar to what I have implemented and what I am
> proposing.  I am not familiar with AngelScript.  It looks like in
> AngelScript you declare that the argument "func" takes a function.

Yes, funcdef declares a pointer to function type. If FUNC is defined by 
'funcdef', you can declare a variable of type FUNC as a pointer to 
function, and assign it:   FUNC@ some_func = div3;

> The
> C/C++ like syntax of AngelScript doesn't really (IMHO) fit well with 
> the
> untyped and functional nature of OpenScad,

That may be true, but as you say these things are a matter of opinion. 
The strong typing in AngelScript is in my opinion an advantage (there 
are other advantages as well).

> but it is interesting to see
> another language using @ as an indirection indicator, although it
> appears (in AngelScript) in the argument list as a declaration of type
> instead of in the body as a declaration of indirection at call time.

True. I guess in untyped languages that's the only option you have.

> Is it possible for AngelScript to implement a function anonymously?
> It doesn't look like it from the posted code.

Yes, indeed it is possible. See quick example at

Carsten Arnholm

More information about the Discuss mailing list