--- Comment #6 from 2011-05-29 14:01:56 PDT ---
(In reply to comment #5)
> (In reply to comment #4)
> > This is as designed. Sometimes, checking code may have side effects, but it 
> > is
> > up to the user to ensure that they do not affect the program. Forcing the
> > assert expression to be pure is too restrictive.
> > 
> > Not a bug.
> A reminder: forbidding side effects in asserts is useful for static
> analyzability of the asserts. Languages that take Contracts seriously don't
> allow generic code in Contracts right to allow a simpler analyzability. They
> even define a specific expression language for this purpose.

Purity is not necessary nor sufficient (in the current stage) for 'static
analyzability' (CTFE) in D.

Also, unit tests are used much more than DbC, where accepting an impure
predicate in assert is perfectly acceptable (e.g. testing a mmap module). It's
possible to enforce 'assert' purity only in 'in', 'out' and 'invariant' blocks,
but that create a special case. ;)

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to