Exceptions in @nogc code

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Wed Apr 5 16:49:00 PDT 2017


On 4/5/2017 5:07 AM, deadalnix wrote:
> You can do that, but that's 100% equivalent to:
>
>>    try { ... }
>>    catch (scope Exception e) { ... }
>
> Unless you want to do something specific with the owned case ? You seems to be
> under the impression that this does anything specific for catch/throw when it
> doesn't.

Your original proposal listed 3 different kinds of catch, now it seems 
different. It's clear to me that this is more of an idea than a proposal - a lot 
more work needs to go into it.

For example, adding an `owned` type constructor is a major, major language 
change. Issues of implicit conversion, overloading, covariance, partial 
ordering, type deduction, mangling, construction, postblit, TypeInfo, inout, 
etc., all have to be addressed and worked out. Then there's legacy 
compatibility, deprecation issues, interaction with other languages, interaction 
with multiple storage allocators, etc.

The C# paper is 5 years old, and it has not been adopted by C# for unknown 
reasons. C# is a much more constrained language than D is, making it more 
practical for C#. It not being adopted by C# suggests problems with it - perhaps 
it doesn't deliver the promised results enough to justify its cost?

Making this work for D involves a great deal of careful design work, and even 
more implementation work. It also includes some significant risk that it will 
prove unworkable.

I don't believe that a back-and-forth disjointed email chain here is going to 
resolve the major issues with it. Until a far more thorough design proposal is 
made, I'm going to bow out.


More information about the Digitalmars-d mailing list