[fpc-pascal] private type and type compatibility

Michael Van Canneyt michael at freepascal.org
Wed Oct 30 13:05:59 CET 2013

On Wed, 30 Oct 2013, Jonas Maebe wrote:

> On 30 Oct 2013, at 12:50, Michael Van Canneyt wrote:
>> On Wed, 30 Oct 2013, Jonas Maebe wrote:
>>> It can, as demonstrated by the example that started this thread. The type 
>>> identifier may not be visible, but entities that have this type can be. 
>>> Just like in the unit example.
>> You must admit that in the case of a function result type, that is a bit 
>> awkward, since you will never be able to declare a properly typed variable 
>> to hold the function result. In the case of a record or class type, that is 
>> particularly awkward since you will be forced to use a "with" to access the 
>> various fields.
> Absolutely, but it's always been valid in TP/Delphi/FPC-style Pascal and 
> introducing a special rule would make the language less orthogonal.

I still think it is a different use case:

Like I said: in the case of an identifier from a different unit, the user just 
has to add it to her uses clause. Here this is simply impossible.

It is probably the reason why in the original TP manuals it stated that "adding 
a unit B to the interface section's uses clause of unit A makes identifiers in 
the interface section of unit B available to all code using unit A."


More information about the fpc-pascal mailing list