View mode: basic / threaded / horizontal-split · Log in · Help
July 23, 2005
TypeInfo request
Currently the TypeInfo support for dynamic arrays is split into arrays of 
primitives and everything else. For example an array of ints has TypeInfo_Ai 
which subclasses TypeInfo while an array of strings (char[]) has 
TypeInfo_Array with a next field of type TypeInfo that has an instance of 
TypeInfo_Aa (which is the TypeInfo for a string).

As I've been messing around with std.format getting better array support 
I've noticed it would be nice to have a more consistent model. For example 
having TypeInfo_Ai subclass TypeInfo_Array with the next field set to 
TypeInfo_int would help.

Also having TypeInfo_Array and TypeInfo_AssociativeArray have foreach hooks 
would be very handy. Currently I don't want to add AA support to doFormat 
since it would require calling _aaApply and making assumptions about how 
foreach is implemented. For dynamic arrays I'm looping over the contents by 
hand since the layout isn't compiler dependent.
July 25, 2005
Re: TypeInfo request
In article <dbucsl$12u7$1@digitaldaemon.com>, Ben Hinkle says...
>
>Currently the TypeInfo support for dynamic arrays is split into arrays of 
>primitives and everything else. For example an array of ints has TypeInfo_Ai 
>which subclasses TypeInfo while an array of strings (char[]) has 
>TypeInfo_Array with a next field of type TypeInfo that has an instance of 
>TypeInfo_Aa (which is the TypeInfo for a string).
>
>As I've been messing around with std.format getting better array support 
>I've noticed it would be nice to have a more consistent model. For example 
>having TypeInfo_Ai subclass TypeInfo_Array with the next field set to 
>TypeInfo_int would help.
>
>Also having TypeInfo_Array and TypeInfo_AssociativeArray have foreach hooks 
>would be very handy. Currently I don't want to add AA support to doFormat 
>since it would require calling _aaApply and making assumptions about how 
>foreach is implemented. For dynamic arrays I'm looping over the contents by 
>hand since the layout isn't compiler dependent. 
>

I'll second this.  D's TypeInfo system has been great up until now, but its
starting to come up short when compared to all the other improvments D has seen
over the last few years.  At the very least, Ben's suggestions for improvment
should be taken seriously.  

Moreover, I also think that D should move towards a more comprehensive type
system in D if any changes to TypeInfo are considered; that's something else
that Ben also knows a thing or two about. ;)

- EricAnderton at yahoo
Top | Discussion index | About this forum | D home