digitalmars.D.announce - usable nogc Exceptions with Mir Runtime
- 9il (44/44) Oct 24 2018 Hello
- jmh530 (2/12) Oct 24 2018 Cool. Keep up the good work.
- Oleg (3/16) Oct 30 2018 I don't understand why you choose C++ format style instead of
- 9il (6/23) Oct 31 2018 The C++ format style is simpler to implement and it is much
- Uknown (3/8) Oct 31 2018 I think they meant why use the `<<` operator instead of the `~`
- bauss (3/11) Oct 31 2018 This.
- 9il (4/12) Oct 31 2018 ~ is used for string concatenation in D including string compile
- bauss (10/14) Nov 01 2018 I see what your argument is now for it, BUT I would still have
- Atila Neves (2/16) Nov 01 2018 https://github.com/atilaneves/nogc/blob/ed4663558ceea1f5dc2634d6f01cc6ce...
- 9il (8/22) Nov 01 2018 Well, added at v0.0.8 [1].
- bauss (2/11) Nov 01 2018 Thanks!
- Manu (5/22) Nov 02 2018 Perhaps this is a stupid question... but there's clearly `new
- 9il (3/28) Nov 02 2018 The code requires -dip1008 flag. Take a look into the DIP
- Nathan S. (2/5) Oct 31 2018 Fantastic!
Hello Mir Runtime [1] is Dlang nogc runtime infrastructure for a simple, slim, and fast code. It is based on Mir Core [2] and compatible with Mir Algorithm [3] >=v3.0.0-alpha-dev. Mir Runtime should be used with flags -dip1000, -dip1008 and optionally -dip25. Release v0.0.5 comes with - mir.exception - nogc MirException - mir.format - nogc formatting Mir Runtime uses a combination of DIP1000 [4] and DIP1008 [5]. Example ======================= /// safe pure nothrow nogc unittest { import mir.exception; import mir.format; try throw new MirException(stringBuf() << "Hi D" << 2 << "!" << getData); catch(Exception e) assert(e.msg == "Hi D2!"); } ======================= If the message is non-scope string MirException constructor uses the message data itself (zero-copy). If the message is scope const array of char with the size no greater then 447 bytes, MirException constructor uses local buffer preallocated by DRuntime, otherwise, MirException allocates memory using C's malloc. Knows Issues: - DRuntime Issue 19317 [6] cause memory leaks for messages that have a size greater than 447 bytes. This work has been sponsored by Symmetry Investments [7] and Kaleidic Associates [8]. 1. https://github.com/libmir/mir-runtime 2. https://github.com/libmir/mir-core 3. https://github.com/libmir/mir-algorithm 4. https://github.com/dlang/DIPs/blob/master/DIPs/DIP1000.md 5. https://github.com/dlang/DIPs/blob/master/DIPs/DIP1008.md 6. https://issues.dlang.org/show_bug.cgi?id=19317 7. http://symmetryinvestments.com/ 8. http://github.com/kaleidicassociates Best regards, Ilya Yaroshenko
Oct 24 2018
On Wednesday, 24 October 2018 at 10:57:27 UTC, 9il wrote:Hello Mir Runtime [1] is Dlang nogc runtime infrastructure for a simple, slim, and fast code. It is based on Mir Core [2] and compatible with Mir Algorithm [3] >=v3.0.0-alpha-dev. Mir Runtime should be used with flags -dip1000, -dip1008 and optionally -dip25. Release v0.0.5 comes with - mir.exception - nogc MirException - mir.format - nogc formatting [snip]Cool. Keep up the good work.
Oct 24 2018
Thanks for your work!Example ======================= /// safe pure nothrow nogc unittest { import mir.exception; import mir.format; try throw new MirException(stringBuf() << "Hi D" << 2 << "!" << getData); catch(Exception e) assert(e.msg == "Hi D2!"); } =======================I don't understand why you choose C++ format style instead of D-style format?
Oct 30 2018
On Tuesday, 30 October 2018 at 16:25:12 UTC, Oleg wrote:Thanks for your work!The C++ format style is simpler to implement and it is much faster to run. D's style came from C and Boost's format. Also, the C++ style is more low level then format strings, so they can be built on top of it.Example ======================= /// safe pure nothrow nogc unittest { import mir.exception; import mir.format; try throw new MirException(stringBuf() << "Hi D" << 2 << "!" << getData); catch(Exception e) assert(e.msg == "Hi D2!"); } =======================I don't understand why you choose C++ format style instead of D-style format?
Oct 31 2018
On Wednesday, 31 October 2018 at 08:34:08 UTC, 9il wrote:The C++ format style is simpler to implement and it is much faster to run. D's style came from C and Boost's format. Also, the C++ style is more low level then format strings, so they can be built on top of it.I think they meant why use the `<<` operator instead of the `~` operator?
Oct 31 2018
On Wednesday, 31 October 2018 at 09:13:14 UTC, Uknown wrote:On Wednesday, 31 October 2018 at 08:34:08 UTC, 9il wrote:This. Please don't do that.The C++ format style is simpler to implement and it is much faster to run. D's style came from C and Boost's format. Also, the C++ style is more low level then format strings, so they can be built on top of it.I think they meant why use the `<<` operator instead of the `~` operator?
Oct 31 2018
On Wednesday, 31 October 2018 at 09:13:14 UTC, Uknown wrote:On Wednesday, 31 October 2018 at 08:34:08 UTC, 9il wrote:~ is used for string concatenation in D including string compile time constant concatenation. It is better not to override it because both << and ~ can be used in the same expression.The C++ format style is simpler to implement and it is much faster to run. D's style came from C and Boost's format. Also, the C++ style is more low level then format strings, so they can be built on top of it.I think they meant why use the `<<` operator instead of the `~` operator?
Oct 31 2018
On Wednesday, 31 October 2018 at 13:56:56 UTC, 9il wrote:~ is used for string concatenation in D including string compile time constant concatenation. It is better not to override it because both << and ~ can be used in the same expression.I see what your argument is now for it, BUT I would still have left it out because it's not idiomatic D and an alternative would have been better if you absolutely had to rely on ~ being used within the expression to combine both. Ex. try throw new MirException(stringBuf().append("Hi D", 2, "!", getData); Would have been a much better approach similar to how write/writeln etc. work from std.stdio.
Nov 01 2018
On Thursday, 1 November 2018 at 10:17:25 UTC, bauss wrote:On Wednesday, 31 October 2018 at 13:56:56 UTC, 9il wrote:https://github.com/atilaneves/nogc/blob/ed4663558ceea1f5dc2634d6f01cc6ce6967adc1/tests/ut/exception.d#L49~ is used for string concatenation in D including string compile time constant concatenation. It is better not to override it because both << and ~ can be used in the same expression.I see what your argument is now for it, BUT I would still have left it out because it's not idiomatic D and an alternative would have been better if you absolutely had to rely on ~ being used within the expression to combine both. Ex. try throw new MirException(stringBuf().append("Hi D", 2, "!", getData); Would have been a much better approach similar to how write/writeln etc. work from std.stdio.
Nov 01 2018
On Thursday, 1 November 2018 at 10:17:25 UTC, bauss wrote:On Wednesday, 31 October 2018 at 13:56:56 UTC, 9il wrote:Well, added at v0.0.8 [1]. Mir Runtime formatting and exceptions are CTFE-able if a msg fits into a local buffer and support user-defined types formatting. Note, that toString function must be scope const. mir.parse was added in v0.0.7. Currently, only integer types are supported. 1. https://github.com/libmir/mir-runtime/pull/2~ is used for string concatenation in D including string compile time constant concatenation. It is better not to override it because both << and ~ can be used in the same expression.I see what your argument is now for it, BUT I would still have left it out because it's not idiomatic D and an alternative would have been better if you absolutely had to rely on ~ being used within the expression to combine both. Ex. try throw new MirException(stringBuf().append("Hi D", 2, "!", getData); Would have been a much better approach similar to how write/writeln etc. work from std.stdio.
Nov 01 2018
On Friday, 2 November 2018 at 05:21:07 UTC, 9il wrote:On Thursday, 1 November 2018 at 10:17:25 UTC, bauss wrote:Thanks![...]Well, added at v0.0.8 [1]. Mir Runtime formatting and exceptions are CTFE-able if a msg fits into a local buffer and support user-defined types formatting. Note, that toString function must be scope const. mir.parse was added in v0.0.7. Currently, only integer types are supported. 1. https://github.com/libmir/mir-runtime/pull/2
Nov 01 2018
On Tue, Oct 30, 2018 at 9:30 AM Oleg via Digitalmars-d-announce <digitalmars-d-announce puremagic.com> wrote:Thanks for your work!Perhaps this is a stupid question... but there's clearly `new MirException` right there in that code. How is this nogc?Example ======================= /// safe pure nothrow nogc unittest { import mir.exception; import mir.format; try throw new MirException(stringBuf() << "Hi D" << 2 << "!" << getData); catch(Exception e) assert(e.msg == "Hi D2!"); } =======================I don't understand why you choose C++ format style instead of D-style format?
Nov 02 2018
On Friday, 2 November 2018 at 07:00:49 UTC, Manu wrote:On Tue, Oct 30, 2018 at 9:30 AM Oleg via Digitalmars-d-announce <digitalmars-d-announce puremagic.com> wrote:The code requires -dip1008 flag. Take a look into the DIP https://github.com/dlang/DIPs/blob/master/DIPs/DIP1008.mdThanks for your work!Perhaps this is a stupid question... but there's clearly `new MirException` right there in that code. How is this nogc?Example ======================= /// safe pure nothrow nogc unittest { import mir.exception; import mir.format; try throw new MirException(stringBuf() << "Hi D" << 2 << "!" << getData); catch(Exception e) assert(e.msg == "Hi D2!"); } =======================I don't understand why you choose C++ format style instead of D-style format?
Nov 02 2018
On Wednesday, 24 October 2018 at 10:57:27 UTC, 9il wrote:Release v0.0.5 comes with - mir.exception - nogc MirException - mir.format - nogc formattingFantastic!
Oct 31 2018