Re: " include imported modules in the compilation " should exclude di file
On Monday, 9 March 2020 at 13:55:08 UTC, Calvin P wrote: The current compiler "-i=module_name" option will include imported modules as source code. When the module define from di file extension, I think compiler should avoid treat it as source file. What do you think? Sounds sensible. Can you raise a bug report ?
need help to get member function const address
I use this code to get member function address on runtime: = struct A { this(){}; } auto ctor = (&__traits(getMember, A.init,"__ctor")).funcptr; = my question is, how to get it in compile time like static function address: = struct A { void d(){}; static void fn(){}; } enum FN = // static method address is ok enum A0 = &(A.d).funcptr; // Error: need this for d of type void() enum A1 = (&__traits(getMember, A,"d")).funcptr; // Error: no property funcptr for type void function() enum A2 = (&__traits(getMember, A.init,"d")).funcptr; // Error: (().d).funcptr cannot be evaluated at compile time =
Re: dub libs from home directory on windows
On Wednesday, 18 March 2020 at 19:53:58 UTC, jmh530 wrote: On Wednesday, 18 March 2020 at 15:10:52 UTC, Виталий Фадеев wrote: On Wednesday, 18 March 2020 at 13:52:20 UTC, Abby wrote: I cannot build my app, so I was wondering if there is some clever way to solve this without hardcoded path to my profile name. Thank you very much for your help. I see, you want without hardcoded path... I usually something like ./folder/file.extension to avoid a hardcoded path. I also recommend taking a look at some other dub files to get a sense of how others do it. Even better option is to just use "libs" section as usual(no paths, just names) and set environment variable specific to your machine prior to build. For MS linker it is 'LIB' with semicolon as delimiter, for Linux it is 'LIBRARY_PATH'. This way it is much more 'portable' and CI friendly, though it definitely will add confusion and 'annoyance' for first time users. example batch: set LIB=C:\someproject\libs;E:\superduper\lib64 dub build
Re: dub libs from home directory on windows
On Wednesday, 18 March 2020 at 15:10:52 UTC, Виталий Фадеев wrote: On Wednesday, 18 March 2020 at 13:52:20 UTC, Abby wrote: I cannot build my app, so I was wondering if there is some clever way to solve this without hardcoded path to my profile name. Thank you very much for your help. I see, you want without hardcoded path... I usually something like ./folder/file.extension to avoid a hardcoded path. I also recommend taking a look at some other dub files to get a sense of how others do it.
Re: OR in version conditional compilation
On Wednesday, 18 March 2020 at 16:23:26 UTC, IGotD- wrote: you get the idea. So is this possible at all or do you have to duplicate the code for each version identifier despite they are equal for many version identifiers? The usual workaround is to define a common version, e.g. version(X86) version = X86_ANY version(X86_64) version = X86_ANY version(X86_ANY) { // your code here }
Re: OR in version conditional compilation
On 3/18/20 12:23 PM, IGotD- wrote: I have not seen any example where version has several OR matches. Example idiom: version(X86_64 || X86) { } else version(ARM || Thumb) { }... you get the idea. So is this possible at all or do you have to duplicate the code for each version identifier despite they are equal for many version identifiers? No, it's not possible. And it won't ever be possible, Walter is dead-set against it. If you want to know the history, look wy back in the forums. This question comes up every so often. There is a workaround though: template v(string versionID) { mixin("version(" ~ versionID ~ ") enum v = true; else enum v = false;"); } static if(v!"X86_64" || v!"X86") ... -Steve
OR in version conditional compilation
I have not seen any example where version has several OR matches. Example idiom: version(X86_64 || X86) { } else version(ARM || Thumb) { }... you get the idea. So is this possible at all or do you have to duplicate the code for each version identifier despite they are equal for many version identifiers?
Re: dub libs from home directory on windows
On Wednesday, 18 March 2020 at 13:52:20 UTC, Abby wrote: I cannot build my app, so I was wondering if there is some clever way to solve this without hardcoded path to my profile name. Thank you very much for your help. I see, you want without hardcoded path...
Re: dub libs from home directory on windows
On Wednesday, 18 March 2020 at 13:52:20 UTC, Abby wrote: Hi there, I'm using d2sqlite3 which has dependency on sqlite3.lib. When I'm building my app on windows I have a dub.sdl which has a line libs "%USERPROFILE%/AppData/Local/dub/packages/d2sqlite3-0.18.3/d2sqlite3/lib/win64/sqlite3" platform="windows-x86_64-dmd" but unless I specify full path using specific user profile name on windows like so "c:/user/abby/AppData/Local/dub/packages/d2sqlite3-0.18.3/d2sqlite3/lib/win64/sqlite3" I cannot build my app, so I was wondering if there is some clever way to solve this without hardcoded path to my profile name. Thank you very much for your help. I see it in CairoD. dub.json { ... "configurations": [ { "name": "unittest", "targetType": "executable", "mainSourceFile": "unittest.d", "versions": ["CairoPNG"], "targetPath": "bin", "libs-posix": ["cairo"], "libs-windows-x86-dmd": ["lib/32/mars/cairo"], "libs-windows-x86-gdc": ["lib/32/msvc_mingw/cairo"], "libs-windows-x86-ldc": ["lib/32/msvc_mingw/cairo"], "libs-windows-x86_64": ["lib/64/cairo"], "copyFiles-windows-x86": ["lib/32/*.dll"], "copyFiles-windows-x86_64": ["lib/64/*.dll"] } ] } folders: ./ lib/ 32/ mars/ cairo.lib msvc_mingw/ cairo.lib 64/ cairo.lib
Re: dub libs from home directory on windows
On Wednesday, 18 March 2020 at 13:52:20 UTC, Abby wrote: Hi there, I'm using d2sqlite3 which has dependency on sqlite3.lib. When I'm building my app on windows I have a dub.sdl which has a line libs "%USERPROFILE%/AppData/Local/dub/packages/d2sqlite3-0.18.3/d2sqlite3/lib/win64/sqlite3" platform="windows-x86_64-dmd" but unless I specify full path using specific user profile name on windows like so "c:/user/abby/AppData/Local/dub/packages/d2sqlite3-0.18.3/d2sqlite3/lib/win64/sqlite3" I cannot build my app, so I was wondering if there is some clever way to solve this without hardcoded path to my profile name. Thank you very much for your help. Of course, you will use "sqlite3.lib" instead "cairo.lib".
Re: @future attribute / @future keyword?
On 3/18/20 6:20 AM, WebFreak001 wrote: I have read about @future before being some kind of opposite of deprecated. However when trying to search about it now again I can't find any mentions of it anywhere except on https://dlang.org/spec/traits.html#isFuture It's difficult enough to search for "future" but even if limiting it to the spec it's the only search result: https://www.google.com/search?domains=dlang.org=google-search=%40future=dlang.org%2Fspec There is this "future compiler concept": https://forum.dlang.org/post/hjdstwzhcbrektlij...@forum.dlang.org which now is however leads to a dead link, so here is a fixed link: https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1007.md In the grammar @future isn't mentioned at all, has it been removed from the language but the trait was left over? Maybe the documentation here should be improved to avoid confusion. Honestly, I think that concept was never fully implemented (or maybe followed properly). Simply because there has not been much complaint about symbols being added "too quickly". 99.99% of the time, you add a symbol to a module, and there are no ill effects. The problem at the time was a significant one for Sociomantic, I believe because of a change that they needed for switching from Tango to druntime. If you grep druntime, there are 2 usages, both from about 2-3 years ago. Both were either submitted by sociomantic, or asked to add the @__future attribute from them. I'm guessing that either interest was lost in keeping this up, or didn't notice when things were added, and it didn't affect them. Seems like all the focus was on the exception hierarchy (which needs TLC anyway). Maybe someone from that org can identify how this has helped them. The whole concept itself has some rather obscure use cases. Perhaps in the future there will be an obvious use case, and we will be glad that we have it. -Steve
dub libs from home directory on windows
Hi there, I'm using d2sqlite3 which has dependency on sqlite3.lib. When I'm building my app on windows I have a dub.sdl which has a line libs "%USERPROFILE%/AppData/Local/dub/packages/d2sqlite3-0.18.3/d2sqlite3/lib/win64/sqlite3" platform="windows-x86_64-dmd" but unless I specify full path using specific user profile name on windows like so "c:/user/abby/AppData/Local/dub/packages/d2sqlite3-0.18.3/d2sqlite3/lib/win64/sqlite3" I cannot build my app, so I was wondering if there is some clever way to solve this without hardcoded path to my profile name. Thank you very much for your help.
Re: @future attribute / @future keyword?
It never used @future, looks like that was only a suggestion in the dip. It also suggested @__future which it seems it was implemented with that. https://github.com/WalterBright/dmd/blob/2d4c7d4ed37645ed9d62e5e1a6652e5ae5b1fb26/test/runnable/future.d
@future attribute / @future keyword?
I have read about @future before being some kind of opposite of deprecated. However when trying to search about it now again I can't find any mentions of it anywhere except on https://dlang.org/spec/traits.html#isFuture It's difficult enough to search for "future" but even if limiting it to the spec it's the only search result: https://www.google.com/search?domains=dlang.org=google-search=%40future=dlang.org%2Fspec There is this "future compiler concept": https://forum.dlang.org/post/hjdstwzhcbrektlij...@forum.dlang.org which now is however leads to a dead link, so here is a fixed link: https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1007.md In the grammar @future isn't mentioned at all, has it been removed from the language but the trait was left over? Maybe the documentation here should be improved to avoid confusion.
Re: Best way to learn 2d games with D?
On Sunday, 15 March 2020 at 17:58:58 UTC, Steven Schveighoffer wrote: I want to try and learn how to write 2d games. I'd prefer to do it with D. I've found a ton of tutorials on learning 2d gaming with other languages. Is there a place to look that uses D for learning? Should I just start with another language and then migrate to D later? Anyone recommend any specific tutorial/book? -Steve Writing own framework - is the best !