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

Martin fpc at mfriebe.de
Tue Feb 2 18:06:07 CET 2016


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.




More information about the fpc-pascal mailing list