FPC Unleashed is a community-driven fork of Free Pascal, focused on pushing the language forward with modern, expressive, and practical features that have not (yet) been accepted into the official compiler.
✨ Statement Expressions - {$modeswitch StatementExpressions} - #1037
Allows using control flow statements like if, case, and try as expressions, enabling a more functional and concise coding style.
s := if n > 0 then 'foo' else 'bar';s := case x of
1..3: 'in 1-3 range';
6..9: 'in 6-9 range';
else 'out of range';function canfail: string;
begin
if random(2) = 1 then raise Exception.Create('exception');
result := 'hello world';
end;
// ...
s := try canfail() except 'failed';✨ Array Equality - {$modeswitch ArrayEquality} - #829
Adds support for = and <> comparisons between arrays when ArrayOperators is enabled.
A modern Pascal mode based on ObjFPC but with powerful enhancements enabled by default.
The following modeswitches are enabled automatically in this mode:
StatementExpressions- Useif,case, andtryas expressions.AnonymousFunctions- Anonymous procedures and functions.FunctionReferences- Function pointers that capture context.AdvancedRecords- Records with methods, properties, and operators.ArrayOperatorsandArrayEquality- Direct array comparisons.AnsiStrings- UsesAnsiStringby default.UnderscoreIsSeparator- Allows underscores in numbers (1_000_000).DuplicateNames- Allows reusing identifiers in limited scopes.
Note
Placing {$mode unleashed} directly in your source file may interfere with IDE autocompletion. It's recommended to enable the mode via -Munleashed in the Project's Custom Options instead.
- Download fpcupdeluxe and run it once to generate the
fpcup.inifile. - Edit
fpcup.iniand add the following under[ALIASfpcURL]:
[ALIASfpcURL]
fpc-unleashed.git=https://github.com/fpc-unleashed/freepascal.git- Reopen fpcupdeluxe, uncheck GitLab, and select
fpc-unleashed.gitas your FPC version. - Choose any Lazarus version you like.
- Click Install/update FPC+Lazarus.
- Optionally install cross-compilers via the
Crosstab.
- Make sure your existing FPC+Lazarus was installed with fpcupdeluxe.
- In your installation directory, delete or rename the
fpcsrcfolder. - Clone the FPC Unleashed repo into the
fpcsrcdirectory.
git clone https://github.com/fpc-unleashed/freepascal.git fpcsrc- In fpcupdeluxe, go to Setup+, check FPC/Laz rebuild only, and confirm.
- Click Only FPC to rebuild the compiler and RTL.
- Optionally install cross-compilers via the
Crosstab.
We welcome bold ideas, experimental features, and contributions that challenge the status quo of the Pascal language.
FPC Unleashed is a playground for innovation. If you've ever built a language feature that was "too weird" or "not standard enough" for upstream - this is where it belongs.
- 🧪 New language constructs and modeswitches
- 🔧 Compiler enhancements or RTL improvements
- 🧹 Cleanup and refactoring of legacy code
- 🐞 Bugfixes related to unleashed features
