usable @nogc Exceptions with Mir Runtime

Atila Neves atila.neves at gmail.com
Thu Nov 1 13:00:12 UTC 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:
>> ~ 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.

https://github.com/atilaneves/nogc/blob/ed4663558ceea1f5dc2634d6f01cc6ce6967adc1/tests/ut/exception.d#L49


More information about the Digitalmars-d-announce mailing list