D's Destructors are What Scott Meyers Warned Us About

12345swordy alexanderheistermann at gmail.com
Sun May 27 16:06:21 UTC 2018


On Sunday, 27 May 2018 at 09:55:56 UTC, Mike Franklin wrote:
> On Friday, 25 May 2018 at 23:47:33 UTC, sarn wrote:
>
>> [...]
>
> 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

You are replacing runtime typeinfo with compiletime templates. 
Unless you can guarantee that the type information won't change 
during runtime, you are going to have a hard time.

Alex


More information about the Digitalmars-d mailing list