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

Michael Van Canneyt michael at freepascal.org
Tue Feb 2 13:12:25 CET 2016



On Tue, 2 Feb 2016, Henry Vermaak wrote:

>>>
>>> You only talked about the order of evaluation in that mail, while
>>> Henry is talking about whether the arguments are evaluated at all.
>>
>> I am aware of that (I knew I should have mentioned it explicitly, this
>> is a programmers list!), but the exact same observation applies.
>
> So you are saying that relying on all function arguments being evaluated
> is bad?

I am saying that the difference between this behaviour and the behaviour
where they may not all be evaluated is so subtle that many (I am tempted to
say most) programmers will never even know the difference.

It is simply over their heads.

Even Graeme - who has a lot of mileage in programming - was confused as to
"why all the fuss" till I explained with a simple example.

The fact that this difference is so subtle, makes using this as an argument
in the current discussion:

"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.

Michael.



More information about the fpc-pascal mailing list