[fpc-pascal] Proper preprocessor?

Michael Van Canneyt michael at freepascal.org
Fri Jun 22 08:01:17 CEST 2018



On Fri, 22 Jun 2018, Ryan Joseph wrote:

>
>
>> On Jun 22, 2018, at 12:21 PM, Michael Van Canneyt <michael at freepascal.org> wrote:
>> 
>> 'Nice' is not an argument.
>> 
>> If someone else assumes that assert() works as expected - i.e. throws an exception, then your macro will mess up his code, leading to
>> unpredictable results.
>> 
>> From my - admittedly subjective - point of view, your examples only serve to demonstrate why we should definitely not support macros...
>
> For any example I can give it’s easy to extrapolate into some scenario where it would be a disaster. I get that. The reason I ever wanted to make a macro was for personal use to give some project specific meaning to some construct or a quick hack. Frameworks like Apple uses,  often use macros to document parts of code in a way which otherwise isn’t part of the language and no suitable for comments. I’m not saying this is how we all should program. I don’t suggest people go out and start using macros in place of functions.
>
> Btw why was the $define:= syntax ever introduced in the first place? 
> adding a parameter to the syntax is a minor extension but it sounds like
> Pascal programers here really don’t like it in general.

A good and just question. We most likely didn't realize the consequences. 
Meanwhile we're older, more experienced and we now know what impact seemingly 
good ideas can have...

C was designed from the ground up with preprocessing. Pascal, and most newly
designed languages, do not have preprocessing built-in. For good reason.

Some cans are better left unopened. Or pandora's box is better left
closed... (if you prefer mythological references ;) )

Michael.


More information about the fpc-pascal mailing list