On Saturday, 6 February 2016 at 22:51:45 UTC, cy wrote:
auto e = somethingThatFails()
scope(failure) cleanup(e);
makes more sense to me, since it's blatantly obvious that the
construction (and entering) process isn't covered by the
cleanup routine.
Not sure what you mean by that.
On Saturday, 6 February 2016 at 14:25:21 UTC, Ola Fosheim Grøstad
wrote:
See, even Python supports this. :-)
And D supports the "with" statement in python, in the form of
"scope()" statements. The D way is slightly less misleading too,
as
with somethingThatFails() as e:
print(e)
doesn't
On Saturday, 6 February 2016 at 06:08:41 UTC, cy wrote:
Sorry, years of python programming have made me shy of
destructors. It just looks a little less "magic" to me if I
specify the destruction explicitly after creating the object,
using the "scope(exit)" syntax.
That is error-prone!
In
On Friday, 5 February 2016 at 07:31:24 UTC, cy wrote:
I think you might be talking about two very different concepts
here. Unwinding only happens within the context of a certain
scope.
The object itself is the scope (RAII). If you can test for
"uncaught_exceptions" you can implement the
On Friday, 5 February 2016 at 08:16:05 UTC, Ola Fosheim Grøstad
wrote:
If you can test for "uncaught_exceptions" you can implement the
equivalent of scope(failure/success) etc within destructors.
Sorry, years of python programming have made me shy of
destructors. It just looks a little less
On Thursday, 4 February 2016 at 10:03:13 UTC, Jonathan M Davis
wrote:
On Wednesday, February 03, 2016 23:55:42 Ali Çehreli via
Digitalmars-d-learn wrote:
std::uncaught_exception used to be considered useless:
I think that the only case I've ever had for it was for a unit
testing framework
On Wednesday, February 03, 2016 23:55:42 Ali Çehreli via Digitalmars-d-learn
wrote:
> std::uncaught_exception used to be considered useless:
I think that the only case I've ever had for it was for a unit testing
framework where I wanted to use RAII to print something when the tests
failed (and
On Wednesday, 3 February 2016 at 11:09:00 UTC, Ola Fosheim
Grøstad wrote:
Is there some reliable way to detect that a destructor is
called because of exception unwinding?
I basically want to change behaviour within a destructor based
on whether the destructor is called as a result of a
On Wednesday, 3 February 2016 at 21:35:38 UTC, Jonathan M Davis
wrote:
https://issues.dlang.org
At least that way, it's kept track of, though I certainly have
no idea when it might be implemented (presumably when someone
needs it enough that they take the time to do so).
Thanks, I think I
On 02/03/2016 03:47 AM, Ola Fosheim Grøstad wrote:
On Wednesday, 3 February 2016 at 11:41:28 UTC, Jonathan M Davis wrote:
AFAIK, there is no way to detect whether an exception is in flight or
not aside from the cases where scope(failure) or catch would catch the
exception, and from what I
On Thursday, 4 February 2016 at 07:55:42 UTC, Ali Çehreli wrote:
std::uncaught_exception used to be considered useless:
http://www.gotw.ca/gotw/047.htm
Does that apply to D?
I've read that one, but Herb Sutter does not provide an argument,
just a claim that having different semantics on
Is there some reliable way to detect that a destructor is called
because of exception unwinding?
I basically want to change behaviour within a destructor based on
whether the destructor is called as a result of a regular or an
exceptional situation.
E.g. commit changes to a database on
On Wednesday, 3 February 2016 at 11:41:28 UTC, Jonathan M Davis
wrote:
AFAIK, there is no way to detect whether an exception is in
flight or not aside from the cases where scope(failure) or
catch would catch the exception, and from what I recall of the
last time that someone asked this
On Wednesday, February 03, 2016 11:09:00 Ola Fosheim Grøstad via
Digitalmars-d-learn wrote:
> Is there some reliable way to detect that a destructor is called
> because of exception unwinding?
>
> I basically want to change behaviour within a destructor based on
> whether the destructor is called
On Wednesday, February 03, 2016 11:47:35 Ola Fosheim Grøstad via
Digitalmars-d-learn wrote:
> On Wednesday, 3 February 2016 at 11:41:28 UTC, Jonathan M Davis
> wrote:
> > AFAIK, there is no way to detect whether an exception is in
> > flight or not aside from the cases where scope(failure) or
> >
On 2016-02-03 12:09, Ola Fosheim Grøstad wrote:
Is there some reliable way to detect that a destructor is called because
of exception unwinding?
I basically want to change behaviour within a destructor based on
whether the destructor is called as a result of a regular or an
exceptional
On Wednesday, 3 February 2016 at 12:44:39 UTC, Jacob Carlborg
wrote:
* Worst case scenario, override "_d_throwc" [2]
For the trace handler and overriding "_d_throwc" you would just
use the default implementation plus store a boolean (or
counter) in a TLS variable indicating an exception has
17 matches
Mail list logo