I hate class destructors with a burning passion
Steven Schveighoffer
schveiguy at gmail.com
Thu Jun 10 12:59:59 UTC 2021
On 6/10/21 8:07 AM, Kagamin wrote:
> On Wednesday, 9 June 2021 at 17:54:06 UTC, Timon Gehr wrote:
>> On 09.06.21 04:37, Walter Bright wrote:
>>>
>>> Allocating via the GC is in assert is just ridiculous, as the program
>>> is going to exit shortly anyway. There won't ever be a need to run a
>>> collection on it. Just malloc away and fuggeddabootet.
>>
>> AssertError is still *caught* /by the language/ on in contract
>> inheritance.
>
> I'd say, lower assert failures in contracts to a different function,
> say, _d_contractFailed(), which can do a different thing, say, throw
> ContractError, and child contract can catch only this specific
> ContractError instead of any Error.
What about asserts in functions called by the contract? I guess
technically they are not part of the contract, just poor coding, but
people may rely on those asserts in some cases.
-Steve
More information about the Digitalmars-d
mailing list