[fpc-devel] Macro Processing

Michael Van Canneyt michael at freepascal.org
Fri May 13 13:43:52 CEST 2011



On Fri, 13 May 2011, Joerg Schuelke wrote:

> Am Fri, 13 May 2011 11:25:36 +0200 (CEST)
> schrieb Michael Van Canneyt <michael at freepascal.org>:
>
>> In short: No, it is better to keep that particular box of pandora
>> closed.
>>
>> None of the more "modern" languages implement macros, and this is for
>> good reason.
>>
>> Pascal has always existed without macros. It keeps code readable:
>> what you read is what you get.
>> This is a strength of the language, and should remain that way.
>
> Yes I can live without macros too, i do it for years.
>
> FPC has macros today, and the one of the bad way, which you do not see
> in the source!! And the scanner is today checking every identifier for
> macro expansion, if you switch {$MACRO ON}.
>
> Try to remove the macro support from the compiler and we will see,
> there are people around, which use them, even the ones without
> parameters.
>
> The way I suggest for macro parameters make them better:
> 	{$I %name(some text)}	makes it clear, thats a macro
> expansion. In respect of readability, where is the difference to:
> 	name(param1,param2)	in pascal, where you do know
> it is a function call. Thats the same.

But I don't want to encourage their use by making them "better" or "more visible".

If I had my way, I would remove the existing ones alltogether.
The one use case they have in FPC sources could easily be remedied.

Michael.



More information about the fpc-devel mailing list