Re: Empty string vs null

2020-02-03 Thread JN via Digitalmars-d-learn
On Tuesday, 4 February 2020 at 07:44:08 UTC, mark wrote: Just found this post by Mark Parker that explains: https://forum.dlang.org/post/gvveit$10i5$1...@digitalmars.com I recommend using Nullable from https://dlang.org/phobos/std_typecons.html#Nullable if you want to explicitly allow a non-v

Assoc array init

2020-02-03 Thread JN via Digitalmars-d-learn
int[int] a = [5: 7]; void main() { } This fails because apparently [5: 7] is a "non-const expression". How? Why? Yes, I know I can just init in a static this() section, but that feels like a bad workaround.

Re: Empty string vs null

2020-02-03 Thread mark via Digitalmars-d-learn
Just found this post by Mark Parker that explains: https://forum.dlang.org/post/gvveit$10i5$1...@digitalmars.com // test.d import std.stdio; import std.string; void main() { report(null, "null"); report(""); report("x"); } void report(const string x, const string name=null) { w

Empty string vs null

2020-02-03 Thread mark via Digitalmars-d-learn
I have just discovered that D seems to treat empty and null strings as the same thing: // test.d import std.stdio; import std.string; void main() { string x = null; writeln("x = \"", x, "\""); writeln("null = ", x == null); writeln("\"\"= ", x == ""); writeln("empty

Re: Debug function / macro

2020-02-03 Thread Paul Backus via Digitalmars-d-learn
On Monday, 3 February 2020 at 22:07:13 UTC, ag wrote: Does D have a debugging helper function or macro similar to this one in Rust? (https://doc.rust-lang.org/std/macro.dbg.html) If not, how would one implement this / how difficult would it be to implement? Here's one way you could do it: s

Re: digger: Failed to spawn new process (The system cannot find the file specified.)

2020-02-03 Thread Anonymouse via Digitalmars-d-learn
On Monday, 3 February 2020 at 22:08:50 UTC, Vladimir Panteleev wrote: On Monday, 3 February 2020 at 22:01:18 UTC, Anonymouse wrote: No, C:\Temp\work\dl\git does not exist. :o OK, that makes sense. Please try the latest Digger version (24cd4168956dad382d05984b4b8d37d9e8ebe3ae). Works great.

Re: digger: Failed to spawn new process (The system cannot find the file specified.)

2020-02-03 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 3 February 2020 at 22:01:18 UTC, Anonymouse wrote: No, C:\Temp\work\dl\git does not exist. :o OK, that makes sense. Please try the latest Digger version (24cd4168956dad382d05984b4b8d37d9e8ebe3ae).

Debug function / macro

2020-02-03 Thread ag via Digitalmars-d-learn
Does D have a debugging helper function or macro similar to this one in Rust? (https://doc.rust-lang.org/std/macro.dbg.html) If not, how would one implement this / how difficult would it be to implement?

Re: digger: Failed to spawn new process (The system cannot find the file specified.)

2020-02-03 Thread Anonymouse via Digitalmars-d-learn
On Monday, 3 February 2020 at 21:58:31 UTC, Vladimir Panteleev wrote: On Monday, 3 February 2020 at 21:44:20 UTC, Anonymouse wrote: New log: https://pastebin.com/raw/uUMNQjEN It looks like it fails to execute git (to get the current version for the build). I don't know why that fails, as I

Re: digger: Failed to spawn new process (The system cannot find the file specified.)

2020-02-03 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 3 February 2020 at 21:44:20 UTC, Anonymouse wrote: New log: https://pastebin.com/raw/uUMNQjEN It looks like it fails to execute git (to get the current version for the build). I don't know why that fails, as I see C:\Temp\work\dl\git\cmd is in PATH in the environment that build.e

Re: digger: Failed to spawn new process (The system cannot find the file specified.)

2020-02-03 Thread Anonymouse via Digitalmars-d-learn
On Monday, 3 February 2020 at 21:33:09 UTC, Vladimir Panteleev wrote: On Monday, 3 February 2020 at 21:30:57 UTC, Anonymouse wrote: I was on beta 8. I forced dub to download the latest now (3.0.0-alpha-9), wiped the work directory and retried, but to similar results. The latest is v3.0.0-alph

Re: digger: Failed to spawn new process (The system cannot find the file specified.)

2020-02-03 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 3 February 2020 at 21:30:57 UTC, Anonymouse wrote: I was on beta 8. I forced dub to download the latest now (3.0.0-alpha-9), wiped the work directory and retried, but to similar results. The latest is v3.0.0-alpha-11. Oh, I guess that's not how semantic versioning works. Probably I

Re: digger: Failed to spawn new process (The system cannot find the file specified.)

2020-02-03 Thread Anonymouse via Digitalmars-d-learn
On Monday, 3 February 2020 at 20:54:46 UTC, Vladimir Panteleev wrote: On Monday, 3 February 2020 at 20:41:00 UTC, Anonymouse wrote: It doesn't seem to include debugging symbols. Is your Digger version up-to-date? https://github.com/CyberShadow/ae/commit/48ee31a3b0d47e52769ee87b0e673034abe4add

Re: digger: Failed to spawn new process (The system cannot find the file specified.)

2020-02-03 Thread MoonlightSentinel via Digitalmars-d-learn
On Monday, 3 February 2020 at 20:41:00 UTC, Anonymouse wrote: It doesn't seem to include debugging symbols. Does digger not build its dmds with -g? The exceptions happens inside of build.d not dmd which wasn't built with debug informations until recently. Here's the full log: https://pasteb

Re: digger: Failed to spawn new process (The system cannot find the file specified.)

2020-02-03 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 3 February 2020 at 20:41:00 UTC, Anonymouse wrote: It doesn't seem to include debugging symbols. Is your Digger version up-to-date? https://github.com/CyberShadow/ae/commit/48ee31a3b0d47e52769ee87b0e673034abe4add5

Re: digger: Failed to spawn new process (The system cannot find the file specified.)

2020-02-03 Thread Anonymouse via Digitalmars-d-learn
On Monday, 3 February 2020 at 20:09:43 UTC, MoonlightSentinel wrote: On Monday, 3 February 2020 at 16:54:20 UTC, Anonymouse wrote: It does a `dmd.exe -of..\generated\build.exe`, but then the immediately following call to `..\generated\build.exe` fails? What am I doing wrong? The executable wa

Re: digger: Failed to spawn new process (The system cannot find the file specified.)

2020-02-03 Thread MoonlightSentinel via Digitalmars-d-learn
On Monday, 3 February 2020 at 16:54:20 UTC, Anonymouse wrote: It does a `dmd.exe -of..\generated\build.exe`, but then the immediately following call to `..\generated\build.exe` fails? What am I doing wrong? The executable was launched because make would yield a different error message otherwi

Re: module ... conflicts with package name ...

2020-02-03 Thread Boris Carvajal via Digitalmars-d-learn
On Monday, 3 February 2020 at 16:35:06 UTC, Steven Schveighoffer wrote: I can't reproduce with a small example. Before I try and go through the process to reduce this, just wanted to see if anyone knows about this. -Steve I've made a few changes to the package.d import code, one is pending.

Re: [dub] Passing --DRT-gcopt to dmd

2020-02-03 Thread Mathias Lang via Digitalmars-d-learn
On Friday, 31 May 2019 at 15:41:24 UTC, Anonymouse wrote: On Friday, 31 May 2019 at 15:31:13 UTC, kinke wrote: On Friday, 31 May 2019 at 10:27:44 UTC, Anonymouse wrote: $ grep dflags dub.json "dflags": [ "-lowmem", "--DRT-gcopt=profile:1" ], This should work indeed. I guess it doesn't bec

Re: DMD won't compile re-init of variable

2020-02-03 Thread Simon via Digitalmars-d-learn
On Friday, 31 January 2020 at 14:01:04 UTC, Minty Fresh wrote: On Thursday, 30 January 2020 at 21:36:53 UTC, Adam D. Ruppe wrote: On Thursday, 30 January 2020 at 21:09:41 UTC, Simon wrote: How do I revert my variable to the init state? null is the initial state for those. More generally, .i

Re: DMD won't compile re-init of variable

2020-02-03 Thread Simon via Digitalmars-d-learn
On Thursday, 30 January 2020 at 21:18:04 UTC, MoonlightSentinel wrote: On Thursday, 30 January 2020 at 21:09:41 UTC, Simon wrote: Hi dlang community, I'm trying to implement a "reset" functionality which should revert all variables to the program start initial state. Example: import Graph;

digger: Failed to spawn new process (The system cannot find the file specified.)

2020-02-03 Thread Anonymouse via Digitalmars-d-learn
I'm trying to bisect a dmd compilation error on Windows 10 and I can't get digger to do more than one initial test. When preparing to compile the next dmd build (the BAD revision) it errors out. This is in a normal cmd console. The bisect ini has nothing weird in it: ``` bad = v2.088.1 good =

module ... conflicts with package name ...

2020-02-03 Thread Steven Schveighoffer via Digitalmars-d-learn
I have a directory structure like this (names are changed, but essentially they shouldn't matter): source/foo/package.d source/foo/bar/package.d with foo.package.d containing a public import of foo.bar, and foo.bar containing various public imports from elsewhere. I get the following message

Re: Is there a std.zip.ZipArchive isDir or isFile method?

2020-02-03 Thread JN via Digitalmars-d-learn
On Monday, 3 February 2020 at 13:26:38 UTC, mark wrote: I'm using std.zip.ZipArchive to read zip files, e.g.: auto zip = new ZipArchive(read(filename)); // ... foreach (name, member; zip.directory) { if (name.endsWith('/')) // skip dirs continue; mkdirRecu

Is there a std.zip.ZipArchive isDir or isFile method?

2020-02-03 Thread mark via Digitalmars-d-learn
I'm using std.zip.ZipArchive to read zip files, e.g.: auto zip = new ZipArchive(read(filename)); // ... foreach (name, member; zip.directory) { if (name.endsWith('/')) // skip dirs continue; mkdirRecurse(dirName(name)); zip.expand(member); w

Re: How make Executable Dlang EXE ask for "Run as Administrator"?

2020-02-03 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Monday, 3 February 2020 at 12:27:41 UTC, Marcone wrote: On Saturday, 1 February 2020 at 08:14:19 UTC, Ferhat Kurtulmuş wrote: On Saturday, 1 February 2020 at 06:26:04 UTC, Marcone wrote: [...] Disclaimer: did not tried. You must somehow embed this manifest file into your exe using some l

Re: How make Executable Dlang EXE ask for "Run as Administrator"?

2020-02-03 Thread Marcone via Digitalmars-d-learn
On Saturday, 1 February 2020 at 08:14:19 UTC, Ferhat Kurtulmuş wrote: On Saturday, 1 February 2020 at 06:26:04 UTC, Marcone wrote: [...] Disclaimer: did not tried. You must somehow embed this manifest file into your exe using some linker parameter. Or put this manifest next to your exe by n

Re: Is it possible to use DMD as a library to compile strings at runtime?

2020-02-03 Thread Saurabh Das via Digitalmars-d-learn
On Sunday, 2 February 2020 at 06:03:01 UTC, H. S. Teoh wrote: On Sun, Feb 02, 2020 at 03:16:46AM +, Saurabh Das via Digitalmars-d-learn wrote: [...] [...] > [...] [...] [...] [...] It's very simple. Let's say you have your code in some string called 'code'. Since dmd nowadays can take

Re: How add resource.res in RDMD

2020-02-03 Thread Marcone via Digitalmars-d-learn
On Monday, 3 February 2020 at 05:11:30 UTC, Boris Carvajal wrote: On Monday, 3 February 2020 at 03:03:20 UTC, Marcone wrote: On Sunday, 2 February 2020 at 06:03:06 UTC, Marcone wrote: I like use rdmd when I am programming. But I need that the program use resource file becouse I am creating prog

Re: Error on using regex in dmd v2.088.1

2020-02-03 Thread Andrea Fontana via Digitalmars-d-learn
On Monday, 3 February 2020 at 07:11:34 UTC, Dharmil Patel wrote: On Monday, 3 February 2020 at 07:03:03 UTC, Dharmil Patel wrote: In my code I am using regex like this: auto rgxComma = regex(r","); On compiling with dmd v2.076.1, it compiles successfully, but on compiling with dmd v2.0

Re: How do I fix my failed PRs?

2020-02-03 Thread mark via Digitalmars-d-learn
Thanks Petar... I'm in no hurry, just glad that they're in process:-)

Re: How do I fix my failed PRs?

2020-02-03 Thread Petar via Digitalmars-d-learn
On Sunday, 2 February 2020 at 08:54:02 UTC, mark wrote: I've done quite a few small corrections/improvements to the D-tour's English. Almost all have been accepted. However, four have not been accepted, apparently for technical reasons. But I don't understand what's wrong or what I need to do