[Info-vax] BASIC (and Horizon)

Arne Vajhøj arne at vajhoej.dk
Wed Jan 31 13:38:32 EST 2024


On 1/31/2024 1:22 PM, Simon Clubley wrote:
> On 2024-01-31, Arne Vajhøj <arne at vajhoej.dk> wrote:
>> For the not VB.NET knowledgable:
>>
>> Using o1 As New X("A")
>>       ...
>> End Using
>>
>> calls o1.Dispose() when the block is exited no matter how it
>> is exited - normal or exception does not matter Dispose is
>> always called.
> 
> Unless there is a power failure or a system crash.

I guess that is also a form of exit.

:-)

> I wonder how many people think of that one when assuming that their
> state reset code will _always_ run after execution of the routine
> has started. :-)

Probably none. But it probably does not matter either.

The construct is used to free unmanaged resources in the
process. Open files, open network connections like database
connections, unmanaged memory etc.. All stuff that goes
away if the process is gone.

I have never seen the construct used to reset an out
of process state (persisted state). And I have seen
a lot of C#, VB.NET, Java, Python etc. code using the
construct.

If there is a need for a consistent out of process
state (persisted state), then it has to be transactions.

Arne





More information about the Info-vax mailing list