[m-dev.] request for opinions about a change to switch detection

Zoltan Somogyi zoltan.somogyi at runbox.com
Fri Nov 14 15:11:44 AEDT 2025



On Fri, 14 Nov 2025 14:56:14 +1100, Julien Fischer <jfischer at opturion.com> wrote:
> But not a good warning, since it is obviously spurious!

Based on what rule of the language? Peter's point is that there is no such rule.

There are many situations in which we don't guarantee that the compiler
will understand things that are obvious to humans. For example, why is

 ( if N > 2 then ...
 else if N < 5 then ...
 else fail
  )

not det? *Obviously* every integer is either greater than 2 or smaller than 5 ...
to humans, but not to determinism analysis.

> Presumably, by pushing the format calls back into the branched control
> structure, that then makes them amenable to being optimised?  (I was going
> to ask about that anyway after I saw Peter's example.)

Pushing the format calls back into the branches *in these cases*, but not
in others, guarantees that the compiler knows exactly what the format string is.
This avoids the warning about it being unknown, and allows the call to be
optimised. For the issue at hand, the former is what is important; the latter
is just a nice-to-have.

Zoltan.


More information about the developers mailing list