[fpc-pascal] if-then-else expression

John Lee johnelee0 at gmail.com
Tue Feb 2 20:22:07 CET 2016


So (Sven) to clarify, assume that your original ifthen [patch is now in
latest svn compiler although more work will needed to do x:=if a then b
else c;? j

On 2 February 2016 at 18:33, Sven Barth <pascaldragon at googlemail.com> wrote:

> On 02.02.2016 10:25, Michael Schnell wrote:
> > On 02/01/2016 09:35 PM, Maciej Izak wrote:
> >>
> >>
> >> x := if true then 0 else 1
> >
> > Here a keyword and a statement just optionally returns a value, Same is
> > ignored in all legacy code but can be use it you want to and do know
> > what you do.
> >
> > Additionally "0" now is a statement, (optionally) extending what is
> > considered a statement.
>
> Why would "0" now be a statement? As long as the "if" is the expression
> as well then the definition would be "if Condition then ThenExpr else
> ElseExpr", not "if Condition then ThenStmt else ElseStmt". Otherwise
> things like procedures ore assignments would be allowed as well which is
> not the case.
>
> >
> > This is a rather drastic change in the basic definition of the language,
> > but might be doable. I's completely optional, and I don't see how it
> > might break anything.
>
> Of course it's doable. See the patch I attached at the initial mail of
> this thread.
>
> Regards,
> Sven
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20160202/b4837770/attachment.html>


More information about the fpc-pascal mailing list