What type functions mean on a language level
sighoya
sighoya at gmail.com
Sat Jan 2 17:28:20 UTC 2021
On Saturday, 2 January 2021 at 16:29:17 UTC, Stefan Koch wrote:
> The reason I use the new primitive type __type__ is because
> typeid is meant for RTTI, and it's runtime dependent.
Yes, but I think not for types.
> Whereas __type__ is a proper langauge builtin.
> And therefore it can use builtin properties.
> I would not be able to expose .sizeof as the .sizeof property
> for example if I used some typeinfo class.
I don't understand this, could we define properties on any type?
Or are built-in properties only allowed for built-in types.
Note, we have tsized and talign properties for a TypeInfo
structure.
See: https://dlang.org/library/object/type_info.html
> In short the look & feel would suffer.
Hmm, what about extending TypeInfo to have sizeof and the other
properties referring to tsize and talign?
> By using a less integrated design.
My thought is to reuse existing structures.
More information about the Digitalmars-d
mailing list