On Friday, 26 July 2019 at 14:56:37 UTC, Andrey Zherikov wrote:
Even without static if I get the same result:
mixin template my_import(alias modName)
{
mixin("import " ~ modName ~ ";");
}
mixin my_import!"mymod";
pragma(msg,fullyQualifiedName!(myfunc)); // Error:
undefined identifier
On Friday, 26 July 2019 at 03:42:58 UTC, Andrey Zherikov wrote:
Is there a way to check whether some module, say "foo", is
available for import before doing "import foo"?
static if (is(typeof((){import that.module.here;}))) {
// it is available
}
On Friday, 26 July 2019 at 14:19:05 UTC, Paul Backus wrote:
version(HasStdio)
import std.stdio;
else
pragma(msg, "std.stdio is not available");
Then configure your build system to pass `-version=HasStdio` to
dmd (or the equivalent flag to ldc or gdc) when std.stdio is
available.
I wa
On Friday, 26 July 2019 at 14:14:11 UTC, Anonymouse wrote:
I use __traits(compiles, __traits(identifier, moduleName)) now
instead and it seems to work.
I couldn't find "identifier" docs on
https://dlang.org/phobos/std_traits.html. But I tried and it
doesn't work - I think because is unknown
On Friday, 26 July 2019 at 06:24:18 UTC, evilrat wrote:
On Friday, 26 July 2019 at 03:42:58 UTC, Andrey Zherikov wrote:
Is there a way to check whether some module, say "foo", is
available for import before doing "import foo"?
I did some really retarded utility like this in the past,
worked f
On Friday, 26 July 2019 at 03:42:58 UTC, Andrey Zherikov wrote:
Is there a way to check whether some module, say "foo", is
available for import before doing "import foo"?
I want to create a function that imports module if it's
available or does something else otherwise. So I think the code
shou
On Friday, 26 July 2019 at 06:24:18 UTC, evilrat wrote:
On Friday, 26 July 2019 at 03:42:58 UTC, Andrey Zherikov wrote:
bool isModuleAvailable(alias modName)() {
mixin("import " ~ modName ~ ";");
static if (__traits(compiles, mixin(modName).stringof))
return true;
On Friday, 26 July 2019 at 03:42:58 UTC, Andrey Zherikov wrote:
Is there a way to check whether some module, say "foo", is
available for import before doing "import foo"?
I did some really retarded utility like this in the past, worked
for me, but I can't say it is that well tested and there m
Is there a way to check whether some module, say "foo", is
available for import before doing "import foo"?
I want to create a function that imports module if it's available
or does something else otherwise. So I think the code should look
something like this:
mixin template my_import(alias mod