On Sun, 07 Dec 2014 05:42:31 +0000 bitwise via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
what you actually want is some cross-module compile-time data storage. this is impossible to implement. at least to make it reliable. with separate compilation, for example, you can't get list of "all modules", 'cause we can link other unimported modules to the final executable. this is somethimes useful with "extern", for example. and there is no such thing as "main module" too, so there is no "root" for symbols. besides, some templates can be not instantiated at the time you doing compile-time reflection, for example. that is why my console-ng requires that "register all" mixin must be the last line in the module. with some efforts and hackery you can walk all imported modules, but this can fail at unexpected places. tl;dr: things aren't that easy when it comes to compile-time reflection. either live that to runtime or write compile-time wrappers and restrict compile-time reflection usage to well-defined places and patterns.
signature.asc
Description: PGP signature