How to get to a class initializer through introspection?
Johan
j at j.nl
Thu Aug 6 12:58:22 UTC 2020
Hi Johannes,
Can you rewrite your email without all the GDC implementation
details? Let's keep the discussion backend-agnostic.
The questions to solve are:
Q1 - What do we expose to the user? (an init symbol, an init
function, typeid pointer to symbol/function for dynamic types...
?) User code should be able to reset an object to the init state.
Currently user code can do that without compile-time knowledge of
the dynamic type of an object.
Q2 - Do we want to take care of initialization in druntime or
inside the compilers? (currently it is done inside the compilers,
and each backend does things its own way as long as it complies
with the answer to Q1. Array comparison was moved from the
compilers into druntime. It's the same kind of discussion.).
At the moment, we only provide user code dynamic access to
initializer symbol through typeid.initializer. The idea in this
thread was to add a way to have 'static' access that preserves
type information (e.g. doing initialization by calling a druntime
template function with type as template parameter).
cheers,
Johan
More information about the Digitalmars-d
mailing list