[fpc-pascal] New feature: IfThen() intrinsic

Sven Barth pascaldragon at googlemail.com
Mon Feb 1 19:18:17 CET 2016


Am 01.02.2016 15:58 schrieb "Maciej Izak" <hnb.code at gmail.com>:
>
> 2016-02-01 15:42 GMT+01:00 Sven Barth <pascaldragon at googlemail.com>:
>>
>> Maciej is in so far right that the intrinsic could indeed be named "if"
and the only way to call it would thus be by "&if", cause only then the
scanner would not treat "if" as a keyword. So it would work with what the
compiler currently can.
>>
>> I'm more inclined to use iif() however, as &if() doesn't look that
nice... (though it would be more noticeable :P )
>
>
> Phew. So it is possible. It is hard to discuss with compiler team members
like Michael :P.
>
> 1. IMO &if (if is possible to use &if) is best choice. iif can conflict
in the same way as IfThen.

In that sense we have to consider the RTL as no longer expandable as all
identifiers could be potentially used already, even &if!

> 2. IIF should works like IfThen in Math or StrUtils. If no - It will be
precedence with comparision to others languages and iif definition (!)...
> https://en.wikipedia.org/wiki/IIf

And you didn't read the article fully. There is one language that has an
iif() intrinsic that evaluates only the taken branch: Oxygene. ;)

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20160201/711092ab/attachment.html>


More information about the fpc-pascal mailing list