Comparing Exceptions and Errors

kdevel kdevel at vogtner.de
Thu Jun 16 17:13:07 UTC 2022


On Thursday, 16 June 2022 at 13:54:52 UTC, Steven Schveighoffer 
wrote:

[scope (success) lowered to finally]

[...]

>> Furthermore I always thought of scope guards as a means for 
>> cleanup. Cleanup implies in my eyes removing things which have 
>> been used in a previous task. This intended use is documented 
>> here:
>> 
>> https://tour.dlang.org/tour/en/gems/scope-guards
>> 
>>      Using scope guards makes code much cleaner and allows 
>> resource allocation
>>      and clean up code to be placed next to each other. These 
>> little helpers also
>>      improve safety because they make sure certain cleanup 
>> code is always called
>>      independent of which paths are actually taken at runtime.
>> 
>> Performing a COMMIT is rather the opposite of cleanup: It 
>> makes (writes) changes to the database persistent.
>
> Semantically, you are just not undoing (rollback) the previous 
> steps.

Objection! Not doing a rollback is not the same as doing a 
COMMIT. Even not "semantically". Until the COMMIT has succeeded 
none of the changed data of the transactions is visible in other 
DMBS sessions.



More information about the Digitalmars-d-learn mailing list