reflection: instantiation of objects via class names at runtime
Thomas Kühne
thomas-dloop at kuehne.cn
Sun Dec 3 06:54:04 PST 2006
The attached code allows the instantiation of objects at runtime
requiring only the fully qualified class name.
sample:
#
# import cn.kuehne.reflection;
# ...
# Object o = new_Instance("std.stream.File");
#
limitations:
1) Windows isn't yet supported.
2) The class has to have an explicit "this()" constructor.
compilation:
1) gcc -m32 -c elf.c
2) dmd -c reflection.d
3) dmd <what ever> elf.o reflection.o
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: reflection.zip
Type: application/zip
Size: 5093 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20061203/e006a3cb/attachment.zip>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 155 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20061203/e006a3cb/attachment.pgp>
More information about the Digitalmars-d
mailing list