[fpc-pascal] private type and type compatibility

Jonas Maebe jonas.maebe at elis.ugent.be
Wed Oct 30 14:59:02 CET 2013


On 30 Oct 2013, at 14:49, Xiangrong Fang wrote:

> pascal is strong-typed.  You are actually using type along with its  
> value.
> e.g.
>
> var
>  a: array of Double;
> begin
>  a := obj.proc;​​
>
> This will emit a COMPILE time error because compiler know these 2  
> types are
> not compatible.

No, it does not cause an error. Pascal indeed does not use structural  
compatibility for record/object/class types (two record/object/class  
types with exactly the same fields are not assignment-compatible), but  
for other types such as integer/float types (because of implicit  
conversion) and arrays you have more "cross-type" compatibility.


Jonas


More information about the fpc-pascal mailing list