[fpc-devel] Macro Processing

Martin fpc at mfriebe.de
Mon May 16 15:41:35 CEST 2011


On 16/05/2011 14:30, Joerg Schuelke wrote:
> Am Mon, 16 May 2011 14:07:54 +0100
> schrieb Martin<fpc at mfriebe.de>:
>
>>     {$MyProc (Name) := procedure %Name%; begin}
>>     ...
>>     {$Expand MyProc(Foo)} writeln(1); end;
> Thats a point worth thinking about, but you say that it even can be done
> today, do you think there is more harm extending the thing? Will think
> about.
Se my other mail( 30 secs ago)

The more support there is for macros, the more likely people will start 
whole libraries of macros.

first just a lort of small harmless helpers. Then combinations there 
of... it grows, and then it becomes cancer  (grows to something not 
intended...)

>
>>     But if let me quote "the real use cases ... are rare", then is it
>>     still worth the risk (Even if the risk is small.
> Do you remember all the writeln for debugging purposes? Hours and
> hours.
> They are the true reason to incorporate // comments. (a theory of me)
> This may be a sign that the need would be there, if there is the
> possibility.

I have a few of them in the code I wrote for lazarus.

I put all of them in their own IFDEF.
Making a clear statement at the very place of the writeln, that they are 
conditional.
To me it increases readability.

Well and on top, the editor I use can color the IFDEF, just a nice add 
on, but not a necessity => not an argument: Because the use (or none 
use) of macros can and should not be decided by the cpacibilities of the 
editors that individuals use.



More information about the fpc-devel mailing list