Re: How to check that import module will succeed?

2019-07-26 Thread evilrat via Digitalmars-d-learn
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

Re: How to check that import module will succeed?

2019-07-26 Thread Adam D. Ruppe via Digitalmars-d-learn
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 }

Re: How to check that import module will succeed?

2019-07-26 Thread Andrey Zherikov via Digitalmars-d-learn
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

Re: How to check that import module will succeed?

2019-07-26 Thread Andrey Zherikov via Digitalmars-d-learn
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

Re: How to check that import module will succeed?

2019-07-26 Thread Andrey Zherikov via Digitalmars-d-learn
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

Re: How to check that import module will succeed?

2019-07-26 Thread Paul Backus via Digitalmars-d-learn
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

Re: How to check that import module will succeed?

2019-07-26 Thread Anonymouse via Digitalmars-d-learn
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;

Re: How to check that import module will succeed?

2019-07-25 Thread evilrat via Digitalmars-d-learn
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

How to check that import module will succeed?

2019-07-25 Thread Andrey Zherikov via Digitalmars-d-learn
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

Re: Is it possible to escape a reserved keyword in Import/module?

2019-06-19 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 19 June 2019 at 21:21:53 UTC, XavierAP wrote: On Wednesday, 19 June 2019 at 18:56:57 UTC, BoQsc wrote: I would like to make sure that my modules do not interfere with d lang. Is there any way to escape reserved words? The only reason C# allows this is for interop or code genera

Re: Is it possible to escape a reserved keyword in Import/module?

2019-06-19 Thread XavierAP via Digitalmars-d-learn
On Wednesday, 19 June 2019 at 18:56:57 UTC, BoQsc wrote: I would like to make sure that my modules do not interfere with d lang. Is there any way to escape reserved words? The only reason C# allows this is for interop or code generation for other languages that use the same keyword. For examp

Re: Is it possible to escape a reserved keyword in Import/module?

2019-06-19 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 19 June 2019 at 19:07:30 UTC, Jonathan M Davis wrote: On Wednesday, June 19, 2019 12:56:57 PM MDT BoQsc via Digitalmars-d-learn wrote: I would like to make sure that my modules do not interfere with d lang. Is there any way to escape reserved words? https://dlang.org/spec/lex.htm

Re: Is it possible to escape a reserved keyword in Import/module?

2019-06-19 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, June 19, 2019 12:56:57 PM MDT BoQsc via Digitalmars-d-learn wrote: > I would like to make sure that my modules do not interfere with d > lang. Is there any way to escape reserved words? > https://dlang.org/spec/lex.html#keywords > > > import alias; > > C:\Users\Juozas\Desktop\om.d(2

Is it possible to escape a reserved keyword in Import/module?

2019-06-19 Thread BoQsc via Digitalmars-d-learn
I would like to make sure that my modules do not interfere with d lang. Is there any way to escape reserved words? https://dlang.org/spec/lex.html#keywords import alias; C:\Users\Juozas\Desktop\om.d(2): Error: identifier expected following import C:\Users\Juozas\Desktop\om.d(2): Error: ;

Re: Import module

2015-07-10 Thread codenstuff via Digitalmars-d-learn
On Friday, 10 July 2015 at 10:22:39 UTC, anonymous wrote: On Friday, 10 July 2015 at 00:53:38 UTC, codenstuff wrote: On Friday, 10 July 2015 at 00:24:44 UTC, anonymous wrote: [...] [...] The path is ${HOME}/d_apps/steering/steering/game_object.d Compile command is dmd map/map.d main_visual

Re: Import module

2015-07-10 Thread anonymous via Digitalmars-d-learn
On Friday, 10 July 2015 at 00:53:38 UTC, codenstuff wrote: On Friday, 10 July 2015 at 00:24:44 UTC, anonymous wrote: On Thursday, 9 July 2015 at 22:05:23 UTC, codenstuff wrote: I am trying to import module and compile. The compiler produces message map/map.d(9): Error: module game_object is

Re: Import module

2015-07-10 Thread anonymous via Digitalmars-d-learn
On Friday, 10 July 2015 at 03:11:25 UTC, Mike Parker wrote: On Friday, 10 July 2015 at 00:53:38 UTC, codenstuff wrote: The path is ${HOME}/d_apps/steering/steering/game_object.d [...] First, because you are importing sterring.game_object, then you can't pass -I/home/real/d_apps/steering to

Re: Import module

2015-07-09 Thread Mike Parker via Digitalmars-d-learn
On Friday, 10 July 2015 at 00:53:38 UTC, codenstuff wrote: The path is ${HOME}/d_apps/steering/steering/game_object.d Compile command is dmd map/map.d main_visual.d -ofmain_visual -H -gc -unittest -L-lDgame -L-lDerelictUtil -L-lDerelictGL3 -L-lDerelictSDL2 -L-ldl -I/home/real/d_apps/dgame/so

Re: Import module

2015-07-09 Thread codenstuff via Digitalmars-d-learn
On Friday, 10 July 2015 at 00:24:44 UTC, anonymous wrote: On Thursday, 9 July 2015 at 22:05:23 UTC, codenstuff wrote: I am trying to import module and compile. The compiler produces message map/map.d(9): Error: module game_object is in file 'steering/game_object.d' which cann

Re: Import module

2015-07-09 Thread anonymous via Digitalmars-d-learn
On Thursday, 9 July 2015 at 22:05:23 UTC, codenstuff wrote: I am trying to import module and compile. The compiler produces message map/map.d(9): Error: module game_object is in file 'steering/game_object.d' which cannot be read import path[0] = /usr/include/dmd/phobos import path

Re: Import module

2015-07-09 Thread codenstuff via Digitalmars-d-learn
On Thursday, 9 July 2015 at 22:10:53 UTC, Adam D. Ruppe wrote: The best thing to do is to pass all the modules in the project to the compiler at once, so like: dmd map/map.d steering/game_object.d The import path could be changed to not include the steering/ folder - give it the folder that c

Re: Import module

2015-07-09 Thread Adam D. Ruppe via Digitalmars-d-learn
The best thing to do is to pass all the modules in the project to the compiler at once, so like: dmd map/map.d steering/game_object.d The import path could be changed to not include the steering/ folder - give it the folder that contains steering - but that still won't actually link without a

Import module

2015-07-09 Thread codenstuff via Digitalmars-d-learn
I am trying to import module and compile. The compiler produces message map/map.d(9): Error: module game_object is in file 'steering/game_object.d' which cannot be read import path[0] = /usr/include/dmd/phobos import path[1] = /usr/include/dmd/druntime/import make: *** [main] Error

Re: [import,module] got biting again :(

2010-11-08 Thread Don
bearophile wrote: Don: Bug 314 is the root cause of every module bug that I know of. Basically the compiler isn't keeping track of how symbols got imported. So it gets everything wrong. Bug 314 is among my voted bugs since a lot of time. Actually it was the most voted bug in D, long befor

Re: [import,module] got biting again :(

2010-11-08 Thread bearophile
Don: > Bug 314 is the root cause of every module bug that I know of. Basically > the compiler isn't keeping track of how symbols got imported. So it gets > everything wrong. Bug 314 is among my voted bugs since a lot of time. Even if bug 314 isn't the only module system bug present, solving it

Re: [import,module] got biting again :(

2010-11-08 Thread Don
bearophile wrote: Don: There's only really one. But it's huge. Really? :-) I didn't know this. (You are very often right, but I have a hard time believing this). Bye, bearophile Bug 314 is the root cause of every module bug that I know of. Basically the compiler isn't keeping track of ho

Re: [import,module] got biting again :(

2010-11-07 Thread bearophile
Don: > There's only really one. But it's huge. Really? :-) I didn't know this. (You are very often right, but I have a hard time believing this). Bye, bearophile

Re: [import,module] got biting again :(

2010-11-07 Thread Don
%u wrote: Yay, free access to a! I searched for this bug in the bug-reports.. Why are there so many basic import bugs? There's only really one. But it's huge.

Re: [import,module] got biting again :(

2010-10-14 Thread bearophile
%u: > Why are there so many basic import bugs? Module system bugs are among the most voted in Bugzilla. True modules are absent in C/C++, so maybe Walter thinks assuring their semantics is correct is not so important compared to other kinds of bugs, or maybe such bugs are hard to fix, I don't

[import,module] got biting again :(

2010-10-14 Thread %u
Yay, free access to a! I searched for this bug in the bug-reports.. Why are there so many basic import bugs? -- module main; import b; void main(){ a.write(); } -- module a; import std.stdio; void write(){ writefln("a"); } -- module b; import a; //also with static --