I hate class destructors with a burning passion

Kagamin spam at here.lot
Thu Jun 10 17:09:04 UTC 2021


On Thursday, 10 June 2021 at 14:07:04 UTC, Steven Schveighoffer 
wrote:
> What about asserts in a related function? The foundation of 
> programming with functions is that you can abstract common 
> implementation into another function.
>
> I could easily see someone making a helper function for lots of 
> similar contracts.

Maybe move all that logic into the precondition of that function?

void businessFunction(a,b,c) in { checkContract(a,b,c); } {...}
void checkContract(a,b,c) in { lots of asserts } { empty }


More information about the Digitalmars-d mailing list