[fpc-devel] new features and facilities
pascaldragon at googlemail.com
Fri Oct 9 08:08:51 CEST 2015
Am 08.10.2015 23:48 schrieb "Michael Van Canneyt" <michael at freepascal.org>:
> Let me explain. If I see
> If expr1 then expr2 else expr3
> it says 'statement' to me. But
> a ? b : c;
> Says "expression" to me.
> left := a ? b : c;
That's probably only because other languages use that as the ternary.
There also another reason why I prefer the variant with the if: ease to
implement in the compiler.
For the if one merely needs to add a corresponding case in factor() while
for the ?: one needs to fiddle with the compiler's operator precedence
rules that are applied in sub_expr() which can lead to desaster either
during implementation or later on when bugs are discovered...
So that's another reason why I'm inclined to this...
(Also that Algol-60 as the spiritual predecessor of Pascal has them as well
is quite intriguing :) )
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-devel