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

Sven Barth pascaldragon at googlemail.com
Tue Feb 2 14:24:18 CET 2016


Am 02.02.2016 12:03 schrieb "Serguei TARASSOV" <serge at arbinada.com>:
>
> On 02/02/2016 11:42, fpc-pascal-request at lists.freepascal.org wrote:
>>
>> On Tue, 2 Feb 2016, Sven Barth wrote:
>>
>> >No, the second is always better because safer.
>> >
>> >x := iif (Obj = nil, 0, Obj.Value);
>> >This will raise access violation as a normal function or you depend on
>> compiler implementation for this special case. And you should remember an
>> additional special case of function.
>>
>> That's why the current IfThen() is an intrinsic, to allow this.
>
> Why make the things complex? Why create another "special case"?
> Look at the "iif" as an statement and the things will be simple.

BECAUSE. IT. IS. *NOT*. A. STATEMENT!
It never was and it never will be! It returns a value and thus by
definition it is an expression!

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


More information about the fpc-pascal mailing list