---------------------------------------------------------------------- HP ELOQUENCE A.06.00 Fixpack 2 User defined types Revision: 97-11-06 ---------------------------------------------------------------------- This document describes the new behaviour of user defined types with HP Eloquence A.06.00. The behaviour has been changed after the initial release and the new semantics are incorporated into A.06.00 fixpack 2. In addition some issues are clarified. 1. Exporting types Type definitions can be "exported" to lower calling levels. This is done with the new EXPORT TYPE keyword: TYPE Tname [EXTENDS Tbase] EXPORT TYPE Tname [EXTENDS Tbase] IN DATA SET ... DEFINE TYPE Tname [EXTENDS Tbase] IN DATA SET ... EXPORT TYPE Tname [EXTENDS Tbase] By default a type definition is local to the current segment. This is also true for types defined in the main segment. Therefore, types used in COM statements must be "exported" in order to be usable in a subprogram. Otherwise a runtime error message will be issued. Please note: This is a behaviour change. Initially, all types defined in the main segement were global. 2. Type scope A type definition is local by default and is only visible within the local segment. When a type is "exported" it becomes visible to subsequently called levels. When a segment defines a type with a name which has been exported from a higher level, it will temporarily replace the exported type in the current function or subroutine. When a segment defines and EXPORTs a type with a name which has been exported from a higher level, the newly exported type permanently replaces the former type for all subsequently called lower level segments. If the type which is most recently defined is not EXPORTed, the previously exported type again becomes available to lower called segments. 3. Passing STRUCTs as an argument A STRUCT can be passed to a subprogram or function in two manners: - When no type is specified in the SUBprogram or function definition, the struct is passed "anonymously" as an argument. Any type is valid and no validation is performed on the argument. RTTI (TYPEOF$, IS A) can be used to operate on it. - When a type is specified in the SUBprogram or function definition, only variables of the given (or derived) type are accepted, else a runtime error 8 is issued. The type must have been exported previously. For example: CALL X(STRUCT X) SUB X(STRUCT Any) ! Anonymous CALL Y(STRUCT X) SUB Y(STRUCT Known:Tknown) ! Passed value must be of type Tknown ! or derived from it. Tknown must have ! been definined previously Please note: This is a behaviour change. Initially, arguments were checked, when a subprogram or function was called from the main segment. Otherwise no validation was performed. 4. New error message 905 - No such member variable This new runtime error occurs, whenever a specified member variable cannot be found. Previously this did result in error 900 which could be confusing.