Previous: , Up: Interpreters And This Library   [Index]


4.2.9 Type Oblivious Interfaces

Every so often data needs to be moved around, transferred from routine to routine, store with and retrieved from a data structure in a type oblivious fashion.

Such requirement is particularly meaningful for a procedural programming system, where routines are at the center of interface definition. Data is transferred through a interface via routine parameters and returns, and typed accordingly. Most of the times, interfaces command specific types. Sometimes, like when the interfaces act as data transport ones, they should apply to data of every type. It it thus favorable to allow for routine parameters and returns of undertermined or all describing types.

Type oblivious data transfer may not be allowed to break the type safe data access, and that requires type information. Either stored with the data, either transferred with it.

Storing type information with data makes data heavy. When storing data in heterogenous data structures there is no way around to storing the type information. When transferring data through typed interfaces (such as variables and function) there is no need to record type information with the data, but the same does not apply to type generic interfaces.

Since most aime data transfers are meant typed, type information is not typically stored with data, but transferred with it by the interfaces that are type oblivious.

The latter appear in aime as a specialization of implicit conversion mechanism.

See Implicit Conversions.

The mechanism allows for automatically changing data type when passing data as function argument. The transfer data in a type oblivious fashion is to box data, to encapsulate it in a small, single slot container. The container will record data type together with the data. A type generic function will refer the container type as the type of its type generic return or parameter.

Some of the alternatives to the interface typelessness described here are the use of variadic functions and functions with typeless arguments.

See Variadic Functions.

See Variadics.

See Typeless Arguments.

See Typeless Anonymous Arguments.


Previous: , Up: Interpreters And This Library   [Index]