[fpc-pascal] private type and type compatibility

Michael Van Canneyt michael at freepascal.org
Wed Oct 30 13:20:39 CET 2013



On Wed, 30 Oct 2013, Jonas Maebe wrote:

>
> 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.

Yes, I understood it like that. 
I do think it is a design fault (see the remark about the TP manuals), 
but that is another issue.

Michael.



More information about the fpc-pascal mailing list