7 The MLWorks Foreign Interface Library

7.6 The Object structure

A foreign object is an ML value which provides a means of both accessing and modifying foreign data from ML. Foreign objects are represented with the type object.

Foreign objects do not contain foreign data itself, but are instead associated with a location in a store object which contains foreign data. In short, a foreign object provides indirect access to foreign data, thus allowing objects to be freely copied or otherwise manipulated without replicating the foreign data itself. The disadvantage of this is that it permits many different objects to refer to the same foreign data, that is, it permits aliasing. An update to the foreign data through any one such object is an update that will be observed by all alias objects.

The requirements for representing foreign objects naturally differ depending on the foreign language being interfaced to. Some of the necessary features of, and possible operations upon, foreign objects will be the same whatever the foreign language.

However, foreign objects will probably have some language-specific aspects too. In particular, any notion of typing will be language specific. For this reason, the ML type that represents object objects is polymorphic, allowing for this dependence on language-specific aspects, such as typing.

The Object structure is, then, the generic implementation of foreign object representations and protocols.

As you will see below, there are several generic ways of inspecting a foreign object, but no (generic) ways of generating objects directly or modifying any existing characteristics they may have. The reason is that these are very much subject to the language-specific semantics of the appropriate data model. Accordingly, such operations are provided within the language-specific interfaces.

object
ReadOnly
WriteOnly
object_mode
objectMode
object_status
objectStatus
OutOfBounds
Currency
objectCurrency
objectSize
objectLocation
objectAddress

MLWorks Reference Manual (version 1.0) - 3 DEC 1996

Generated with Harlequin WebMaker