[fpc-pascal] private type and type compatibility

Jonas Maebe jonas.maebe at elis.ugent.be
Wed Oct 30 13:13:44 CET 2013


On 30 Oct 2013, at 13:05, Michael Van Canneyt wrote:

> On Wed, 30 Oct 2013, Jonas Maebe wrote:
>
>> On 30 Oct 2013, at 12:50, Michael Van Canneyt wrote:
>>
>>> 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.

My point is that even without adding that other unit, you can still  
"consume" values that have this type even though the type declarations  
are not in scope. You can indeed not add them in the scope here, but  
they are still usable.


Jonas



More information about the fpc-pascal mailing list