digitalmars.D.announce - DIP1001: Exception Handling Extensions
- Superstar64 (3/3) Jul 10 2016 link: https://github.com/dlang/DIPs/pull/9
- Stefan Koch (3/6) Jul 10 2016 You don't have to use gc-allocated exceptions anyway.
- Superstar64 (2/8) Jul 10 2016 Can you please explain why it makes chaining impossible?
- Jack Stouffer (4/7) Jul 10 2016 Adding another attribute to the language and having the compiler
- Chris Wright (15/17) Jul 10 2016 DIP1001.md
- Superstar64 (29/46) Jul 10 2016 You could use both c style and d stack unwinding:
- Chris Wright (3/4) Jul 11 2016 I misread that. The tagged union part applies even if the function can
- Lodovico Giaretta (19/27) Jul 10 2016 I'm not convinced by this proposal. Here are some early thoughts:
- Superstar64 (8/37) Jul 10 2016 This proposal allows you to switch between error code handling and
- Basile B. (2/5) Jul 11 2016 https://forum.dlang.org/post/auplvezvpisiufwvddfo@forum.dlang.org
- Seb (7/12) Jul 11 2016 @SuperStar64, please ignore the troll(s) and keep working on your
- Basile B. (4/17) Jul 11 2016 Yes, please get on, even if there's a possibility that you've
- Superstar64 (5/8) Jul 11 2016 I'm not too familiar with stack unwinding generation, but would
- Superstar64 (3/6) Jul 13 2016 I extended this DIP to add @throws(auto) and inference for auto
- Superstar64 (3/6) Jul 15 2016 I decided to close the PR. The my proposal had too many problems
- Andrei Alexandrescu (2/8) Jul 16 2016 Work much appreciated. Looks like the new community process works! -- An...
- Superstar64 (3/5) Jul 16 2016 I'm not sure you understand, I rejected my own PR.
- rikki cattermole (2/6) Jul 16 2016 Exactly! It works :)
- Andrei Alexandrescu (2/6) Jul 18 2016 Understood. Wasn't that due to the community feedback you got? -- Andrei
link: https://github.com/dlang/DIPs/pull/9 file: https://github.com/Superstar64/DIPs/blob/exception_extensions/DIPs/DIP1001.md
Jul 10 2016
On Sunday, 10 July 2016 at 19:55:37 UTC, Superstar64 wrote:link: https://github.com/dlang/DIPs/pull/9 file: https://github.com/Superstar64/DIPs/blob/exception_extensions/DIPs/DIP1001.mdYou don't have to use gc-allocated exceptions anyway. Allowing to throw any type makes chaining impossible.
Jul 10 2016
On Sunday, 10 July 2016 at 20:30:56 UTC, Stefan Koch wrote:On Sunday, 10 July 2016 at 19:55:37 UTC, Superstar64 wrote:Can you please explain why it makes chaining impossible?link: https://github.com/dlang/DIPs/pull/9 file: https://github.com/Superstar64/DIPs/blob/exception_extensions/DIPs/DIP1001.mdYou don't have to use gc-allocated exceptions anyway. Allowing to throw any type makes chaining impossible.
Jul 10 2016
On Sunday, 10 July 2016 at 19:55:37 UTC, Superstar64 wrote:link: https://github.com/dlang/DIPs/pull/9 file: https://github.com/Superstar64/DIPs/blob/exception_extensions/DIPs/DIP1001.mdAdding another attribute to the language and having the compiler do magic behind the scenes? No thanks.
Jul 10 2016
On Sun, 10 Jul 2016 19:55:37 +0000, Superstar64 wrote:link: https://github.com/dlang/DIPs/pull/9 file: https://github.com/Superstar64/DIPs/blob/exception_extensions/DIPs/DIP1001.md So if my function calls any runtime functions -- it allocates memory, slices an array, etc -- I can't use C-style exception handling. Unless I manually do something like: struct ThrowableWrapper { Throwable error; } int[] foo(int i) { try { return [i]; } catch (Throwable t) { throw ThrowableWrapper(t); } }
Jul 10 2016
On Sunday, 10 July 2016 at 21:43:08 UTC, Chris Wright wrote:On Sun, 10 Jul 2016 19:55:37 +0000, Superstar64 wrote:You could use both c style and d stack unwinding: --- struct CustomErrorCode { enum __ErrorCode = true; } struct CustomUnwind { } int foo(int[] arr, int index) throws(Throwable,CustomErrorCode,CustomUnwind) { auto val = arr[index]; // may throw RangeError with d's existing handling if (val == 0xdead) { throw CustomErrorCode(); // throws using new error code handling } else if (val == 0xbad) { throw CustomUnwind(); // throws using new by value unwinding } } --- Or possible wrap your function in a template that catch Unwind exceptions and throws Error Codes.link: https://github.com/dlang/DIPs/pull/9 file: https://github.com/Superstar64/DIPs/blob/exception_extensions/DIPs/DIP1001.md So if my function calls any runtime functions -- it allocates memory, slices an array, etc -- I can't use C-style exception handling. Unless I manually do something like: struct ThrowableWrapper { Throwable error; } int[] foo(int i) { try { return [i]; } catch (Throwable t) { throw ThrowableWrapper(t); } }
Jul 10 2016
On Sun, 10 Jul 2016 21:55:04 +0000, Superstar64 wrote:You could use both c style and d stack unwinding:I misread that. The tagged union part applies even if the function can throw some types that don't participate in the compile-time error system.
Jul 11 2016
On Sunday, 10 July 2016 at 19:55:37 UTC, Superstar64 wrote:link: https://github.com/dlang/DIPs/pull/9 file: https://github.com/Superstar64/DIPs/blob/exception_extensions/DIPs/DIP1001.mdI'm not convinced by this proposal. Here are some early thoughts: 1) Wouldn't a library solution based on functional-style tagged results achieve the same without changing the language and making things less clear (see my other points)? Something on the lines of variant? 2) Wouldn't this make code quite obscure? I mean, now if you see a throw or a catch you know what's going on. With this proposal, when you see a throw or a catch, you have to go look at the declaration of the thrown or catched type to get what's going on. 3) From your proposal, it seems that current exception handling needs the GC, which is not true; you can already do exception handling in nogc code, without any extra quirk. 4) C++ deprecated throw lists; while this does not automatically mean that they are bad, we shall learn from others' errors, and be very careful. But all of this is just my opinion based on a fast read of the proposal. P.S.: something went wrong (probably with copy-pasting) here:A function which calls a sub function with a throws(TypeList) attribute must have alluncaught possible exceptions must be a part of the throws(TypeList) attribute of the caller function.
Jul 10 2016
On Sunday, 10 July 2016 at 21:52:37 UTC, Lodovico Giaretta wrote:On Sunday, 10 July 2016 at 19:55:37 UTC, Superstar64 wrote:This proposal allows you to switch between error code handling and stack unwinding by just switching one line of code.link: https://github.com/dlang/DIPs/pull/9 file: https://github.com/Superstar64/DIPs/blob/exception_extensions/DIPs/DIP1001.mdI'm not convinced by this proposal. Here are some early thoughts: 1) Wouldn't a library solution based on functional-style tagged results achieve the same without changing the language and making things less clear (see my other points)? Something on the lines of variant? 2) Wouldn't this make code quite obscure? I mean, now if you see a throw or a catch you know what's going on. With this proposal, when you see a throw or a catch, you have to go look at the declaration of the thrown or catched type to get what's going on.3) From your proposal, it seems that current exception handling needs the GC, which is not true; you can already do exception handling in nogc code, without any extra quirk.Wouldn't that still require allocation for the exception's message and stack trace?4) C++ deprecated throw lists; while this does not automatically mean that they are bad, we shall learn from others' errors, and be very careful.Throw lists where added because they are required for this to work with incremental compilation.But all of this is just my opinion based on a fast read of the proposal. P.S.: something went wrong (probably with copy-pasting) here:Nothing wrong on my end.A function which calls a sub function with a throws(TypeList) attribute must have alluncaught possible exceptions must be a part of the throws(TypeList) attribute of the caller function.
Jul 10 2016
On Sunday, 10 July 2016 at 19:55:37 UTC, Superstar64 wrote:link: https://github.com/dlang/DIPs/pull/9 file: https://github.com/Superstar64/DIPs/blob/exception_extensions/DIPs/DIP1001.mdhttps://forum.dlang.org/post/auplvezvpisiufwvddfo forum.dlang.org
Jul 11 2016
On Monday, 11 July 2016 at 12:36:59 UTC, Basile B. wrote:On Sunday, 10 July 2016 at 19:55:37 UTC, Superstar64 wrote:SuperStar64, please ignore the troll(s) and keep working on your proposal by incorporating the constructive critic you have received so far. As Dicebot already stated it's very important to provide good & convincing arguments in favor of your proposal because changing a language isn't a simple thing and (may) have wide implications.link: https://github.com/dlang/DIPs/pull/9 file: https://github.com/Superstar64/DIPs/blob/exception_extensions/DIPs/DIP1001.mdhttps://forum.dlang.org/post/auplvezvpisiufwvddfo forum.dlang.org
Jul 11 2016
On Monday, 11 July 2016 at 14:44:08 UTC, Seb wrote:On Monday, 11 July 2016 at 12:36:59 UTC, Basile B. wrote:Yes, please get on, even if there's a possibility that you've been misleaded by a guy who thinks he's a manager, but is not and, maybe has made a "management error".On Sunday, 10 July 2016 at 19:55:37 UTC, Superstar64 wrote:SuperStar64, please ignore the troll(s) and keep working on your proposal by incorporating the constructive critic you have received so far. As Dicebot already stated it's very important to provide good & convincing arguments in favor of your proposal because changing a language isn't a simple thing and (may) have wide implications.link: https://github.com/dlang/DIPs/pull/9 file: https://github.com/Superstar64/DIPs/blob/exception_extensions/DIPs/DIP1001.mdhttps://forum.dlang.org/post/auplvezvpisiufwvddfo forum.dlang.org
Jul 11 2016
On Sunday, 10 July 2016 at 19:55:37 UTC, Superstar64 wrote:link: https://github.com/dlang/DIPs/pull/9 file: https://github.com/Superstar64/DIPs/blob/exception_extensions/DIPs/DIP1001.mdI'm not too familiar with stack unwinding generation, but would generating a separate unwind table for each type(that doesn't inherit from Throwable) be faster than the current handling? Is it worth adding it to the DIP?
Jul 11 2016
On Sunday, 10 July 2016 at 19:55:37 UTC, Superstar64 wrote:link: https://github.com/dlang/DIPs/pull/9 file: https://github.com/Superstar64/DIPs/blob/exception_extensions/DIPs/DIP1001.mdI extended this DIP to add throws(auto) and inference for auto and template functions.
Jul 13 2016
On Sunday, 10 July 2016 at 19:55:37 UTC, Superstar64 wrote:link: https://github.com/dlang/DIPs/pull/9 file: https://github.com/Superstar64/DIPs/blob/exception_extensions/DIPs/DIP1001.mdI decided to close the PR. The my proposal had too many problems with it.
Jul 15 2016
On 07/16/2016 12:51 AM, Superstar64 wrote:On Sunday, 10 July 2016 at 19:55:37 UTC, Superstar64 wrote:Work much appreciated. Looks like the new community process works! -- Andreilink: https://github.com/dlang/DIPs/pull/9 file: https://github.com/Superstar64/DIPs/blob/exception_extensions/DIPs/DIP1001.mdI decided to close the PR. The my proposal had too many problems with it.
Jul 16 2016
On Saturday, 16 July 2016 at 12:42:49 UTC, Andrei Alexandrescu wrote:Work much appreciated. Looks like the new community process works! -- AndreiI'm not sure you understand, I rejected my own PR.
Jul 16 2016
On 17/07/2016 5:35 AM, Superstar64 wrote:On Saturday, 16 July 2016 at 12:42:49 UTC, Andrei Alexandrescu wrote:Exactly! It works :)Work much appreciated. Looks like the new community process works! -- AndreiI'm not sure you understand, I rejected my own PR.
Jul 16 2016
On 07/16/2016 01:35 PM, Superstar64 wrote:On Saturday, 16 July 2016 at 12:42:49 UTC, Andrei Alexandrescu wrote:Understood. Wasn't that due to the community feedback you got? -- AndreiWork much appreciated. Looks like the new community process works! -- AndreiI'm not sure you understand, I rejected my own PR.
Jul 18 2016