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

2020-02-11 Thread mark via Digitalmars-d-learn
On Wednesday, 12 February 2020 at 05:59:53 UTC, cc wrote: On Monday, 3 February 2020 at 13:26:38 UTC, mark wrote: I'm using std.zip.ZipArchive to read zip files, e.g.: [snip] I couldn't find one either, I had to do this: version(Windows) { enum uint FILE_ATTRIBUTE_DIRECTORY = 0x10; }

Re: GtkD on Windows: notes + question

2020-02-11 Thread mark via Digitalmars-d-learn
On Tuesday, 11 February 2020 at 20:49:40 UTC, Ron Tarrant wrote: On Sunday, 9 February 2020 at 13:28:59 UTC, mark wrote: I found a much easier way to get GtkD working on windows than that described in https://gtkdcoding.com/2019/01/11/-introduction-to-gtkDcoding.html Just FYI... I don't

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

2020-02-11 Thread cc 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

Re: GtkD on Windows: notes + question

2020-02-11 Thread Ron Tarrant via Digitalmars-d-learn
On Sunday, 9 February 2020 at 13:28:59 UTC, mark wrote: I found a much easier way to get GtkD working on windows than that described in https://gtkdcoding.com/2019/01/11/-introduction-to-gtkDcoding.html Just FYI... I don't use dub because I don't have time to understand its foibles well

Re: tuple(...).each error; why does foreach work and std.algorithms.each doesn't ?

2020-02-11 Thread wjoe via Digitalmars-d-learn
On Tuesday, 11 February 2020 at 19:04:17 UTC, Paul Backus wrote: On Tuesday, 11 February 2020 at 18:55:45 UTC, wjoe wrote: What's a compiler list... is that something like a tuple? or more like a macro expansion? Or is it only valid to use in a foreach to take advantage of each item individuall

Re: tuple(...).each error; why does foreach work and std.algorithms.each doesn't ?

2020-02-11 Thread wjoe via Digitalmars-d-learn
On Tuesday, 11 February 2020 at 19:05:19 UTC, Adam D. Ruppe wrote: On Tuesday, 11 February 2020 at 18:55:45 UTC, wjoe wrote: What's a compiler list... is that something like a tuple? Yea, they are frequently called tuples too. It is basically just a list of arguments used for a function call

Re: tuple(...).each error; why does foreach work and std.algorithms.each doesn't ?

2020-02-11 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 11 February 2020 at 18:55:45 UTC, wjoe wrote: What's a compiler list... is that something like a tuple? Yea, they are frequently called tuples too. It is basically just a list of arguments used for a function call that the compiler treats somewat magically. Is it possible to pa

Re: tuple(...).each error; why does foreach work and std.algorithms.each doesn't ?

2020-02-11 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 11 February 2020 at 18:55:45 UTC, wjoe wrote: What's a compiler list... is that something like a tuple? or more like a macro expansion? Or is it only valid to use in a foreach to take advantage of each item individually and for expansion in a function call ? Is it possible to partia

Re: tuple(...).each error; why does foreach work and std.algorithms.each doesn't ?

2020-02-11 Thread wjoe via Digitalmars-d-learn
On Tuesday, 11 February 2020 at 18:21:11 UTC, Adam D. Ruppe wrote: On Tuesday, 11 February 2020 at 18:11:44 UTC, wjoe wrote: In my mind, if something works with foreach, it should also work with std.algorithm.each. They are very different, the each thing only works for ranges whereas foreach

Re: tuple(...).each error; why does foreach work and std.algorithms.each doesn't ?

2020-02-11 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 11 February 2020 at 18:11:44 UTC, wjoe wrote: In my mind, if something works with foreach, it should also work with std.algorithm.each. They are very different, the each thing only works for ranges whereas foreach works with a variety of things. How is 1) different from 2) ? T

tuple(...).each error; why does foreach work and std.algorithms.each doesn't ?

2020-02-11 Thread wjoe via Digitalmars-d-learn
Consider a function to format the parameters of a function call: pure nothrow string fmtArgs(ARGS...)(ARGS args) { string result; // 1) foreach(a; args) { result ~= a.to!string; } // 2) args.each!(a => result ~= a.to!string); return result; } In my mind, if somethin

Re: Printing LHS and RHS of assert expressions on failure

2020-02-11 Thread Adnan via Digitalmars-d-learn
On Tuesday, 11 February 2020 at 13:45:24 UTC, kinke wrote: On Tuesday, 11 February 2020 at 13:38:32 UTC, Adnan wrote: I just want to know is there any de-facto way of achieving this? See the `-checkaction=context` switch. Exactly what I was after. Thanks.

Re: Printing LHS and RHS of assert expressions on failure

2020-02-11 Thread kinke via Digitalmars-d-learn
On Tuesday, 11 February 2020 at 13:38:32 UTC, Adnan wrote: I just want to know is there any de-facto way of achieving this? See the `-checkaction=context` switch.

Printing LHS and RHS of assert expressions on failure

2020-02-11 Thread Adnan via Digitalmars-d-learn
Hi, is there any trick to print the RHS and the LHS of the assert expressions when it fails? like `assert(2 == 5)` should fail and print something like: ... assert failed [__LINE__/__MODULE__]: Left hand side: 2 is 2, Right hand side: 5 is 5 Of course, I can design a function to do so myself,

Re: Dynamically calling shared objects from statically build executable allowed

2020-02-11 Thread Andre Pany via Digitalmars-d-learn
On Monday, 10 February 2020 at 19:39:04 UTC, Ernesto Castellotti wrote: On Monday, 10 February 2020 at 19:00:36 UTC, Andre Pany wrote: [...] Static libraries are simple collections of object files, there is no difference between linking a static library or several object files If you notic

Re: about const ref

2020-02-11 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Tuesday, 11 February 2020 at 09:20:11 UTC, Mathias Lang wrote: On Tuesday, 11 February 2020 at 07:51:04 UTC, Ferhat Kurtulmuş wrote: You're correct for 'a' and 'b'. However `in` only entails `const`, so it is not an exact replacement. Additionally, you might want to add `scope` to show that

Re: about const ref

2020-02-11 Thread Mathias Lang via Digitalmars-d-learn
On Tuesday, 11 February 2020 at 07:51:04 UTC, Ferhat Kurtulmuş wrote: I need to be sure about "const ref". Based on the following function, does it mean: Type can be string or an integral type. (a) k1 is not copied on function calls (b) k1 cannot be modified inside function Please correct me