2016-02-02 13:12 GMT+01:00 Michael Van Canneyt <mich...@freepascal.org>:

> "iif(a,b,c)
> is fundamentally different in behaviour from
> functionxyy(a,b,c)"
>
> simply laughable in my eyes, because likely 99,99% of programmers won't
> know the
> difference. As Graeme said: 'I guess I was just lucky it never happened to
> me'.
> That sums it up.
>
> I'm just trying to to put any foaming-at-the-mouth argumentation using
> this particular argument in perspective.
>
> For a correct understanding: The compiler must behave predictable at all
> times, no arguing there. But I don't think that iif() having different
> semantics than all other functions, is a problem. It just needs to be
> documented properly. It is a non-issue for me.
>
> To give more perspective:
> The same is true for Writeln() and Assert(), which also have are different
> semantics, but this difference is simply documented (if at all).
> I didn't hear anyone protesting that. The fact that it is so in the pascal
> standard doesn't make a iota of difference; the standard was most likely
> simply made after the facts.


+1 well said.

profit of different behavior for iif is huge:

x := iif(obj = nil, 0, obj.foo);

and as was stated many times, this behavior iif is *compatible with
existing Oxygene* (!). Finally some compatible part.

maybe is worth to implement additional IfThen intrinsic (just generic
version of regular method from Math/StrUtils.IfThen)

-- 
Best regards,
Maciej Izak
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to