On 12 Jan 2005 at 14:36, Adriaan van Os wrote:
Waldek Hebisch wrote:
Adriaan van Os wrote:
There is another problem, probably related to qualified identifiers.
In the GNU Pascal Interfaces for Mac OS X, based on Apple's PInterfaces, we have a unit CGError. It defines a type CGError (a signed 32-bit integer).
unit CGError; interface .... uses MacTypes,CGBase; .... type CGError = SInt32;
We probably should warn here that the type will usually be shadowed by unit name.
Another unit uses both the type and the unit CGError:
unit CGDirectDisplay; interface .... uses MacTypes,CGBase,CGGeometry,CGError,CFArray,CFString,CFDictionary; .... --> type CGDisplayErr = CGError;
This results in an error message
cgdirectdisplay.pas:89: error: type name expected, `CGError' given
I do not not how Apple Pascal behaved, but in most Pascal dialects the code above is considered incorrect. Namely, in qualified identifiers unit names can appear in the same places where records can appear. Logically (unles one uses some _very_ strange overloading) unit names conflict with ordinary identifiers. For Borland compatibility GPC does not signal error when unit `CGError' is defined or used, but only when one tries to use `CGError' defined in the unit. Similar problems appeared in GPC standard units and is now fixed by renaming units.
Is the unit name (`CGError') part of established interface? Would renaming the unit cause serious problems?
It is part of established interface, so renaming the unit breaks compatibilty. For any change we make, we have to think twice. Also, there are similar problems in other units.
The parser accepts
type CGDisplayErr = CGError.CGError;
so, why shouldn't it accept
type CGDisplayErr = CGError;
Because there are two CGError's. Which of them is being referred to?
Best regards, The Chief --------- Prof. Abimbola Olowofoyeku (The African Chief) Web: http://www.greatchief.plus.com/