Proposal 2: Exceptions and @nogc

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Sun Apr 9 17:28:54 PDT 2017


On 4/9/2017 4:14 PM, Jack Stouffer wrote:
> 1. This still adds another special case to the language under the guise of not
> breaking backward compatibility. This is exactly how C++ became the mess it is
> today.
>
> 2. You're adding in ref-counting in an area where it's only available to one
> very specific part of the language. This is one of the reasons people don't like
> Go: it offers language features only in specific places at the compiler devs
> discretion. It would be far better to ACTUALLY add in ref-counting as a real
> part of the language (like Andrei has been pushing for the past two years, RCStr
> anyone?). Or to go with deadalnix's scheme which would allow it to be part of
> the library and @safe. This would allow it to be used in other areas in user
> code where it makes sense.

You're right, it is a special case. On the other hand, it adds no new syntax at 
all, and the amount of code breakage should be very small (we'll see). Because 
of that, it should be upwards compatible if a more general scheme is devised, 
and it solves an immediate need.


> For the fourth time:
>
> You're missing the forrest for the trees. D needs a general solution to the
> problem of GC code in Phobos. This tackles one specific area via special case
> but leaves every other GC allocation in Phobos, with no way to make it @safe
> @nogc. These will either require the holistic approach eventually or more
> special cases.

I'm not missing it. I'm well aware of that, though it is incorrect that GC code 
cannot be made @safe. It is implicitly safe.

Disagreeing with something is not the same as being unaware of it, ignoring it, 
etc. There have been many partial solutions proposed, and many promising ones 
that turned out to have fatal flaws. Rust has a total solution, but it comes at 
a very high cost - applications have to be re-engineered to use it, not just add 
some annotations.

Bob Vila waving his hand with "Just install track lighting" just isn't good 
enough :-)

   https://www.youtube.com/watch?v=P9FHlhWqbus&feature=youtu.be&t=17

If it was as easy as installing track lighting, why aren't there any languages 
with pointers and memory safe ref counting (other than Rust)?

D will get memory safe ref counting (DIP1000 enables that), but it will be for 
structs, not classes. Exceptions are classes.


More information about the Digitalmars-d mailing list