DOMINIQUE THILLAUD wrote:
[snip]
- export problem
If I construct a module to implement an abstract type such that rational numbers, how export operators ? Writing : export rationals = (rational, +, -, *, /) ; give me a parse error before '+' (trying to enclose + between ' ' or " " is useless)
Extended Pascal's export-part is based on identifier spellings only which doesn't really work well with the PASCAL SC operator overloading extension which is based on operator symbols and operand type signatures. Since +, -, *, and / are operator symbols and not identifiers, there is no explicit identifier spelling for overloaded operators available for usage in an explicit export-list.
GPC does have an export all extension which doesn't require explicit lists of identifier spellings which implicitly imcludes everthing defined in the interface-part/module-heading in the exported interface. Thus:
export rationals = all;
will, I think, implicitly include interface defined operators (e.g. +, -, etc.) in the exported rationals interface.
Internally, GPC creates mangled function names for user defined/overloaded operators. The mangling scheme is based, I think, on a textual spelling of the operator symbol (e.g., PLUS for +) and the operand parameter type identifier(s). If one absolutely needs more control over what's included in an exported interface than what export all provides, determining what an operator's mangled function name is and then using the mangled name in the export-list might work. (I haven't tried this.) I wouldn't try to make use of this, though, unless you deparately must have something more selective than export all since it ties your code to changeable internal compiler details, is error prone, and has a lot of negative code maintenance implications.
Gale Paeper gpaeper@empirenet.com