Next: , Previous: Of The Intrinsic String Type, Up: Interpreters And This Library

3.2.2 Data Type Definition

Opaque application data types are features of the interpreted languages. Such types have unique id-s, pointer (void *) C representations and are treated not so specially by language.

See Application Defined Types.

And the application defined types would not be treated too specially by the interpreter, the application side of it that is, if it wouldn't come to declare variables of such types.

To begin, the list of allowed declarable types, including for each item the type name and type id is to be linked into the parsing context (the one provided to the application extention programming language parser).

Yet, the reason for which application data types exists (instead perhaps of having a single type for all application data) is that the application would presumably very much like not to mix data of different types. Such, if an application invents two types, say opened files and associative arrays, it would like to be assured that the functions processing opened files will not be passed data of the associative array type and conversely, the functions processing associative arrays will not be passed data of the opened file type.

And the AEPL interpreter do this seamlessly once variables have values. Only thing remaining would be to proper initialize data of such application types with whatever initial values are appropriate.

For sure, an application should be quite able to insure that once a resource associate with some data of one of the application defined types has been allocated, it gets deallocated at some point (perhaps when interpreted program completes execution). Such resource management, although fairly straightforward, would joyfully be defaulted by the application to whichever would do it instead. And there are extra reasons for why the interpreters should manage allocated resorces (insure that they are deallocated that is) and not the application: the interpreters keep track of the application defined types data anyhow, they are better able to detect when one variable is no longer in use (for an instance, when its declaration scope expires) and just as well because, although straightforward, such management requires processing and memory for bookkeeping.

See Execution Completion Cleanup.

Such, the data type definition allows for specifying methods for initializing and finalizing data of application defined types.

See struct x1f4_datatype_type.