[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] "Alert" messages [Was: Code review: product editor]
From: |
Greg Chicares |
Subject: |
Re: [lmi] "Alert" messages [Was: Code review: product editor] |
Date: |
Sat, 24 Mar 2007 14:07:20 +0000 |
User-agent: |
Thunderbird 1.5.0.4 (Windows/20060516) |
On 2007-3-3 5:11 UTC, Greg Chicares wrote:
>
> The really bizarre one is hobsons_choice(), which makes the
> user decide whether to throw. I'm trying to do away with it.
It occurs less than a dozen times. But one of those occurrences
was in what the LMI_ASSERT macro formerly expanded to, and that
macro occured about four hundred times before the 20070306T1813Z
and 20070309T1627Z changes.
> It feels like INTERCAL.
Now, that expansion has a name that looks like INTERCAL. Here is
INTERCAL documentation for it:
* PLEASE ABSTAIN FROM USING HOPEFULLY
Before 20070306T1813Z, we had
ASSERT_LMI (threw unconditionally; infrequent)
LMI_ASSERT (threw at the user's option; very common)
On 20070306T1813Z, we renamed
s/LMI_ASSERT/HOPEFULLY/
s/ASSERT_LMI/LMI_ASSERT/
On 20070309T1627Z, we changed many occurrences that didn't need
to offer any option from HOPEFULLY to LMI_ASSERT, so now we have
LMI_ASSERT (throws unconditionally)
HOPEFULLY (throws at the user's option)
and ASSERT_LMI no longer exists. Now dubious behavior corresponds
to a name that, hopefully, betokens dubiety.
This was the simplest way to achieve the most we could for now:
- recent code that used LMI_ASSERT throws on failure,
unconditionally, as was presumably its intention,
and the original macro name has been preserved
(so, notably, we did no harm to Evgeniy's work);
- the same goes for old code that had no need to permit
overriding the exception;
- old code (in only a few translation units) that might
need an overridable assertion now uses HOPEFULLY
instead of LMI_ASSERT; and
- there's no more ASSERT_LMI to confuse with LMI_ASSERT.
Assertions that formerly could be bypassed have been replaced
with assertions that cannot, in about half of all instances,
but in eighty or ninety percent of source files:
$grep HOPEFULLY *.?pp |wc -l
185
$grep --files-with-matches HOPEFULLY *.?pp |wc -l
9
$grep LMI_ASSERT *.?pp |wc -l
215
$grep --files-with-matches LMI_ASSERT *.?pp |wc -l
51
> Slowly we are clawing our way back.
Hopefully, as old code is incrementally improved, we can gradually
replace HOPEFULLY with LMI_ASSERT. Probably many instances can be
changed safely now; we can identify them by running with the
"offer_hobsons_choice" configurable setting turned off.
[lmi] "Alert" messages [Was: Code review: product editor], Greg Chicares, 2007/03/03
Re: [lmi] "Alert" messages [Was: Code review: product editor],
Greg Chicares <=
Re: [lmi] Code review: product editor, Vadim Zeitlin, 2007/03/05