Next: The Non Referable Object, Up: Type Oblivious Interfaces [Index]
The libaime libraries admit an application defined type called ‘object’, for the purpose of enabling type oblivious interfaces.
See Data Type Definition.
The type is more of an application defined type, in the sense that it holds little special status with the aime interpreters.
See Symbolic Types.
The type is a non declarable one, i.e. programs may not declare local variables of such type, only function returns and parameters. The limitation allows it to be lighter weight and less expensive to create and destroy than a fully declarable type would have been.
Convertions between the ‘object’ type and the other data types is achievable via the implicit conversions mechanism.
See Implicit Conversions.
The mechanism applies for function parameters and returns only. Synthetic data types, such as function pointer types, qualifies for conversion as well.
Both aime and C defined functions may return ‘object’ data and may have ‘object’ parameters.
Considering one:
object f1(object o)
function, it will be allowed to call the function with data of every type:
f1(3); f1(.125); f1("one string");
even with function pointer data:
f1(cos); f1(f1);
The return of the function will only be usable as a function parameter. Statements as:
a = cos(f1(2)); echo(f1(sin)); a = integer(f1(3)); __real(f1(-77)) / 2;
will be allowed, and:
a = f1(3); f1(abs) / 2;
will not.