[Issue 6074] Assert expressions shouldn't have side effects

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun May 29 13:21:50 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6074


bearophile_hugs at eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs at eml.cc


--- Comment #5 from bearophile_hugs at eml.cc 2011-05-29 13:17:29 PDT ---
(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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list