[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua 5.4.0-alpha-rc1 behavior with closing methods errors
- From: David Heiko Kolf <david@...>
- Date: Sat, 22 Jun 2019 11:19:28 +0200
Francisco Olarte wrote:
> I'm nearly sure you are mixing concepts here, comparing try/finally
> in C#/JavaScript with try-with-resources. They are different
> animals. Java has try-finally too and it probably works similarly to
> its equivalent in C#/JS ( I say probably because I don't do windows,
> hence no C#, and I'm not too familiar with JS, I just know how Java
> works ).
Unfortunately I haven't worked with Java for a long time but in C#
"using" and "finally" are actually equal and not different animals:
<https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/using-statement>:
> You can achieve the same result by putting the object inside a try
> block and then calling Dispose in a finally block; in fact, this is
> how the using statement is translated by the compiler.
So far I have only used finally (in any language) for cleaning up
resources, too.
Maybe my first example and some of my words weren't precise enough, but
anyway, what I meant is I want to be informed in case a cleanup method
for a resource didn't finish its job.
>> This would be similar to the warn function, as "nobody" already
>> suggested in this thread earlier. (I just hope that the warn message
>> handler gets more flexible than it is at the moment).
>
> I hope they do not send them there. Storing it like Java, having a
> getsupressederrors() method, smething like it, may be fine, but I do
> not want error descriptions forcefully polluting my warn stream
In my applications I often don't want anything on the stderr stream,
too. That's why I wrote that I hope for a more flexible warn message
handler. But whether it is an unhandled error from __gc or from __close
doesn't really matter to me, both shouldn't happen in my programs and
would be a sign of a programming error to me.
Best regards
David