[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/9] pkl: disallow immediate break/continue/return in EXCOND
From: |
Mohammad-Reza Nabipoor |
Subject: |
Re: [PATCH 3/9] pkl: disallow immediate break/continue/return in EXCOND |
Date: |
Thu, 28 Dec 2023 15:46:54 +0100 |
Hi Jose.
On Thu, Dec 28, 2023 at 03:16:30PM +0100, Jose E. Marchesi wrote:
>
> > This commit disallow change in control flow from EXCOND expressions
> > which the LHS of the operator is a compound statement.
> >
> > The following Poke snippets are now illegal:
> >
> > Sample 1:
> >
> > whlie (condition)
> > { break; } ?! E_elem;
> >
> > Sample 2:
> >
> > whlie (condition)
> > { continue; } ?! E_elem;
> >
> > Sample 3:
> >
> > fun f = int:
> > {
> > { return 1; } ?! E_elem;
> > return 0;
> > }
>
> Hmmm, I assume the above currently breaks the compiler and that is what
> motivates this patch?
>
> I don't see anything wrong in the code above: all of these ought to
> work. Do you have any particular reason why to forbid having break,
> continue and return statements in EXCOND?
>
Besides breaking the compiler, I think,
1. Expressions that can change the flow of programs don't seem to be correct to
me.
The purpose of EXCOND is to verify that a block of code doesn't raise an
exception.
2. It complicates the codegen for my E_constriant location tracking patch.
Regards,
Mohammad-Reza