[fpc-pascal] Proper preprocessor?

Michael Van Canneyt michael at freepascal.org
Wed Jun 20 17:02:31 CEST 2018



On Wed, 20 Jun 2018, Ryan Joseph wrote:

>
>
>> On Jun 20, 2018, at 9:26 PM, Marc Santhoff <M.Santhoff at web.de> wrote:
>> 
>> Long ago, at the time of fpc 1.9.x or 2.0.x I did some digging in compiler
>> source code, the lexer and parser part. IIRC there were some hooks for calling
>> a proprocessor in the code at that time. If they are still there, wouldn't it
>> be a solution for both sides?
>
> I hope that’s not true.  :) Marco says otherwise but it’s hard to imagine
> why the current $define:= couldn’t take an argument.

Because it is a simple textual token replacement at present. 
Supporting arguments would mean parsing the macro, parsing whatever comes after 
it, matching the arguments etc. A whole added layer of complexity.

> I’m sorry to say for
> the compiler team this issue is just going to come up over and over
> because programmers are going to be confused as to why the current macros
> don’t take parameters.

To put things in perspective: in 25 years it came up only a handful of times.
So I'm not inclined to perceive it as a pressing problem...

Michael.


More information about the fpc-pascal mailing list