[fpc-devel] new features and facilities
Michael Van Canneyt
michael at freepascal.org
Fri Oct 9 20:30:23 CEST 2015
On Fri, 9 Oct 2015, Dmitry Boyarintsev wrote:
> The only Pascal way is
>
> left := IfThen(expr1, expr2, expr3)
>
> Similar to addr(), sizeof(), length(), write() and recently added Default()
> in intrinsic.
> I guess functions declared in Math unit are not covering all the needs
> (since type of expr2, expr3) may vary.
> That's why a bit of compiler support is needed.
The main reason compiler support is needed is that Expr3 must not be evaluated
if expr1 is true, and expr2 must not be evaluated if expr1 is false, at least
if you want the ternary semantics. (as once explained to me by Sven himself...)
I'm not sure this kind of semantics is possible with a compiler intrinsic...
But if it is: In that case the IfThen or IIF() or somesuch has my absolute top preference,
followed by ternary. (and the If .. then expression should be blasted to hell ;) )
Michael.
More information about the fpc-devel
mailing list