D's Destructors are What Scott Meyers Warned Us About
Mike Franklin
slavo5150 at yahoo.com
Sun May 27 09:55:56 UTC 2018
On Friday, 25 May 2018 at 23:47:33 UTC, sarn wrote:
> That std.signals code that Steven filed a bug report for is
> example of why we can't just fix the behaviour, though. If we
> just fixed __dtor/__xdtor, any code that used std.signals would
> start having ugly bugs at run time.
>
> I think that longer term we'll have to deprecate and remove
> these functions.
I'm very much interested in doing something about these
functions. __xdtor is just one. There are others at
https://github.com/dlang/druntime/blob/54ab96e9977e0c6baa7ed9740810058fd4aec6ef/src/object.d#L1212-L1229. __xtoHash is currently causing problems at https://github.com/dlang/dmd/pull/8222
TypeInfo has become my nemesis. I've been trying to replace
runtime hooks that depend on TypeInfo with templates that can get
their information at compile-time, but I'm running into all sorts
of problems. e.g. Did you know array.length can be set in @safe
nothrow pure code, but it lowers to runtime functions that are
neither @safe, nothrow, nor pure?
Anyway, I'm getting better at modifying the compiler/runtime
interface. If we can come up with a solution to this mess, and I
can understand it, I might be able to implement it.
Mike
More information about the Digitalmars-d
mailing list