[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #59192] unwind_protect objects should accept l
From: |
John W. Eaton |
Subject: |
[Octave-bug-tracker] [bug #59192] unwind_protect objects should accept lambda expressions |
Date: |
Sun, 27 Sep 2020 11:47:09 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0 |
Follow-up Comment #2, bug #59192 (project octave):
Copying my comments from the discourse thread:
I recommend that you use an unwind_action object instead of unwind_protect.
The unwind_action object can only perform one cleanup action, but it can
already handle std::function objects and lambda expressions. Using that object
is also more efficient than unwind_protect because the unwind_protect object
must instantiate a std::stack object to hold the list of actions.
Separately, we might want to deprecate the unwind_protect object? It
originally made sense because there was a single global stack of actions and a
set of functions to operate on that stack. But then Jaroslav converted it to
use the present structure in which the actions are managed on a per-scope
basis using the destructor of the unwind_protect object. But we only ever need
to protect a few things (at most) in a given scope, so the overhead of
creating the std::stack object can be significant. In nearly all cases, it
probably makes more sense to just use a set of unwind_action variables instead
of a single unwind_protect object.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?59192>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #59192] unwind_protect objects should accept lambda expressions, Markus Mützel, 2020/09/27
- [Octave-bug-tracker] [bug #59192] unwind_protect objects should accept lambda expressions, Markus Mützel, 2020/09/27
- [Octave-bug-tracker] [bug #59192] unwind_protect objects should accept lambda expressions, Markus Mützel, 2020/09/27
- [Octave-bug-tracker] [bug #59192] unwind_protect objects should accept lambda expressions,
John W. Eaton <=
- [Octave-bug-tracker] [bug #59192] unwind_protect objects should accept lambda expressions, Markus Mützel, 2020/09/27
- [Octave-bug-tracker] [bug #59192] unwind_protect objects should accept lambda expressions, John W. Eaton, 2020/09/27
- [Octave-bug-tracker] [bug #59192] unwind_protect objects should accept lambda expressions, John W. Eaton, 2020/09/27
- [Octave-bug-tracker] [bug #59192] unwind_protect objects should accept lambda expressions, John W. Eaton, 2020/09/27
- [Octave-bug-tracker] [bug #59192] unwind_protect objects should be replaced with lighter weight alternatives, Rik, 2020/09/27
- [Octave-bug-tracker] [bug #59192] unwind_protect objects should be replaced with lighter weight alternatives, John W. Eaton, 2020/09/28
- [Octave-bug-tracker] [bug #59192] unwind_protect objects should be replaced with lighter weight alternatives, Rik, 2020/09/28
- [Octave-bug-tracker] [bug #59192] unwind_protect objects should be replaced with lighter weight alternatives, John W. Eaton, 2020/09/28
- [Octave-bug-tracker] [bug #59192] unwind_protect objects should be replaced with lighter weight alternatives, Markus Mützel, 2020/09/28
- [Octave-bug-tracker] [bug #59192] unwind_protect objects should be replaced with lighter weight alternatives, John W. Eaton, 2020/09/28