Re: DUB dependency issue

2017-10-03 Thread Andrew Edwards via Digitalmars-d-learn
On Wednesday, 4 October 2017 at 01:59:48 UTC, Andrew Edwards wrote: Attempting to use iopipe but not sure what I'm doing incorrectly Finally figured it out. For some reason, the init find the local dependency to load but simply adding it to the dub.json afterward resolves the issue.

Re: Vibe.d using Windows Certificate binding, possible?

2017-10-03 Thread rikki cattermole via Digitalmars-d-learn
On 04/10/2017 3:54 AM, Jesse Phillips wrote: On Tuesday, 3 October 2017 at 23:29:49 UTC, rikki cattermole wrote: On 03/10/2017 4:52 PM, Jesse Phillips wrote: I'm pretty sure this isn't possible, but maybe someone understands Windows better. Windows provides a means no bind a certificate to a

Re: Vibe.d using Windows Certificate binding, possible?

2017-10-03 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 3 October 2017 at 23:29:49 UTC, rikki cattermole wrote: On 03/10/2017 4:52 PM, Jesse Phillips wrote: I'm pretty sure this isn't possible, but maybe someone understands Windows better. Windows provides a means no bind a certificate to a port using netsh.exe. This means (at least

Re: Should this Compile?

2017-10-03 Thread SamwiseFilmore via Digitalmars-d-learn
On Tuesday, 3 October 2017 at 23:13:00 UTC, Jonathan M Davis wrote: On Tuesday, October 03, 2017 22:42:35 SamwiseFilmore via Digitalmars-d-learn wrote: On Tuesday, 3 October 2017 at 22:37:17 UTC, SamwiseFilmore wrote: > Am I using the ternary operator correctly here, or is this > an issue with

DUB dependency issue

2017-10-03 Thread Andrew Edwards via Digitalmars-d-learn
Attempting to use iopipe but not sure what I'm doing incorrectly I've cloned the repository in /Users/edwarac/git.repo.dir/ then added the path to dub: edwarac-pc:.dub edwarac$ dub add-path /Users/edwarac/git.repo.dir edwarac-pc:.dub edwarac$ dub list Packages present in the system and known

Re: Vibe.d using Windows Certificate binding, possible?

2017-10-03 Thread rikki cattermole via Digitalmars-d-learn
On 03/10/2017 4:52 PM, Jesse Phillips wrote: I'm pretty sure this isn't possible, but maybe someone understands Windows better. Windows provides a means no bind a certificate to a port using netsh.exe. This means (at least for standard Windows networking calls) connections to that port will

Re: Should this Compile?

2017-10-03 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, October 03, 2017 22:42:35 SamwiseFilmore via Digitalmars-d-learn wrote: > On Tuesday, 3 October 2017 at 22:37:17 UTC, SamwiseFilmore wrote: > > Am I using the ternary operator correctly here, or is this an > > issue with dmd? I'm using dmd v2.076.0. > > I wrapped the ternary in

Re: Should this Compile?

2017-10-03 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Oct 03, 2017 at 10:37:17PM +, SamwiseFilmore via Digitalmars-d-learn wrote: [...] > string toString() { > return > this.value.toString() ~ > " of " ~ > this.suit.toString() ~ > this.suit == CardSuit.diamonds ? "" : "\t" ~ >

Re: Should this Compile?

2017-10-03 Thread SamwiseFilmore via Digitalmars-d-learn
On Tuesday, 3 October 2017 at 22:37:17 UTC, SamwiseFilmore wrote: Am I using the ternary operator correctly here, or is this an issue with dmd? I'm using dmd v2.076.0. I wrapped the ternary in parentheses, and it compiled. Still, I'm wondering about this behavior.

Should this Compile?

2017-10-03 Thread SamwiseFilmore via Digitalmars-d-learn
I've created toString() for a struct (which is a lot more complicated than what I've provided here) that returns a large number of concatenated strings. Here is the example: struct Card { // Flesh out these enums appropriately CardSuit suit; CardValue value; Facing facing;

Re: non-block reading from pipe stdout

2017-10-03 Thread Oleg B via Digitalmars-d-learn
On Tuesday, 3 October 2017 at 12:32:43 UTC, kdevel wrote: IMHO a program should sleep (consume 0 CPU time and 0 energy) if there is nothing to process. This is best accomplished by not polling on a file descriptor in order to check if data has arrived. If your program must yield() there's

For fun: Expressive C++ 17 Coding Challenge in D

2017-10-03 Thread Ali Çehreli via Digitalmars-d-learn
Found on Reddit: https://www.reddit.com/r/programming/comments/740617/the_expressive_c17_coding_challenge/ How would you do it in D? Ali P.S. You can ignore the following note from the challenge text; I don't think it applies to D. Honestly, I don't think it matters for C++17 either. :)

Re: Is there further documentation of core.atomic.MemoryOrder?

2017-10-03 Thread Nathan S. via Digitalmars-d-learn
Thank you. For anyone else with the same question, I also found this page helpful: http://en.cppreference.com/w/cpp/atomic/memory_order

Re: Does D support nested Templates aka Higher Kinded Polymorphism?

2017-10-03 Thread sighoya via Digitalmars-d-learn
On Tuesday, 3 October 2017 at 15:52:52 UTC, sighoya wrote: On Tuesday, 3 October 2017 at 15:30:52 UTC, Daniel Kozak wrote: writeln(bar!(Bar,Foo,int)(Bar!(Foo,int)())); Dne 3. 10. 2017 3:55 odpoledne napsal uživatel "sighoya via Digitalmars-d-learn" : But

Re: Does D support nested Templates aka Higher Kinded Polymorphism?

2017-10-03 Thread Daniel Kozak via Digitalmars-d-learn
https://run.dlang.io/is/oqbYNb On Tue, Oct 3, 2017 at 5:52 PM, sighoya via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > On Tuesday, 3 October 2017 at 15:30:52 UTC, Daniel Kozak wrote: > >> writeln(bar!(Bar,Foo,int)(Bar!(Foo,int)())); >> >> Dne 3. 10. 2017 3:55 odpoledne

Re: Does D support nested Templates aka Higher Kinded Polymorphism?

2017-10-03 Thread sighoya via Digitalmars-d-learn
On Tuesday, 3 October 2017 at 15:30:52 UTC, Daniel Kozak wrote: writeln(bar!(Bar,Foo,int)(Bar!(Foo,int)())); Dne 3. 10. 2017 3:55 odpoledne napsal uživatel "sighoya via Digitalmars-d-learn" : But when I write this to:

Vibe.d using Windows Certificate binding, possible?

2017-10-03 Thread Jesse Phillips via Digitalmars-d-learn
I'm pretty sure this isn't possible, but maybe someone understands Windows better. Windows provides a means no bind a certificate to a port using netsh.exe. This means (at least for standard Windows networking calls) connections to that port will be given the bound cert. The Vibe.d

Re: Does D support nested Templates aka Higher Kinded Polymorphism?

2017-10-03 Thread Daniel Kozak via Digitalmars-d-learn
writeln(bar!(Bar,Foo,int)(Bar!(Foo,int)())); Dne 3. 10. 2017 3:55 odpoledne napsal uživatel "sighoya via Digitalmars-d-learn" : But when I write this to: writeln(bar!(Bar,Foo,int)(Bar!(Foo,int))); it complains by: test.d(11): Error: template instance

Re: Does D support nested Templates aka Higher Kinded Polymorphism?

2017-10-03 Thread sighoya via Digitalmars-d-learn
But when I write this to: writeln(bar!(Bar,Foo,int)(Bar!(Foo,int))); it complains by: test.d(11): Error: template instance T!(S!int) does not match template declaration Bar(R, S) test.d(11): Error: template instance T!(S!int) does not match template declaration Bar(R, S) test.d(17): Error:

Re: Does D support nested Templates aka Higher Kinded Polymorphism?

2017-10-03 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 3 October 2017 at 13:31:00 UTC, sighoya wrote: struct Bar (R,S) { T!(S!R) bar(alias T,alias S,R)(T!(S!R) v) {return v;} Bar takes two arguments, but here you are only passing one. Keep in mind that T!(...) is Bar. You called T!(S!(R)) when it was actually written to accept

Re: Does D support nested Templates aka Higher Kinded Polymorphism?

2017-10-03 Thread sighoya via Digitalmars-d-learn
Thanks, How do I construct such a type. I don't get it done right with: struct Foo(T) { T value; } struct Bar (R,S) { R!S fooint; } T!(S!R) bar(alias T,alias S,R)(T!(S!R) v) {return v;} void main() { import std.stdio;

Re: Does D support nested Templates aka Higher Kinded Polymorphism?

2017-10-03 Thread Jerry via Digitalmars-d-learn
On Tuesday, 3 October 2017 at 12:58:47 UTC, sighoya wrote: On Tuesday, 3 October 2017 at 12:09:04 UTC, rikki cattermole wrote: On 03/10/2017 1:05 PM, sighoya wrote: Especially, I mean something like T foo(S,T)(T i) {     ... } struct Foo(T) { T value; } T!S foo(S, alias

Re: Does D support nested Templates aka Higher Kinded Polymorphism?

2017-10-03 Thread sighoya via Digitalmars-d-learn
On Tuesday, 3 October 2017 at 12:09:04 UTC, rikki cattermole wrote: On 03/10/2017 1:05 PM, sighoya wrote: Especially, I mean something like T foo(S,T)(T i) {     ... } struct Foo(T) { T value; } T!S foo(S, alias T)(T!S v) { return v; } void main() { import

Re: non-block reading from pipe stdout

2017-10-03 Thread kdevel via Digitalmars-d-learn
On Tuesday, 3 October 2017 at 12:20:09 UTC, Oleg B wrote: while (!tryWait(pp.pid).terminated) { auto cnt = read(fd, buf.ptr, buf.length); // C-style reading if (cnt == -1 && errno == EAGAIN) // C-style error checking yield();

Re: non-block reading from pipe stdout

2017-10-03 Thread Oleg B via Digitalmars-d-learn
On Tuesday, 3 October 2017 at 10:45:21 UTC, kdevel wrote: On Tuesday, 3 October 2017 at 00:22:28 UTC, Oleg B wrote: but get error "Resource temporarily unavailable". You get EAGAIN because there is no data available at the time of reading. From the manpage of read: ERRORS EAGAIN

Re: non-block reading from pipe stdout

2017-10-03 Thread kdevel via Digitalmars-d-learn
On Tuesday, 3 October 2017 at 11:36:28 UTC, Oleg B wrote: EAGAIN Non-blocking I/O has been selected using O_NONBLOCK and no data was immediately available for reading. And I can't check this without using exception handling? Your programm shall not read before data is

Does D support nested Templates aka Higher Kinded Polymorphism?

2017-10-03 Thread sighoya via Digitalmars-d-learn
Especially, I mean something like T foo(S,T)(T i) { ... }

Re: Does D support nested Templates aka Higher Kinded Polymorphism?

2017-10-03 Thread rikki cattermole via Digitalmars-d-learn
On 03/10/2017 1:05 PM, sighoya wrote: Especially, I mean something like T foo(S,T)(T i) {     ... } struct Foo(T) { T value; } T!S foo(S, alias T)(T!S v) { return v; } void main() { import std.stdio; writeln(foo!(int, Foo)(Foo!int(1))); }

Re: non-block reading from pipe stdout

2017-10-03 Thread Oleg B via Digitalmars-d-learn
On Tuesday, 3 October 2017 at 10:45:21 UTC, kdevel wrote: On Tuesday, 3 October 2017 at 00:22:28 UTC, Oleg B wrote: but get error "Resource temporarily unavailable". You get EAGAIN because there is no data available at the time of reading. From the manpage of read: ERRORS EAGAIN

Re: non-block reading from pipe stdout

2017-10-03 Thread kdevel via Digitalmars-d-learn
On Tuesday, 3 October 2017 at 00:22:28 UTC, Oleg B wrote: but get error "Resource temporarily unavailable". You get EAGAIN because there is no data available at the time of reading. From the manpage of read: ERRORS EAGAIN Non-blocking I/O has been selected using O_NONBLOCK and no

Looking for a mentor in D

2017-10-03 Thread eastanon via Digitalmars-d-learn
I have been reading the D forums for a while and following on its amazing progress for a long time. Over time I have even written some basic D programs for myself, nothing major or earth shuttering. I have downloaded and read Ali's excellent book. I would like to dive deeper into D, however