Search code examples
pascalfreepascal

Is Free Pascal a Programming language by itself? Or, just a compiler supporting Pascal development?


I'm terribly confused when I searched about Free Pascal. freepascal.org says it is a compiler that is used to compile Pascal language code over systems of various architectures. But, I've also found few jobs posted online seeking a Free Pascal programmer. Please throw some light on this. Thanks in advance!


Solution

  • Free Pascal is a compiler that supports several dialects.

    A lot of confusion like yours comes from oversimplified articles that present FPC/Lazarus as dropin Delphi substitute. Lazarus/fpc's entire development history is different however from both TP and Delphi.

    Most of dialect modes are existing dialects with minor extensions (usually features supported by all dialects), and some dialects (like Objective Pascal) are wholly a Free Pascal invention.

    Some of the dialects:

    • {$mode tp} - turbo pascal dialect
    • {$mode fpc} - Default mode. Turbo Pascal dialect cleaned of dosisms and 16-bitism (few differences to TP)
    • {$mode Delphi} - Delphi dialect + compatible extensions
    • {$mode DelphiUnicode} - Delphi dialect that changes string to unicodestring like D2009 (incomplete runtime support though)
    • {$Mode objfpc} - Free Pascal version of the Delphi dialect. (incompatible extensions)
    • {$mode macpascal} - Apple based pascal's, mostly Codewarrior derived
    • {$mode ISO} - Work in process ISO-7185 Pascal mode.
    • {$modeswitch objectivec1} and {$modeswitch objectivec2}, switches on objective C object model for easier COCOA interfacing, the differences are the same as objective C 1.x and 2.x languages/runtimes. This is Objective Pascal

    The main missing one is ISO10206 (1990), the second Pascal language standard (that most major vendors ignored)

    The dialect mode is a per unit decision, multiple dialects can be used in one program. Mode objfpc is the default mode of Lazarus, and thus the most used dialect nowadays.

    A typical example of an incompatible extension in mode objfpc is requiring @ for procedure (or method-) variable assignment. This is a disambiguation for certain cases where the proctype is the return value of a function.

    Some of the $mode objfpc differences have been implemented in later Delphi versions (like {$pointermath on}, the later which is default in $mode objfpc). $Mode objfpc also had a really early (early 2007) implementation of generics model after C++