On Tue, 20 Jan 2015 20:51:34 -0500
Steven Schveighoffer via Digitalmars-d <digitalmars-d@puremagic.com>
wrote:

> >> You can always put @nogc on the dtor if you want.
> > seems that you completely missing my point. (sigh)
> 
> Nope, not missing it. The mechanics are there. You just have to annotate.
that is where you missing it. your answer is like "hey, C has all
mechanics for doing OOP with virtual methods and type checking, you
just have to write the code!"

the whole point of my talk was "free programmer from writing the
obvious and setup some red tapes for beginners".

> What's the first thing you do if you aren't sure your destructors are 
> running?
> 
> ~this() { writeln("in dtor"); }
> 
> oops, sorry, can't do that, it's @nogc! I don't think this is a tenable 
> situation.
but it is! first: we can loosen that restriction somehow for `debug`
parts. your sample should be read like this then:

  ~this () { debug writeln("in dtor"); }

second: it's `writeln` who is bad. one of the reasons that motivated me
to write my `iv.writer` was that `std.stdio.write` is not `@nogc`, and
so it was completely unusable in any of my `@nogc` functions. even
something that simple as `writeln("hi!")` was a disaster (both `@gc`
and `@canthrow`).

this is a sign that Phobos needs some simple output API that can be
used in `@nogc` and `nothrow` functions without hackery.

Attachment: signature.asc
Description: PGP signature

Reply via email to