On Sunday, 16 August 2015 at 01:51:36 UTC, Adam D. Ruppe wrote:
On Sunday, 16 August 2015 at 01:39:54 UTC, DarthCthulhu wrote:
How would one store the Property objects in the
PropertyCollection?
You don't, not like that anyway. The attach call is the ruin of
it. If it was all one definition, you could use something like
std.typecons.Tuple, but multiple calls to attach need to be a
runtime function, which means what you attach will lose the
compile time type when you get it.
I see. Yeah, I thought that might be the case. Nice to know I
wasn't just being ignorant.
That would work. You could write a plain struct definition and
then the attach could be implemented as a allMembers/getMember
assignment loop, similarly to this:
http://stackoverflow.com/questions/31993705/d-call-a-function-using-a-string-variable-with-its-name/31996526#31996526
but looking at data member assignments instead of method calls.
Oh, neat! Thanks!
Incidentally, I watched your dconf2015 talk "Dynamic Types in D".
That (along with Andrei's "Generic Programming Must Go") actually
inspired me to think about this particular problem. It's very
appropriate that you would have the solution, then!