Related articles |
---|
[22 earlier articles] |
Re: failure due to compiler? LEEW@FS.MICROLOGIC.COM (Lee Webber) (1996-07-20) |
Re: failure due to compiler? iwm@doc.ic.ac.uk (Ian Moor) (1996-07-20) |
Re: failure due to compiler? WStreett@shell.monmouth.com (1996-07-20) |
Re: failure due to compiler? jgllgher@maths.tcd.ie (Dara Gallagher) (1996-07-20) |
Re: failure due to compiler? ok@cs.rmit.edu.au (1996-07-22) |
Re: failure due to compiler? rfg@monkeys.com (1996-07-22) |
Re: failure due to compiler? leew@micrologic.com (Lee Webber) (1996-07-23) |
Re: failure due to compiler? eric@gyst.com (Eric Hamilton) (1996-07-23) |
Re: failure due to compiler? davidg@genmagic.com (1996-07-23) |
Re: failure due to compiler? davidg@genmagic.com (1996-07-24) |
Re: failure due to compiler? jmccarty@sun1307.spd.dsccc.com (1996-07-26) |
Re: failure due to compiler? davidg@genmagic.com (1996-07-31) |
Re: failure due to compiler? feliks@carlstedt.se (1996-07-31) |
From: | Lee Webber <leew@micrologic.com> |
Newsgroups: | comp.compilers |
Date: | 23 Jul 1996 23:21:17 -0400 |
Organization: | Pioneer Global |
References: | 96-07-041 96-07-056 96-07-064 96-07-079 96-07-100 96-07-123 96-07-141 |
Keywords: | Eiffel, design, debug |
Dara Gallagher <jgllgher@maths.tcd.ie> wrote:
>
> Assertions are a feature of the OO language Eiffel and are sold heavily as
> part of the Eiffel philosophy. Also many C++ programmers use macros to
> implement assertions.
>
> However, as expressions in C++ (and Eiffel) may have side effects, turning
> assertion checking off may alter the behaviour of the program. One Eiffel
> user I know claims to have experienced this perplexing behaviour. His
> program worked as expected until he turned assertion checking off!
>
> This is more a failure in language design than in compiler writing.
> However I find it amusing since assertions (and invariants) are promoted
> as a safety feature of languages.
It is an informal rule in Eiffel (and a formal policy) that function calls
should not have side effects which affect the abstract state of an object
(i.e., that visible from its interface). Most Eiffel users code that way as
a matter of course; this of course makes assertions quite safe. (Although of
course nothing is free; assertion evaluation still consumes resources of
various sorts.)
Bertrand Meyer (the inventor of Eiffel) stated in 1988 that he did not
formalize the above policy because "it is impossible for the compiler" that
can't formally prove theorems "to decide whether a side-effect affects the
abstract state" only. (Gurus: true in 1996?)
Personally, I believe that the above policy may also be broken in order
efficiently to support concurrency, but that is another thread (and another
newsgroup)...
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.