Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2023-12-02 15:37:39


Andrey Semashev wrote:
> I'm not opposed to renaming, as long as the new name is short and not
> misleading. I'm not familiar with Go (presumably, from which the name
> comes), so I can't tell how similar the semantics of the feature in Go
> is to the proposed library.

In Go, defer takes a function call expression:

    defer fclose( fp );

and captures the arguments as-if by value, evaluating them at the point
of defer, not at the point where the function is called. It's like

    BOOST_SCOPE_FINAL std::bind( fclose, fp );

In Swift, defer takes a block:

defer
{
    fclose( fp );
}

I have no idea what the capture semantics are there.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk