On 9/4/14, 7:03 PM, "Nordlöw" wrote:
On Thursday, 4 September 2014 at 22:02:20 UTC, Nordlöw wrote:
D can also, in this case, do (or will do) common sub-expression
elimination because it has a strict memory model (const and
immutability) and function purity (template inference).

Correction: foo cannot be pure in this case. But I believe your example
is misguiding in this case. The most common use case for this is when
foo is pure.

No, why?

~~~
min_alert_level = 5
max_alert_level = 10

if min_alert_level < compute_current_alert_level < max_alert_level
  send_email
end
~~~

I don't see anything wrong with that code.

Reply via email to