Assert allowed to have side effects?

bearophile bearophileHUGS at lycos.com
Sun May 29 06:03:37 PDT 2011


Stewart Gordon:

> There are places where the spec fails to make a clear distinction between illegal code and 
> incorrect code that the compiler may reject if it's smart enough.

In D there are pure functions, so I think it's not too much hard for it to tell apart when the contents of an assert() are pure or not.
My opinion is that the D compiler has to enforce purity inside assert(), to avoid bugs.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list