Beta 2.079.0

Mike Franklin slavo5150 at yahoo.com
Tue Feb 20 09:10:17 UTC 2018


On Tuesday, 20 February 2018 at 08:46:02 UTC, meppl wrote:

> @"16.": https://dlang.org/changelog/2.079.0.html#minimal_runtime
>
> So, now someone could "easily" write his own memory managment 
> for allocations who would be usually done by the default GC - 
> e.g. classes?

Easily? unlikely, but it's probably possible.  For example, 
whenever you use `new` to instantiate a class, it calls 
`_d_newclass` 
(https://github.com/dlang/druntime/blob/098a08a9593a8e265a9b02da55bda53393f3d5c1/src/rt/lifetime.d#L66).  You could potentially make that do something different.  You will, unfortunately, need some implement some "infrastructure" to get it to work, namely `ClassInfo` which is an alias for `TypeInfo`.

At the moment the runtime is heavily dependent on `TypeInfo` for 
type information that's already known at compile-time, which 
stinks.  To mitigate that some of us are working on modifying the 
the compiler/runtime interface to use templates instead.  That 
would allow implementing the runtime hooks without requiring so 
much of the infrastructure.

Btw, this is all possible now even without the features of 2.079. 
  2.079 just allows one to do this more incrementally.  It's still 
a long way from being a pleasant experience, but it's getting 
better.

Mike




More information about the Digitalmars-d-announce mailing list