Using fibers

2018-08-03 Thread solidstate1991 via Digitalmars-d-learn
I'm porting LZHAM to D, and the original used some very unusual approach for coroutines: - the whole thing is running inside of a single switch-case block created by C++ macros - the function saves some local values - a macro sets the state variable to the current line number, returns the

Re: Can you tell if an template alias parameter is of a specific template?

2018-08-03 Thread aliak via Digitalmars-d-learn
On Friday, 3 August 2018 at 19:10:45 UTC, Hakan Aras wrote: I don't think you can distinguish between entities evaluated through different templates. TemplateOf will paradoxically not work on pure templates of the form "template X() {}" only things like template functions and template structs.

Re: Dub project has both .sdl and .json files. Is this normal or did I do something wrong?

2018-08-03 Thread Bastiaan Veelo via Digitalmars-d-learn
On Tuesday, 19 December 2017 at 10:15:18 UTC, Jacob Carlborg wrote: On 2017-12-18 23:36, WhatMeWorry wrote: [...] But when I look the directory that has the dub.sdl file, I also see a file called dub.selections.json { "fileVersion": 1, "versions": {     "derelict-al":

Re: Can you tell if an template alias parameter is of a specific template?

2018-08-03 Thread Hakan Aras via Digitalmars-d-learn
I don't think you can distinguish between entities evaluated through different templates. TemplateOf will paradoxically not work on pure templates of the form "template X() {}" only things like template functions and template structs. isSame, is, and isInstanceOf will only work on the fully

Re: module `socket` is in file 'std/c/linux/socket.d' which cannot be read

2018-08-03 Thread bachmeier via Digitalmars-d-learn
On Friday, 3 August 2018 at 17:09:37 UTC, Adam D. Ruppe wrote: On Friday, 3 August 2018 at 16:51:37 UTC, bachmeier wrote: I'm running Ubuntu 16.04. OK, I see it now, I had another .di file on my system than the stock one. Pushed a new version to git, it needs to also import a second

Re: What does auto std.stdio.File.ByChunkImpl byChunk (ulong chunkSize ); mean?

2018-08-03 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, August 03, 2018 17:47:53 kdevel via Digitalmars-d-learn wrote: > On Friday, 3 August 2018 at 17:27:07 UTC, Adam D. Ruppe wrote: > > But remember, this is documentation that just happens to look > > like code, so it is intended to be legible by people rather > > than the compiler. > > I

Re: What does auto std.stdio.File.ByChunkImpl byChunk (ulong chunkSize ); mean?

2018-08-03 Thread kdevel via Digitalmars-d-learn
On Friday, 3 August 2018 at 17:27:07 UTC, Adam D. Ruppe wrote: But remember, this is documentation that just happens to look like code, so it is intended to be legible by people rather than the compiler. I could not find any elucidation of the meaning of auto when used as a return type

Re: What does auto std.stdio.File.ByChunkImpl byChunk (ulong chunkSize ); mean?

2018-08-03 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 3 August 2018 at 17:16:14 UTC, kdevel wrote: But that indented "code" is not syntactically valid D. Isn't it? Right, it would give an error if actually compiled. But remember, this is documentation that just happens to look like code, so it is intended to be legible by people

Re: What does auto std.stdio.File.ByChunkImpl byChunk (ulong chunkSize ); mean?

2018-08-03 Thread kdevel via Digitalmars-d-learn
On Friday, 3 August 2018 at 17:06:16 UTC, Adam D. Ruppe wrote: On Friday, 3 August 2018 at 16:58:26 UTC, kdevel wrote: What does auto std.stdio.File.ByChunkImpl byChunk ( ulong chunkSize ); on https://dlang.org/library/std/stdio/file.by_chunk.html mean? It looks like ddox trying

Re: What does auto std.stdio.File.ByChunkImpl byChunk (ulong chunkSize ); mean?

2018-08-03 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 3 August 2018 at 16:58:26 UTC, kdevel wrote: What does auto std.stdio.File.ByChunkImpl byChunk ( ulong chunkSize ); on https://dlang.org/library/std/stdio/file.by_chunk.html mean? It looks like ddox trying to tell you what the auto actually is. But it returns a

Re: module `socket` is in file 'std/c/linux/socket.d' which cannot be read

2018-08-03 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 3 August 2018 at 16:51:37 UTC, bachmeier wrote: I'm running Ubuntu 16.04. OK, I see it now, I had another .di file on my system than the stock one. Pushed a new version to git, it needs to also import a second module import core.sys.posix.netinet.in_;

Re: What does auto std.stdio.File.ByChunkImpl byChunk (ulong chunkSize ); mean?

2018-08-03 Thread Alex via Digitalmars-d-learn
On Friday, 3 August 2018 at 16:58:26 UTC, kdevel wrote: What does auto std.stdio.File.ByChunkImpl byChunk ( ulong chunkSize ); on https://dlang.org/library/std/stdio/file.by_chunk.html mean? Is that a (forward) declaration of a function named byChunk taking a single ulong argument

What does auto std.stdio.File.ByChunkImpl byChunk (ulong chunkSize ); mean?

2018-08-03 Thread kdevel via Digitalmars-d-learn
What does auto std.stdio.File.ByChunkImpl byChunk ( ulong chunkSize ); on https://dlang.org/library/std/stdio/file.by_chunk.html mean? Is that a (forward) declaration of a function named byChunk taking a single ulong argument name chunkSize. But what does that function return?

Re: module `socket` is in file 'std/c/linux/socket.d' which cannot be read

2018-08-03 Thread bachmeier via Digitalmars-d-learn
On Friday, 3 August 2018 at 16:47:42 UTC, Adam D. Ruppe wrote: On Friday, 3 August 2018 at 16:41:09 UTC, bachmeier wrote: 2.081.1 huh, it works for me... you on Linux or some other system? The embedded_httpd_processes version is Linux specific, on other OSes it uses threads... I'm running

Re: module `socket` is in file 'std/c/linux/socket.d' which cannot be read

2018-08-03 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 3 August 2018 at 16:41:09 UTC, bachmeier wrote: 2.081.1 huh, it works for me... you on Linux or some other system? The embedded_httpd_processes version is Linux specific, on other OSes it uses threads...

Re: module `socket` is in file 'std/c/linux/socket.d' which cannot be read

2018-08-03 Thread bachmeier via Digitalmars-d-learn
On Friday, 3 August 2018 at 16:19:15 UTC, Adam D. Ruppe wrote: On Friday, 3 August 2018 at 16:13:06 UTC, bachmeier wrote: Swapping the comment and changing to master both fix the original error, but then I get ugh, what dmd version you on? 2.081.1 I find it hard to not have all my

Re: module `socket` is in file 'std/c/linux/socket.d' which cannot be read

2018-08-03 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 3 August 2018 at 16:13:06 UTC, bachmeier wrote: Swapping the comment and changing to master both fix the original error, but then I get ugh, what dmd version you on?

Can you tell if an template alias parameter is of a specific template?

2018-08-03 Thread aliak via Digitalmars-d-learn
Hi Is there a way to tell if an alias is to a template? I'm writing some algorithms and I need to distinguish between a binary predicate that provides "less than" and one that provides "equal to" semantics. So I have these two templates: template eq(alias pred) { alias eq = pred; }

Re: module `socket` is in file 'std/c/linux/socket.d' which cannot be read

2018-08-03 Thread bachmeier via Digitalmars-d-learn
On Friday, 3 August 2018 at 15:42:53 UTC, Adam D. Ruppe wrote: On Friday, 3 August 2018 at 15:33:57 UTC, bachmeier wrote: Any suggestions? The line right next to it, commented, is the solution. Try grabbing the new one from git master, or swap the comment yourself. Older dmd versions used

Re: module `socket` is in file 'std/c/linux/socket.d' which cannot be read

2018-08-03 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 3 August 2018 at 15:33:57 UTC, bachmeier wrote: Any suggestions? The line right next to it, commented, is the solution. Try grabbing the new one from git master, or swap the comment yourself. Older dmd versions used std.c.linux.socket, newer ones use core.sys.posix.socket. I

module `socket` is in file 'std/c/linux/socket.d' which cannot be read

2018-08-03 Thread bachmeier via Digitalmars-d-learn
I'm trying to use Adam's cgi.d. I'm trying to compile previously working code, but I get the following error: cgi.d(2711): Error: module `socket` is in file 'std/c/linux/socket.d' which cannot be read import path[0] = /usr/include/dmd/phobos import path[1] = /usr/include/dmd/druntime/import