[fpc-pascal] Proper preprocessor?
Florian Klämpfl
florian at freepascal.org
Fri Jun 22 22:48:12 CEST 2018
Am 22.06.2018 um 08:01 schrieb Michael Van Canneyt:
>
>
> 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...
Well, I think we (the people who decided to implement it) thought about the consequences. The chances to mess around
with the currently implemented macro support is far less than with macros with parameters and concat operations. And the
impact is limited imo.
More information about the fpc-pascal
mailing list