[fpc-pascal] Proper preprocessor?

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Wed Jun 20 13:37:12 CEST 2018


On 20/06/18 10:00, Ryan Joseph wrote:
>> On Jun 20, 2018, at 3:50 PM, Michael Van Canneyt <michael at freepascal.org> wrote:> > Because it is simply a bad idea ?
> Yeah that’s what the programming gurus in ivory towers and professors keep saying but what about the person actually trying to finish some work? It really sucks trying to fight the compiler sometimes because of engrained dogma.

> How does an external preprocessor work if the compiler doesn’t about it? Doesn’t it totally mess up the line numbers for debugging? I’d happily write my own even if it was compatible with the compiler.

>>> Pascal has some trivial macro support. {$define m:=xyz}> > If you need more than that, you can use m4 or so. Lazarus has support for> pre-compile commands, so you can always configure it to preprocess your> files if you are so inclined.

We've been here before, and not long ago.

I've done my fair share of language advocacy in the past and in general 
am no friend of C, but I suggest that a number of people- on both the 
"pure" and the "pragmatic" sides of the argument- could very much do 
with "cooling it".

I'm pretty sure that the preprocessor issue was discussed a few months 
ago with somebody pointing out that the Pascal compiler's macro handling 
was deficient in that it had no concept of parameters. I believe that 
the consensus was that it might possibly be desirable for the compiler 
to be able to invoke an external preprocessor for the main unit and then 
for each one that it imported, but that we didn't get as far as 
considering its implications for include files etc.

The other alternative would be break the compiler in such a way that it 
was usable from a standard makefile, but since there isn't separate 
compilation of definition and implementation parts this would probably 
impact on type safety. I believe that this too has been debated in the 
past, and has attracted even less enthusiasm than a hook for an extrnal 
preprocessor preprocessor.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]



More information about the fpc-pascal mailing list