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/CAOyqgcWxa185Eg1UvV1_dn3GW7gxV8G3an5-uang-vBbLmd%2BDQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.