Am Tue, 04 Feb 2014 14:25:14 +0000
schrieb "bearophile" <[email protected]>:

> An example of the problem?
> 
> http://forum.dlang.org/thread/[email protected]?page=2#post-xodootdnxopfyeqmhnjb:40forum.dlang.org
> 
> Bye,
> bearophile

Yes, this is definitely why asserts should not have side
effects when they succeed. I think maybe the earlier try_lock
example could be written more cleanly as:

  assert(lock.is_locked);

Still this requires is_locked to be "strongly pure", which
cannot be expressed explicitly in D. (Otherwise it could
change the implicit this and cause a side-effect.)

-- 
Marco

Reply via email to