[fpc-pascal] some new features to delphi prisem

JoshyFun joshyfun at gmail.com
Sun Feb 21 20:37:12 CET 2010


Hello FPC-Pascal,

Sunday, February 21, 2010, 7:29:54 PM, you wrote:

MK> This is a matter of taste, I can imagine uses when at least functional
MK> "if" would make code *more* readable. Noone forces programmers to
MK> convert all their case/if to functional versions if they look
MK> unreadable. The functional variants are supposed to be used in
MK> particular situations, when they make sense.

For me the bigger problem is that both statements change its behavior
in function of its context.

if a=b then 1 else 2;

this is a pascal error, but

z := if a=b then 1 else 2;

Is it correct ? From my point of view is much more reasonable to use
something like:

z := iff(a=b,1,2);

But to me it looks awful and a bit of c-ism and really horrible code
could be written:

z: Boolean;
begin
z := iff(a=b,iif(b=2,a=b,b<>a),not(a=b));

-- 
Best regards,
 JoshyFun




More information about the fpc-pascal mailing list