On 26.8.2024 00:31:57, Rowan Tommins [IMSoP] wrote:
I'm not an expert on parsers, and never claimed to be, so it's not particularly surprising to me
that I've overlooked a reason why "expr ?: default" can't be included without also
including "default ?: expr", and will just have to take your word for it.
It doesn't, unfortunately, persuade me that the behaviour proposed is sensible.
Rowan Tommins
[IMSoP]
Hey Rowan,
just to state this:
It is almost never sensible to arbitrarily restrict grammars.
In the sense of "allow this expression just in a context of this given
list of expressions". Sure, in some cases the permitted grammar doesn't
make sense (like, why would we allow arithmetic operators on the
left-hand side of a coalesce operation "($a + $b) ?? $c"), but that's on
the user to write a minimal bit of sensible code.
I hope you can understand that; thanks,
Bob