Object - part of the language, or part of Phobos?

Jonathan M Davis jmdavisProg at gmx.com
Fri Sep 30 22:44:29 PDT 2011


On Saturday, October 01, 2011 05:38:45 Steve Teale wrote:
> module smem;
> 
> import std.stdio;
> 
> struct X
> {
>    int n;
>    double d;
>    char[] a;
> }
> 
> void main()
> {
>    X x;
>    TypeInfo typeinfo = typeid(x);                  // or typeid(x) for that
> matter writefln("%s", typeinfo);                           // smem.X
>    OffsetTypeInfo[] tia = typeinfo.offTi();        // "Get type information
> on the contents of the type; null if not available"
>    writeln((tia is null)? "null": "");                 // null
>    // Under what circumstances is the OffsetTypeInfo information available?
> }

Object is part of druntime, so it's in neither the language itself nor Phobos, 
but it's fairly closely tied to the language. It's in object_.d in druntime.

- Jonathan M Davis


More information about the Digitalmars-d mailing list