A TODO for somebody: Full Reflection Gets You Smarter GC
Frits van Bommel
fvbommel at REMwOVExCAPSs.nl
Mon Nov 20 17:03:34 PST 2006
Russ Lewis wrote:
> Sorry, I don't have time to look into this in detail, but I'll post this
> idea so somebody else can explore it:
>
> It is possible to have a smarter GC using compile-time reflection. I
> haven't had time to explore the members-tuple feature (was it .members,
> or .membersof?), but if that tuple gives us both the offset into the
> type *and* the type of the member, then we can construct a GC which
> knows the types of certain allocations, and knows which elements in
> those allocations are pointers and which are other data. At least, it
> can know this information in allocations where it knows the type. In
> cases where it doesn't know the type, it can default to the old scheme
> (treat all possible pointers as pointers).
>
> A thought.
I actually had the exact same idea this morning :). I've experimented a
bit this afternoon trying to get type information using some templates
but stopped when DMD kept crashing on me :(. [1]
I have yet to find a syntax that'll get DMD to generate a compile-time
array of structs.
It seems the current tuples implementation is a bit... unstable.
[1]: I'm not sure if someone's already added 'my' crashes to bugzilla,
the search feature wasn't much help and I didn't have time to reduce
them to small samples yet. Maybe tomorrow evening.
More information about the Digitalmars-d
mailing list