One step out of the TypeInfo stalemate
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Sat Jul 25 18:28:46 UTC 2020
On 7/25/20 1:31 PM, Timon Gehr wrote:
> On 25.07.20 18:34, Andrei Alexandrescu wrote:
>> `.object.__getTypeInfo!MyStruct()`. That function uses a singleton
>> with lazy allocation.
>
> What prevents putting it into the static data segment?
Great idea. That can be done in the function, like here:
https://github.com/dlang/phobos/blob/master/std/experimental/allocator/package.d#L996
The overriding principle is take out trickery and magic out of the
compiler and imbue the language itself with the power to express such
things. Ideally the compiler would be a consistent lowering machine to a
small core language with carefully defined semantics. Haskell does that:
https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/compiler/core-syn-type
It seems our community is favorable of the notion but the attitude has
not quite dyed in our wool yet. Walter himself is not yet 100% there.
If we value that, typeid(Type) and typeid(expression) would lower to one
of the simpler known expressions - a function call that requires no
special compiler support.
More information about the Digitalmars-d
mailing list