A direct wish for extended compiler functionality.
In certain scenarios, a lot of code is identical between procedures and functions, but unless making a file and using {$I FileName}, the code have to be written double up, or even more than double up.
I would like to suggest a similar pattern of {$Region 'Name'} and {$EndRegion}:
{$CodeBlock 'Name'}
// Code for identical reuse here...
{$EndCodeBlock}
And then later where you want to insert that exact codeblock on compiletime:
Procedure SomeFunctionality(...);
Var
Something:Integer;
Begin
Something := High(MyArray);
{$ReuseCodeBlock 'Name'}
End;
No. Use
$Include directives for that or extract the code into subroutines.
My problem is that I have already tried that, I made a wrapper, but I want the code to be inlined as well, and the compiler refuse to do inlining on 3 generic functions when one is referencing another.
The compiler needs to know the body of a function before it can inline it. Thus if you have two functions calling each other then one
will not be inlined.