Ah, wasn't aware that was how finalizers were implemented in Go. I guess the 
reason I never need to know that, is because of the Go error handling - never 
needed to use them :)




-----Original Message-----
>From: Ian Lance Taylor <i...@golang.org>
>Sent: Jul 1, 2019 8:46 AM
>To: Robert Engels <reng...@ix.netcom.com>
>Cc: Tyler Compton <xavi...@gmail.com>, Denis Cheremisov 
><denis.cheremi...@gmail.com>, golang-nuts <golang-nuts@googlegroups.com>
>Subject: Re: [go-nuts] The "leave "if err != nil" alone?" anti-proposal
>
>On Mon, Jul 1, 2019 at 6:20 AM Robert Engels <reng...@ix.netcom.com> wrote:
>>
>> You’ve also mentioned stack allocation without destructors again. Isn’t the 
>> proper way to handle this with defer (which in an exception based system 
>> would still run) or finalizers? Java routinely allocates on the stack using 
>> escape analysis and it is not an problem there.
>
>Finalizers don't work on stack based objects, and in Go they are
>per-object, not per-type, so you have to remember to call
>runtime.SetFinalizer.
>
>Defer statements work, but you have to remember to write them even for
>a function that has no visible way to return.
>
>Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/866930349.1876.1561989871232%40wamui-cheeto.atl.sa.earthlink.net.
For more options, visit https://groups.google.com/d/optout.

Reply via email to