Should D have control-flow expressions? IS it possible?

Meta jared771 at gmail.com
Fri Sep 11 04:07:20 UTC 2026


On Friday, 11 September 2026 at 03:35:47 UTC, Basile B. wrote:
> 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.

Hmmm, do you remember anything in particular? From what I've 
read, one of the big issues is around cleanup.


More information about the Digitalmars-d mailing list