On Sunday, 22 November 2015 at 10:01:48 UTC, Kagamin wrote:
As an idiomatic option there can be `finally(exit)`,
`finally(success)` and `finally(failure)` that would mirror
semantics of scope guards.
how does this differ from just putting a scope(failure) inside
the try block?
it only trigger
As an idiomatic option there can be `finally(exit)`,
`finally(success)` and `finally(failure)` that would mirror
semantics of scope guards.
On Sunday, November 22, 2015 07:41:40 Mike Parker via Digitalmars-d-learn wrote:
> On Saturday, 21 November 2015 at 13:57:01 UTC, Shriramana Sharma
> wrote:
> >
> > Hmm – I forgot Python has `else` for `for` and `while` too. But
> > it's a tad difficult to wrap one's mind around the meaning of
> >
On Saturday, 21 November 2015 at 13:57:01 UTC, Shriramana Sharma
wrote:
Hmm – I forgot Python has `else` for `for` and `while` too. But
it's a tad difficult to wrap one's mind around the meaning of
the word `else` in this particular context whereas it actually
means `nobreak`.
In a way `for`
On Saturday, 21 November 2015 at 13:57:01 UTC, Shriramana Sharma
wrote:
Hmm – I forgot Python has `else` for `for` and `while` too. But
it's a tad difficult to wrap one's mind around the meaning of
the word `else` in this particular context whereas it actually
means `nobreak`. Perhaps if this
On Sat, 2015-11-21 at 19:26 +0530, Shriramana Sharma via Digitalmars-d-
learn wrote:
>
[…]
> Hmm – I forgot Python has `else` for `for` and `while` too. But it's
> a tad
> difficult to wrap one's mind around the meaning of the word `else` in
> this
> particular context whereas it actually means
Russel Winder via Digitalmars-d-learn wrote:
> else on for and while, whilst technically redundant as well, does
> occasionally make for a nicer read, for very analogous reasons. It can
> generally avoid the need for extra booleans and other state variables.
Hmm – I forgot Python has `else` for `
On Fri, 2015-11-20 at 22:39 -0800, Ali Çehreli via Digitalmars-d-learn
wrote:
>
[…]
> I don't know what idiom that enables in Python but it feels to me
> like
> putting the statements right after the ones that could throw suffices
> in
> D (and Python):
The else clause for while, for, try, has
On 11/20/2015 09:45 PM, Shriramana Sharma wrote:
Hello. In Python one has the syntax try..except..else.. where code in the
else clause will only be executed if an exception does not occur. (Ref:
http://stackoverflow.com/a/22579805/1503120)
In D, is there such an idiomatic/canonical construct? Th
On Saturday, 21 November 2015 at 05:55:53 UTC, Shriramana Sharma
wrote:
rsw0x wrote:
scope(failure) can be used to run code when an exception is
thrown inside the scope, and scope(success) only triggers if
the
scope exited successfully
http://ddili.org/ders/d.en/scope.html
Thanks but I kno
Shriramana Sharma wrote:
> In Python one has the syntax try..except..else.. where code in the
> else clause will only be executed if an exception does not occur. (Ref:
> http://stackoverflow.com/a/22579805/1503120)
Official Python documentation:
https://docs.python.org/3/reference/compound_stmts
rsw0x wrote:
> scope(failure) can be used to run code when an exception is
> thrown inside the scope, and scope(success) only triggers if the
> scope exited successfully
>
> http://ddili.org/ders/d.en/scope.html
Thanks but I know that and it executes only at the point of scope exit. But
I want
On Saturday, 21 November 2015 at 05:45:37 UTC, Shriramana Sharma
wrote:
Hello. In Python one has the syntax try..except..else.. where
code in the else clause will only be executed if an exception
does not occur. (Ref:
http://stackoverflow.com/a/22579805/1503120)
In D, is there such an idiomat
13 matches
Mail list logo