On Wednesday, 19 October 2016 16:50:55 UTC-4, Thomas Bushnell, BSG wrote:
>
> On Wed, Oct 19, 2016 at 1:47 PM Pietro Gagliardi <and...@lostsig.net 
> <javascript:>> wrote:
>
>> Manual memory management is a part of life in the C world. defer is the 
>> solution that Go comes up with to situations where explicit cleanup is 
>> necessary, and it's a powerful tool that I'm pretty sure *is* an innovation 
>> Go did first.
>>
>
> Oh my, no. It's a wonderful thing, but it's essentially equivalent to 
> Lisp's UNWIND-PROTECT or (in the outward case) Scheme's dynamic-wind.
>

Unwind-protect and the better known but equivalent try/finally both operate 
at the level of balanced lexical blocks: expressions in Lisp, statement 
blocks in Java or C++.  In contrast, defer operates at the function level 
and requires a dynamic stack, and in that sense it is novel, but I can't 
think of a single time I've actually wanted to defer an action beyond the 
point when try/finally would have executed it.

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to