Thread overview | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
February 26, 2006 DMD 0.148 - scope guard | ||||
---|---|---|---|---|
| ||||
Scope guards are a novel feature no other language has. They're based on Andrei Alexandrescu's scope guard macros, which have led to considerable interest in the idea. Check out the article www.digitalmars.com/d/exception-safe.html |
February 26, 2006 Re: DMD 0.148 - scope guard | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | Walter Bright wrote:
> Scope guards are a novel feature no other language has. They're based
> on Andrei Alexandrescu's scope guard macros, which have led to
> considerable interest in the idea. Check out the article www.digitalmars.com/d/exception-safe.html
Neat!
|
February 26, 2006 Re: DMD 0.148 - scope guard | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Sun, 26 Feb 2006 13:06:36 +1100, Walter Bright <newshound@digitalmars.com> wrote: > Scope guards are a novel feature no other language has. They're based on > Andrei Alexandrescu's scope guard macros, which have led to considerable > interest in the idea. Check out the article > www.digitalmars.com/d/exception-safe.html Wow! I know of one other language that (almost) implements this. Does 'scope' mean any type scope, and not just function scope? For example, can it include module scope? ... if/while/for/foreach scope? ... block scope? And I assume 'statement' can be a block of statements ... on_exit_scope { stmt1; stmt2; ... stmtn;} -- Derek Parnell Melbourne, Australia |
February 26, 2006 Re: DMD 0.148 - scope guard | ||||
---|---|---|---|---|
| ||||
Posted in reply to Derek Parnell | "Derek Parnell" <derek@psych.ward> wrote in message news:op.s5j942tp6b8z09@ginger.vic.bigpond.net.au... > Wow! I know of one other language that (almost) implements this. Which one? > Does 'scope' mean any type scope, and not just function scope? For example, can it include module scope? ... if/while/for/foreach scope? ... block scope? Yes. > And I assume 'statement' can be a block of statements ... > > on_exit_scope { stmt1; stmt2; ... stmtn;} Yup. (The C++ macro version is limited to a single function call with argument.) |
February 26, 2006 Re: DMD 0.148 - scope guard | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Sun, 26 Feb 2006 14:51:45 +1100, Walter Bright <newshound@digitalmars.com> wrote: > > "Derek Parnell" <derek@psych.ward> wrote in message > news:op.s5j942tp6b8z09@ginger.vic.bigpond.net.au... >> Wow! I know of one other language that (almost) implements this. > > Which one? Progess. Its a Database 4GL. It handles the on_exit, on_failure situations but not to the extent that D now does with the 'statement' flexibility. A very neat solution. -- Derek Parnell Melbourne, Australia |
February 26, 2006 Re: DMD 0.148 - scope guard | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | In article <dtr2fg$2vqr$4@digitaldaemon.com>, Walter Bright says... > >Scope guards are a novel feature no other language has. They're based on Andrei Alexandrescu's scope guard macros, which have led to considerable interest in the idea. Check out the article www.digitalmars.com/d/exception-safe.html Again the release is very nice! A question: I seemed to miss the scope guard discussion (whatever). Can you enlighten me with an example (or guide me with a link) to illustrate the usefulness of this feature? Thanks, P.S.: In the new docs for the scope guard stuff there is a TYPO at "[snip] close of the scope, they also are interleaved with the OnScopeStatements in the reverse *lexeical* order in which they appear." Tom; |
February 26, 2006 Re: DMD 0.148 - scope guard | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tom | "Tom" <Tom_member@pathlink.com> wrote in message news:dtrakc$6lo$1@digitaldaemon.com... > A question: I seemed to miss the scope guard discussion (whatever). Can > you > enlighten me with an example (or guide me with a link) to illustrate the > usefulness of this feature? This article has some good examples: www.digitalmars.com/d/exception-safe.html Also, do a google groups search on "Alexandrescu on_scope_exit" for a good thread on it. > > Thanks, > > P.S.: In the new docs for the scope guard stuff there is a TYPO at "[snip] > close > of the scope, they also are interleaved with the OnScopeStatements in the > reverse *lexeical* order in which they appear." Thanks, I'll fix it. |
February 26, 2006 Re: DMD 0.148 - scope guard | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | Walter Bright wrote:
> Scope guards are a novel feature no other language has. They're based on Andrei Alexandrescu's scope guard macros, which have led to considerable interest in the idea. Check out the article www.digitalmars.com/d/exception-safe.html
>
>
Nice feature, but rather ugly to look at; although, I'm not sure how something like that could be made to look pretty. Nonetheless the scope guard looks like something I should read up on.
Thanks for another good release.
-JJR
|
February 26, 2006 Re: DMD 0.148 - scope guard | ||||
---|---|---|---|---|
| ||||
Posted in reply to John Reimer | "John Reimer" <terminal.node@gmail.com> wrote in message news:dtrg0e$c9k$1@digitaldaemon.com... > Nice feature, but rather ugly to look at; although, I'm not sure how something like that could be made to look pretty. I think it's ugly, too, but I just couldn't come up with anything significantly better. > Nonetheless the scope guard looks like something I should read up on. > > Thanks for another good release. You're welcome. |
February 26, 2006 Re: DMD 0.148 - scope guard | ||||
---|---|---|---|---|
| ||||
Posted in reply to John Reimer | John Reimer wrote:
> Walter Bright wrote:
>> Scope guards are a novel feature no other language has. They're based on Andrei Alexandrescu's scope guard macros, which have led to considerable interest in the idea. Check out the article www.digitalmars.com/d/exception-safe.html
>>
>>
>
>
> Nice feature, but rather ugly to look at; although, I'm not sure how something like that could be made to look pretty. Nonetheless the scope guard looks like something I should read up on.
>
> Thanks for another good release.
>
> -JJR
I thought the same, perhaps the "scope" portion is understood? So that the keywords become: onsuccess, onfailure, ...?
|
Copyright © 1999-2021 by the D Language Foundation