The documentation for assert,
http://www.digitalmars.com/d/2.0/expression.html#AssertExpression,
states that it's an error if the assert expression contains side
effects, but it doesn't seem the compiler is enforcing this.
module assert_sideeffect;
bool b;
bool f() { b = !b; return b; }
void m
On 29/05/2011 09:44, simendsjo wrote:
The documentation for assert,
http://www.digitalmars.com/d/2.0/expression.html#AssertExpression, states that
it's an
error if the assert expression contains side effects, but it doesn't seem the
compiler is
enforcing this.
There are places where the spec
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 asser
On 29.05.2011 15:03, bearophile wrote:
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.
http://d.puremagic.com/issues/
On 29/05/2011 14:03, bearophile wrote:
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
On 2011-05-30 16:34, Stewart Gordon wrote:
> On 29/05/2011 14:03, bearophile wrote:
> > 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
On 5/31/11 1:34 AM, Stewart Gordon wrote:
On 29/05/2011 14:03, bearophile wrote:
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 th
Stewart Gordon:
> Only if purity rules are relaxed. AIUI, one of the restrictions at the
> moment is that in
> a pure function only immutable data can be accessed. As long as this
> restriction remains
> in place, adding the restriction of purity to asserts would erode their
> usefulness.