I have ctfe generated code which requires generating import statements so symbols can be looked up(avoiding the need to have to manually import modules).

1. Allow identical import statements not throw an error.
import std.conv : to;
import std.conv : to;

throws error

Error 1 Error: alias main.to conflicts with alias main.to at main.d(5)

such errors make it difficult to write generated code with weak state information(since ctfe's can store global state data.

2. Allow if an isImported statement which checks if a symbol is imported. This can reduce unnecessary import statements.


I get around 1 by using a table to store the import statements, but, again, this only works inside the ctfe call since the table can't be global. Multiple code generation in the scope may produce the issue.

Reply via email to