> -----Original Message----- > From: Mark S. Miller [mailto:[EMAIL PROTECTED] > Sent: 14. april 2008 18:11 > To: Lars Hansen > Cc: [email protected] > Subject: Re: ES4 draft: assert expression > > 2008/4/11 Lars Hansen <[EMAIL PROTECTED]>: > > We talked about debugging information and an assertion form on > > es4-discuss a while ago, in a thread about the Error object. As a > > result of that discussion, I'm sending out a draft for an "assert" > > expression form. > > Hi Lars, > > I missed the earlier discussion. From the draft spec you > attached, it seems like the first argument to assert is > always evaluated, its value is always checked, and if false, > an error always thrown. While I like this better than the > behavior normally associated with the name "assert", it is > different, so I'm wondering if a different name is called for? > > In C, C++, Java, and IIRC Eiffel, the assert expressions (and > in Eiffel, the pre and post conditions as well) are not > supposed to be part of the meaning of the program. If P is a > correct program in any of these languages, then erasing P's > assert statements (or turning them off through other means) > should be correctness preserving. E and Caja have similar but > mandatory checking functions, named "require" > and "enforce" respectively. A correct program can validly > depend on their arguments being executed, and can depend on > these function throwing when the argument evaluates to false. > > Can a correct ES4 program depend of the assert expression to > do its thing? If so, then we should consider these > expressions to be part of the meaning of the program, not > just descriptions of what the program's meaning should be. If > so, "assert" is a confusing name.
Since there is no way to turn off asserts the program can (correctly) come to depend on the evaluation of the assertion. And I think your point is therefore a good one, though I don't know if it outweighs the benefits of (re)using a common name for this functionality. Of course, in C and C++ programs and I assume Java there is no guarantee that the program does not depend on the evaluation of the assert expression; I see bugs like that from time to time. (The inability to turn off asserts may in itself be a weakness, so maybe that's where the problem lies. But it is unclear how we would handle that problem in practice.) --lars _______________________________________________ Es4-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es4-discuss
