[fpc-devel] Pure function Wiki page

R0b0t1 r030t1 at gmail.com
Sun Jul 8 23:22:06 CEST 2018


On Sun, Jul 8, 2018 at 12:33 PM, Marco van de Voort <marcov at stack.nl> wrote:
> In our previous episode, Florian Kl?mpfl said:
>> >
>> > It doesn't explain why you chose for a modifier rather than preprocessor
>> > switch.
>>
>> Why a preprocessor switch for something which applies to a particular function?
>
> Maybe. But this kind of stuff will be rare, and is only an hint to speed up
> parsing. I think having a directive is a bit too much honor.
>
> Maybe it is time for an attribute system?
>

There were some other comments touching on reasons for or against a
keyword, and I apologize for not speaking to them precisely. But, this
is why I would like to avoid a keyword - it is redundant.

As noted only certain statements are constant. If marked so the
compiler must verify they are constant anyway. So, what makes more
sense is determining the constexprness of an expression by analyzing
each subexpression. If an expression is made of only constant
expressions it too is constant.

The information *must* already be there. It would be best to not
introduce another keyword and to keep the user from worrying about it.

Cheers,
     R0b0t1



More information about the fpc-devel mailing list