TypeInfo in the library

Mike none at none.com
Fri Feb 14 03:26:41 PST 2014


On Friday, 14 February 2014 at 09:09:42 UTC, Benjamin Thaut wrote:
> But that would mean that you have to pull the implementation of 
> casts and other features that rely on TypeInfo right now into 
> the library too. Do you really think this such a good idea? My 
> biggest concern with this is, that when TypeInfo is pulled into 
> phobos, the implementation of TypeInfo is going to depend on 
> _all_ phobos modules, making at lot harder to use D without 
> phobos unless you want to rewrite the entire TypeInfo and all 
> features depending on it.

I think Adam would have to clarify what he meant by "the 
library".  I'd like all the TypeInfo stuff in the runtime, not 
phobos.  According to a conversation I had with Iain Buclaw [1], 
the TypeInfo implementations are broken into two parts:  There's 
the TypeInfo implementations in object.d/di and then there's the 
TypeInfo implementations in D runtime's src/rt/typeinfo folder 
[2].

I don't understand why the two are separated.  Iain just said the 
ones in object.d "are required to be known at compile time for 
certain operations."

I'm too much of a D novice to understand the implications of 
Adam's proposal, but if it's feasible, I think it would be be 
quite useful to those porting D to more limited platforms like I 
am.  Currently I'm fooling the compiler with silly things like...

class TypeInfo_Class : TypeInfo
{
     ubyte[68] ignore;
}

... and that's a dirty hack if I ever saw one.

The runtime might be a good place for it given the consequences 
you've just articulated.  The bottom line, I think, is to get it 
out of the compiler.

Mike

[1] 
http://forum.dlang.org/post/mailman.211.1389183225.15871.digitalmars-d@puremagic.com
[2] 
https://github.com/D-Programming-Language/druntime/tree/master/src/rt/typeinfo


More information about the Digitalmars-d mailing list