digitalmars.D - Goto into catch blocks
- Iain Buclaw (14/14) Sep 12 2011 I have been merging Phobos that got released with the latest DMD release...
- dsimcha (14/19) Sep 12 2011 Great. I was wondering what happened here since you usually merge Phobo...
- Iain Buclaw (3/22) Sep 12 2011 OK, thanks.
- Jonathan M Davis (9/31) Sep 12 2011 Regardless of whether you have commit access, anything other than really...
- Timon Gehr (11/18) Sep 12 2011 Where does it say that a goto into a catch block is categorically
- Iain Buclaw (22/44) Sep 12 2011 In terms of codegen for such, you will still pass through any cleanup th...
- Timon Gehr (2/28) Sep 13 2011 OK, that is a reason. Thanks. What exactly is done in the cleanup block?
I have been merging Phobos that got released with the latest DMD release into GDC. And couldn't help but notice this nostalgic error I implemented a while back: std/format.d:1520: Error: cannot goto into catch block Line of concern in phobos: https://github.com/D-Programming-Language/phobos/blob/master/std/format.d#L1539 Part of spec which error implements: http://www.digitalmars.com/d/2.0/statement.html#GotoStatement I have discussed such code before and why it should be disallowed: http://www.digitalmars.com/d/archives/digitalmars/D/Behaviour_of_goto_into_catch_blocks._116908.html And I have raised a pull request (though I seem to recall I had commit access granted a while back - though this was before the move to github): https://github.com/D-Programming-Language/phobos/pull/253 Regards Iain
Sep 12 2011
== Quote from Iain Buclaw (ibuclaw ubuntu.com)'s articleI have been merging Phobos that got released with the latest DMD release into GDC.Great. I was wondering what happened here since you usually merge Phobos and DMD at the same time, and I'm very excited that the last few showstopper bugs got fixed and GDC may actually be usable now.And I have raised a pull request (though I seem to recall I had commit access granted a while back - though this was before the move to github): https://github.com/D-Programming-Language/phobos/pull/253Generally you should use pull requests even if you have commit access, so that the code gets reviewed by at least one other person. This has led to major improvements in the code quality in Phobos. The exception is for "trivial" things. There's a little disagreement about where the line should be drawn. I draw it at simple one- or a few-liner bug fixes in code I understand well, and reverting recent changes that cause build problems. These and anything simpler, I push directly. Anything more complicated, I think review is worthwhile. Others seem to think that basically any change to actual code is non-trivial, though I think this is excessively bureaucratic and would only follow it if there was a very strong consensus and a written rule in our dev guidelines.
Sep 12 2011
== Quote from dsimcha (dsimcha yahoo.com)'s article== Quote from Iain Buclaw (ibuclaw ubuntu.com)'s articleA very particular change to arraytypes in the frontend was the reason for that. :o)I have been merging Phobos that got released with the latest DMD release into GDC.Great. I was wondering what happened here since you usually merge Phobos and DMD at the same time, and I'm very excited that the last few showstopper bugs got fixed and GDC may actually be usable now.OK, thanks.And I have raised a pull request (though I seem to recall I had commit access granted a while back - though this was before the move to github): https://github.com/D-Programming-Language/phobos/pull/253Generally you should use pull requests even if you have commit access, so that the code gets reviewed by at least one other person. This has led to major improvements in the code quality in Phobos. The exception is for "trivial" things. There's a little disagreement about where the line should be drawn. I draw it at simple one- or a few-liner bug fixes in code I understand well, and reverting recent changes that cause build problems. These and anything simpler, I push directly. Anything more complicated, I think review is worthwhile. Others seem to think that basically any change to actual code is non-trivial, though I think this is excessively bureaucratic and would only follow it if there was a very strong consensus and a written rule in our dev guidelines.
Sep 12 2011
On Monday, September 12, 2011 15:27 Iain Buclaw wrote:I have been merging Phobos that got released with the latest DMD release into GDC. And couldn't help but notice this nostalgic error I implemented a while back: std/format.d:1520: Error: cannot goto into catch block Line of concern in phobos: https://github.com/D-Programming-Language/phobos/blob/master/std/format.d#L 1539 Part of spec which error implements: http://www.digitalmars.com/d/2.0/statement.html#GotoStatement I have discussed such code before and why it should be disallowed: http://www.digitalmars.com/d/archives/digitalmars/D/Behaviour_of_goto_into_ catch_blocks._116908.html And I have raised a pull request (though I seem to recall I had commit access granted a while back - though this was before the move to github): https://github.com/D-Programming-Language/phobos/pull/253Regardless of whether you have commit access, anything other than really trivial changes (such as updates to the changelog) should still go through pull requests. At this point having commit access is more about being able to merge in other people's pull requests that have been adequately reviewed than being able to commit your own changes. However, if you want commit access again, then ping Walter about it, and he should be able to give you commit access. - Jonathan M Davis
Sep 12 2011
On 09/13/2011 12:27 AM, Iain Buclaw wrote:I have been merging Phobos that got released with the latest DMD release into GDC. And couldn't help but notice this nostalgic error I implemented a while back: std/format.d:1520: Error: cannot goto into catch block Line of concern in phobos: https://github.com/D-Programming-Language/phobos/blob/master/std/format.d#L1539 Part of spec which error implements: http://www.digitalmars.com/d/2.0/statement.html#GotoStatementWhere does it say that a goto into a catch block is categorically banned? It only says that a goto cannot skip a variable initialization. catch(Type){} and catch{} are valid forms too. Neither one contains a declaration. Sure, usually a goto into a catch block means that someone is abusing exceptions for regular control flow, but if you just want a quick and dirty hack, or if a third-party API forces you to, I don't think the language should stand in your way.
Sep 12 2011
== Quote from Timon Gehr (timon.gehr gmx.ch)'s articleOn 09/13/2011 12:27 AM, Iain Buclaw wrote:Which it does in this situation (what is initialising UtfException e?).I have been merging Phobos that got released with the latest DMD release into GDC. And couldn't help but notice this nostalgic error I implemented a while back: std/format.d:1520: Error: cannot goto into catch block Line of concern in phobos: https://github.com/D-Programming-Language/phobos/blob/master/std/format.d#L1539 Part of spec which error implements: http://www.digitalmars.com/d/2.0/statement.html#GotoStatementWhere does it say that a goto into a catch block is categorically banned? It only says that a goto cannot skip a variable initialization.catch(Type){} and catch{} are valid forms too. Neither one contains a declaration. Sure, usually a goto into a catch block means that someone is abusing exceptions for regular control flow, but if you just want a quick and dirty hack, or if a third-party API forces you to, I don't think the language should stand in your way.In terms of codegen for such, you will still pass through any cleanup that was generated when the catch block ends (ie: builtin unwind routines). Think of your latter example as being rewritten as: try { // questionable user code } catch { try { // user catch code } finally { // compiler generated clean-up block } } Regards Iain
Sep 12 2011
On 09/13/2011 08:58 AM, Iain Buclaw wrote:== Quote from Timon Gehr (timon.gehr gmx.ch)'s articleOK, that is a reason. Thanks. What exactly is done in the cleanup block?On 09/13/2011 12:27 AM, Iain Buclaw wrote:Which it does in this situation (what is initialising UtfException e?).I have been merging Phobos that got released with the latest DMD release into GDC. And couldn't help but notice this nostalgic error I implemented a while back: std/format.d:1520: Error: cannot goto into catch block Line of concern in phobos: https://github.com/D-Programming-Language/phobos/blob/master/std/format.d#L1539 Part of spec which error implements: http://www.digitalmars.com/d/2.0/statement.html#GotoStatementWhere does it say that a goto into a catch block is categorically banned? It only says that a goto cannot skip a variable initialization.catch(Type){} and catch{} are valid forms too. Neither one contains a declaration. Sure, usually a goto into a catch block means that someone is abusing exceptions for regular control flow, but if you just want a quick and dirty hack, or if a third-party API forces you to, I don't think the language should stand in your way.In terms of codegen for such, you will still pass through any cleanup that was generated when the catch block ends (ie: builtin unwind routines).
Sep 13 2011