On Tue, 12 Jun 2012 02:16:19 -0700, timotheecour <thelastmamm...@gmail.com> wrote:

mixin Instantiate!(foo,int);
Thanks for the syntax tip!

You could use cp instead of dmd -H.
That won't produce the same output (eg large functions tend to be stripped currently), but I guess the current behavior is relatively useless so it's fine.


want you are after. Such a thing could actually be done except
for OMF/Optlink. Since OMF doesn't support custom sections
there is a no special place to store the code that the compiler
could easily access.


If we want to embed the AST inside an "import" library file (which is optional, could be done with a directory), wouldn't it be possible to store the AST as a global / static variable? When dmd compiles myfun.d, it generates the AST and inserts a global variable (eg void*_ast_myfun=...) in the data segment of the library/object file (that could be done with a mixin and be portable).

just started a new thread for related ideas: http://forum.dlang.org/thread/lmepufogzaxlbxwgu...@forum.dlang.org
thanks!


Theoretically yes, but it's extremely poor form for the compiler to be adding variables to programmer created structures especially when said variables are only ever going to be used by the compiler.

--
Adam Wilson
IRC: LightBender
Project Coordinator
The Horizon Project
http://www.thehorizonproject.org/

Reply via email to