[fpc-pascal] TP compatibility: procedural type

Anton Shepelev anton.txt at gmail.com
Tue Aug 29 14:25:58 CEST 2017


Karoly Balogh to Anton Shepelev:

>>According  to Borland's official language guide to
>>Turbo Pascal 7.0,
>>
>>  To be used as procedural values, procedures and
>>  functions must be declared with a 'far' directive
>>  or compiled in the '{$F+}' state.
>>
>>whereas Free Pascal in -Mtp seems  to  accept  any
>>non-system  procedure  or function as a value of a
>>procedural type. Is it an instance of TP incompat-
>>ibilty or am I missing something?
>
>It's  documented,  that Free Pascal ignores far and
>near directives because they were for  16bit  code,
>and have no meaning in 32bit or 64bit code:
>
>  https://www.freepascal.org/docs-html/user/usersu82.html
>
>Therefore  it's  logical that the compiler also ig-
>nores their absence.

Ignoring them in the sense of not affecting the gen-
erated machine code is perfectly OK, but not requir-
ing their presence in the source, to make  the  pro-
gram  compilable  in  Turbo Pascal, seems wrong when
Free Pascal is in Turbo Pascal mode.  A program that
Free  Pascal compiles successfully in TP mode should
work with the actual Turbo Pascal compiler.   Is  it
not  the  purpose of these modes?  Do they guarranty
only forward-compatibility?

>Although this documentation should probably be  up-
>dated,  because  we now support some 16bit and 8bit
>systems as well.

There is more to correct, e.g.:

  In Free Pascal, you need to use the address @ opera-
  tor when assigning procedural variables.

This is not true of TP mode.

>But  I'm  pretty sure you can find a bunch of other
>things, which FPC allows even in TP  mode,  but  TP
>disallows/doesn't  support, just because the amount
>of extra features in  the  language  since  TP  was
>out...

I  think such features should be available in Delphi
and FPC modes, but not in TP, which should implement
and  enforce  Pascal  in exactly the way it was sup-
ported in the historical Turbo Pascal compiler.

-- 
Please, do not forward replies to the list to my e-mail.




More information about the fpc-pascal mailing list