Should D have control-flow expressions? IS it possible?
Basile B.
b2.temp at gmx.com
Fri Sep 11 03:35:47 UTC 2026
On Thursday, 10 September 2026 at 06:56:25 UTC, Meta wrote:
> [...]
> Anyway, is this reasonably doable? I personally want it for
> switch expressions (or Rikki's proposed .match statement, which
> I think lowers to a tree of ternary expressions similarly to
> what my POC does).
The problem is about algorithmic complexity. D does the flow
analysis at the statement level. That way you dont have to
explore the whole sub-expressions to create the "basic blocks".
You can allow expressions to change the flow, but this is a
serious shift. For example Zig does that. In the past they had a
lot of bugs related to the way they mix expressions and
statements.
More information about the Digitalmars-d
mailing list