Re: Generate documentation for mixin'd function?

2018-06-01 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, June 01, 2018 21:26:18 rjframe via Digitalmars-d-learn wrote: > Hi > > I'm making an API for a web service, and have a small collection of > endpoints where I'd basically be creating copy+paste functions (a small > enough number that this isn't really that important for this project). I

GDC on Travis-CI

2018-06-01 Thread crimaniak via Digitalmars-d-learn
I started to work with Travis-CI, building packages using all three main compilers, and noticed that I have problems with gdc every time and need to tweak code because of many things missing. For example: https://travis-ci.org/crimaniak/json-patch/jobs/386963340 Why this situation with gdc

Orange serializer/deserializer

2018-06-01 Thread IntegratedDimensions via Digitalmars-d-learn
How can I modify the pre serialization and post serialization values? I need to transform some variables that are stored but I would like to do this easily "inline"(would be cool to be able to provide a delegate to do the transformations at the site of definition of the fields). Also, how

Generate documentation for mixin'd function?

2018-06-01 Thread rjframe via Digitalmars-d-learn
Hi I'm making an API for a web service, and have a small collection of endpoints where I'd basically be creating copy+paste functions (a small enough number that this isn't really that important for this project). I thought I'd generate them via a mixin, but haven't seen that I can generate

Re: range simple toy problem

2018-06-01 Thread Xiaoxi via Digitalmars-d-learn
On Friday, 1 June 2018 at 18:40:45 UTC, ag0aep6g wrote: On 06/01/2018 07:00 PM, Xiaoxi wrote: This prints "3 4 5 6 7 8 9": import std.range; import std.algorithm; import std.stdio; void main() { auto s = "1 2 3 4 5 6 7 8 9"; auto iter = refRange().splitter!(c => c == ' ').drop(2);

How are switches optimized

2018-06-01 Thread IntegratedDimensions via Digitalmars-d-learn
What is the best optimizations that a compiler does to switches in general and in the D compilers? A switch can be seen as if statements, or safer, nested if elses. but surely the cost per case does not grow with depth in the switch? If one has a switch of N case then the last cost surely

Re: Debugging silent exit of threads in Phobos calls

2018-06-01 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/1/18 1:41 PM, Russel Winder wrote: struct Datum { public const int a; public const int b; } struct Message { Datum datum; } I found the bug. Basically, the Variant static if is failing because the assignment it is checking (assigning a Message to a Message) would

Re: run "thread" with memory space similar a new process

2018-06-01 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 1 June 2018 at 19:16:46 UTC, Dr.No wrote: exactly as a new process does? Why not just create a real process?

run "thread" with memory space similar a new process

2018-06-01 Thread Dr.No via Digitalmars-d-learn
Thread is "limited" to local storage, so static variables (including the ones marked as __gshared in D) which are globals are shared between the threads. So, calling not pure functions which depend upon global variables prevent parallization for that global-dependence. (please tell me I got

Re: Deleting a file with extsion *.FIFO in Windows

2018-06-01 Thread Dlang User via Digitalmars-d-learn
On 6/1/2018 12:06 AM, vino.B wrote: On Thursday, 24 May 2018 at 11:31:15 UTC, bauss wrote: On Thursday, 24 May 2018 at 06:59:47 UTC, Vino wrote: Hi All,   Request your help on how to delete a file which has the extension .fifo (.javast.fifo) in Windows. From, Vino.B What exactly is your

Re: range simple toy problem

2018-06-01 Thread ag0aep6g via Digitalmars-d-learn
On 06/01/2018 07:00 PM, Xiaoxi wrote: import std.range; import std.algorithm; import std.string; import std.stdio; void main() {   auto s = "1 2 3 4 5 6 7 8 9";   auto iter = s.split(" ").drop(2);   // How to find the unconsumed/not-split part of s here?   // i.e. "3 4 5 6 7 8 9" NOT ["3",

Re: range simple toy problem

2018-06-01 Thread Alex via Digitalmars-d-learn
On Friday, 1 June 2018 at 17:00:45 UTC, Xiaoxi wrote: import std.range; import std.algorithm; import std.string; import std.stdio; void main() { auto s = "1 2 3 4 5 6 7 8 9"; auto iter = s.split(" ").drop(2); // How to find the unconsumed/not-split part of s here? // i.e. "3 4

Re: range simple toy problem

2018-06-01 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/1/18 1:00 PM, Xiaoxi wrote: import std.range; import std.algorithm; import std.string; import std.stdio; void main() {   auto s = "1 2 3 4 5 6 7 8 9";   auto iter = s.split(" ").drop(2);   // How to find the unconsumed/not-split part of s here?   // i.e. "3 4 5 6 7 8 9" NOT ["3", "4",

Re: Debugging silent exit of threads in Phobos calls

2018-06-01 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/1/18 1:41 PM, Russel Winder wrote: On Fri, 2018-06-01 at 18:30 +0100, Russel Winder wrote: […] I'll trim this sample code down to the minimum so it can be used in the test suite of Phobos creating a red. Here it is, a small bit of code that breaks Phobos' std.concurrency.receive.

Re: Debugging silent exit of threads in Phobos calls

2018-06-01 Thread Russel Winder via Digitalmars-d-learn
On Fri, 2018-06-01 at 18:30 +0100, Russel Winder wrote: > […] > > I'll trim this sample code down to the minimum so it can be used in > the > test suite of Phobos creating a red. > Here it is, a small bit of code that breaks Phobos' std.concurrency.receive. import core.thread: Thread; import

Re: Debugging silent exit of threads in Phobos calls

2018-06-01 Thread Russel Winder via Digitalmars-d-learn
On Fri, 2018-06-01 at 09:56 -0700, Ali Çehreli via Digitalmars-d-learn wrote: > On 06/01/2018 09:40 AM, Russel Winder wrote: > > > The assert is in Phobos, so I am not sure I can. > > Not the cleanest solution but one can always "carefully" :) edit the > installed Phobos files. Mine are under

range simple toy problem

2018-06-01 Thread Xiaoxi via Digitalmars-d-learn
import std.range; import std.algorithm; import std.string; import std.stdio; void main() { auto s = "1 2 3 4 5 6 7 8 9"; auto iter = s.split(" ").drop(2); // How to find the unconsumed/not-split part of s here? // i.e. "3 4 5 6 7 8 9" NOT ["3", "4", "5", "6", "7", "8", "9"]

Re: How do I make this function thread safe?

2018-06-01 Thread Dr.No via Digitalmars-d-learn
On Friday, 1 June 2018 at 02:30:34 UTC, Paul Backus wrote: On Thursday, 31 May 2018 at 19:26:12 UTC, Dr.No wrote: My application create some HTML which is then converted to PDF by wkhtmltopdf library. I'm trying to figure out how make the PDF generation run parallel, currently, it's running

Re: Debugging silent exit of threads in Phobos calls

2018-06-01 Thread Ali Çehreli via Digitalmars-d-learn
On 06/01/2018 09:40 AM, Russel Winder wrote: > The assert is in Phobos, so I am not sure I can. Not the cleanest solution but one can always "carefully" :) edit the installed Phobos files. Mine are under /usr/include/dmd/phobos/std/ It will most likely work as they are almost always

Re: Debugging silent exit of threads in Phobos calls

2018-06-01 Thread Russel Winder via Digitalmars-d-learn
On Fri, 2018-06-01 at 11:20 -0400, Steven Schveighoffer via Digitalmars-d-learn wrote: > […] > That assertion is something that should never happen. Something is > wrong > with the type checking here. > > If you look up earlier, clearly the type id matches. There is > something > weird about

Re: Debugging silent exit of threads in Phobos calls

2018-06-01 Thread Russel Winder via Digitalmars-d-learn
On Fri, 2018-06-01 at 18:21 +0300, ketmar via Digitalmars-d-learn wrote: > […] > it may be something with struct copying. variant wants to copy a > struct > into itself, and somehow failed. either there is no room, or > something > prevented it to do that. it is hard to say more without full

Re: Debugging silent exit of threads in Phobos calls

2018-06-01 Thread ketmar via Digitalmars-d-learn
Steven Schveighoffer wrote: Can you put in some more debug messages and see what the exact types of A and T are? Just put it right before the assert. you prolly asked Russel here, as i don't have his sources to experiment with. ;-)

Re: Debugging silent exit of threads in Phobos calls

2018-06-01 Thread ketmar via Digitalmars-d-learn
Russel Winder wrote: On Fri, 2018-06-01 at 17:53 +0300, ketmar via Digitalmars-d-learn wrote: […] it looks like "// type T is not constructible from A" phobos assertion triggered. that is, std.variant cannot wrap the struct, and all hell breaks loose. An instance of FrontendAppeared is

Re: Debugging silent exit of threads in Phobos calls

2018-06-01 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/1/18 10:53 AM, ketmar wrote: Russel Winder wrote: On Fri, 2018-06-01 at 16:37 +0300, ketmar via Digitalmars-d-learn wrote: […] yeah. if it receives something it doesn't expect (and there is no `Variant` clause to catch it), it throws. and exceptions from threads are silently dropped

Re: Debugging silent exit of threads in Phobos calls

2018-06-01 Thread Russel Winder via Digitalmars-d-learn
On Fri, 2018-06-01 at 17:53 +0300, ketmar via Digitalmars-d-learn wrote: > […] > it looks like "// type T is not constructible from A" phobos > assertion > triggered. that is, std.variant cannot wrap the struct, and all hell > breaks > loose. An instance of FrontendAppeared is created in

Re: Debugging silent exit of threads in Phobos calls

2018-06-01 Thread Russel Winder via Digitalmars-d-learn
On Fri, 2018-06-01 at 07:59 -0700, Ali Çehreli via Digitalmars-d-learn wrote: > On 06/01/2018 04:12 AM, Russel Winder wrote: > > > Obviously std.concurrency.receive should never terminate a thread, > > and > > it should never terminate a thread silently, but given that it > > clearly > > does

Re: Debugging silent exit of threads in Phobos calls

2018-06-01 Thread Ali Çehreli via Digitalmars-d-learn
On 06/01/2018 04:12 AM, Russel Winder wrote: Obviously std.concurrency.receive should never terminate a thread, and it should never terminate a thread silently, but given that it clearly does (using dmd 2.080 from d-apt on Debian Sid) how is one to find out useful information as to why it is

Re: Debugging silent exit of threads in Phobos calls

2018-06-01 Thread ketmar via Digitalmars-d-learn
Russel Winder wrote: On Fri, 2018-06-01 at 16:37 +0300, ketmar via Digitalmars-d-learn wrote: […] yeah. if it receives something it doesn't expect (and there is no `Variant` clause to catch it), it throws. and exceptions from threads are silently dropped on the floor -- along with the dead

Re: Debugging silent exit of threads in Phobos calls

2018-06-01 Thread Russel Winder via Digitalmars-d-learn
On Fri, 2018-06-01 at 16:37 +0300, ketmar via Digitalmars-d-learn wrote: > […] > yeah. if it receives something it doesn't expect (and there is no > `Variant` > clause to catch it), it throws. and exceptions from threads are > silently > dropped on the floor -- along with the dead threads. so

Re: Debugging silent exit of threads in Phobos calls

2018-06-01 Thread Russel Winder via Digitalmars-d-learn
On Fri, 2018-06-01 at 09:31 -0400, Steven Schveighoffer via Digitalmars-d-learn wrote: > On 6/1/18 7:12 AM, Russel Winder wrote: > > So I had a play and gdb seems to be useless for trying to find out > > why > > calls to std.concurrency.receive exit silently. > > > > Obviously

Re: converting expression to delegate works only for variadic array?

2018-06-01 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/1/18 10:08 AM, Gopan wrote: Hi, I created a test application (test.d) to learn delegates. import core.stdc.stdio; void Multi (int delegate()[] args ...) {     foreach (exp; args) printf ("%d, ", exp() );     printf ("\n"); } void Single (int delegate() exp) {     printf ("%d\n",

Re: std.process.pipeProcess stalls (linux)

2018-06-01 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/1/18 9:40 AM, Carl Sturtivant wrote: A computationally intensive process run from the command line works fine, runs to completion after several minutes, writing a few hundred lines of text to standard output and creating, writing to and closing around 200 files of size around 20KB. Now

converting expression to delegate works only for variadic array?

2018-06-01 Thread Gopan via Digitalmars-d-learn
Hi, I created a test application (test.d) to learn delegates. import core.stdc.stdio; void Multi (int delegate()[] args ...) { foreach (exp; args) printf ("%d, ", exp() ); printf ("\n"); } void Single (int delegate() exp) { printf ("%d\n", exp()); } void main() {

Re: std.process.pipeProcess stalls (linux)

2018-06-01 Thread Basile B. via Digitalmars-d-learn
On Friday, 1 June 2018 at 13:40:51 UTC, Carl Sturtivant wrote: A computationally intensive process run from the command line works fine, runs to completion after several minutes, writing a few hundred lines of text to standard output and creating, writing to and closing around 200 files of

std.process.pipeProcess stalls (linux)

2018-06-01 Thread Carl Sturtivant via Digitalmars-d-learn
A computationally intensive process run from the command line works fine, runs to completion after several minutes, writing a few hundred lines of text to standard output and creating, writing to and closing around 200 files of size around 20KB. Now run from std.process.pipeProcess and

Re: Debugging silent exit of threads in Phobos calls

2018-06-01 Thread ketmar via Digitalmars-d-learn
Steven Schveighoffer wrote: On 6/1/18 7:12 AM, Russel Winder wrote: So I had a play and gdb seems to be useless for trying to find out why calls to std.concurrency.receive exit silently. Obviously std.concurrency.receive should never terminate a thread, and it should never terminate a thread

Re: Debugging silent exit of threads in Phobos calls

2018-06-01 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/1/18 7:12 AM, Russel Winder wrote: So I had a play and gdb seems to be useless for trying to find out why calls to std.concurrency.receive exit silently. Obviously std.concurrency.receive should never terminate a thread, and it should never terminate a thread silently, but given that it

Debugging silent exit of threads in Phobos calls

2018-06-01 Thread Russel Winder via Digitalmars-d-learn
So I had a play and gdb seems to be useless for trying to find out why calls to std.concurrency.receive exit silently. Obviously std.concurrency.receive should never terminate a thread, and it should never terminate a thread silently, but given that it clearly does (using dmd 2.080 from d-apt on

Re: spawn, send, and receive

2018-06-01 Thread Russel Winder via Digitalmars-d-learn
It seems that the receive function, immediately on processing a message, is terminating it's thread silently. So the question now is under what circumstances does std.concurrency.receive exit its thread without notice? On Thu, 2018-05-31 at 17:29 +0100, Russel Winder wrote: > I am fiddling

Re: Convert a huge SQL file to CSV

2018-06-01 Thread Martin Tschierschke via Digitalmars-d-learn
On Friday, 1 June 2018 at 09:49:23 UTC, biocyberman wrote: I need to convert a compressed 17GB SQL dump to CSV. A workable solution is to create a temporary mysql database, import the dump, query by python, and export. But i wonder if there is something someway in D to parse the SQL file

Convert a huge SQL file to CSV

2018-06-01 Thread biocyberman via Digitalmars-d-learn
I need to convert a compressed 17GB SQL dump to CSV. A workable solution is to create a temporary mysql database, import the dump, query by python, and export. But i wonder if there is something someway in D to parse the SQL file directly and query and export the data. I imagine this will

Re: Constructing text with astericks

2018-06-01 Thread Kagamin via Digitalmars-d-learn
I don't think bitmaps are a good idea, keep your font in text format with characters indexed by code unit: immutable string[][] font=[ ... [ //'i' "*", "*", "*", "*", "*"], ... [ //'s' "*", "*", "*", "*", "*"], ... ];