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

Michael Van Canneyt michael at freepascal.org
Tue Feb 2 18:24:50 CET 2016



On Tue, 2 Feb 2016, Martin wrote:

> On 02/02/2016 16:49, Sven Barth wrote:
>> 
>> 
>> > also if we are discussing (are we?) a form like
>> >   x:= iIf a>b  iThen c iElse b;
>> > then why not
>> >   x:=  a>b  ifThen c ifElse b;
>> 
>> Because I won't add new keywords just for this feature, especially if they 
>> are inside normal code (I'm a bit less strict outside of routine bodies ;) 
>> ).
>> 
> Ah, ok: "iif"  (as none function) is of the table too. I had not gotten that 
> from the discussion so far.
>
> But fair enough, if they would become keywords, then I agree the impact on 
> existing code would be potentially massive.
>
> In this case, I dislike the
>   x := if a then b else c;
>
> While at first easier to read (no  need to know that IfThen or IIF is an 
> intrinsic), it resembles (I am aware it is not, but it still resembles) a 
> statement, and opens the door to discussions that other statement should 
> return values too.
> Like x := y := 1; which is not desirable at all.

I am glad that I am not the only one who thinks this is not good :/

Michael.



More information about the fpc-pascal mailing list