forwarding, as I read the "closed thread" notice only after this was written.
-------- Forwarded Message --------
Subject: Re: [fpc-pascal] New feature: IfThen() intrinsic Date: Tue, 2 Feb 2016 18:45:49 +0000
From: Martin
To: FPC-Pascal users discussions
Michael Schnell wrote 12 lines
Actually, as Sven pointed out, it is not (supposed to be) a statement, but an expression.
Being an expression "a < 3", "1", "3" are the operands, therefore "if", "then", "else" (together) are an operator.
So the above should read
- a keyword used to start a statement, also can is used as an operator.
Also the if-then-else operator introduces a somewhat new syntax for an operator.
With the exception of unary operators ("-", "not"), operators are usually (in pascal) found between the operands.
The new operator however is found in front and between.
If it was not for (taking Sven's word for it / he wrote in another mail)
Sven Barth wrote 5 lines
Omitting the "if" will mean much bigger changes to the compiler. I If I understand him correct, then in his opinion not worth it for the value of the feature.
The other problem of making it on operator that only goes between the operands is
x:= a>b ifThen c ifElse b;would mean that ifThen, ifElse will be new keywords. Breaking code, if someone uses them as identifier.
Though that could be solved:
x:= a>b Then c Else b;