Re: system's "kill " signal

2016-11-04 Thread Basile B. via Digitalmars-d-learn
On Saturday, 5 November 2016 at 02:24:00 UTC, Konstantin Kutsevalov wrote: Hi, is there a way to catch system signal of "kill" command or "shutdown"? During the Run-time: You can register a signal callback, like in this sample (hit CTRL+C once running in a terminal):

Re: system's "kill " signal

2016-11-04 Thread Nicholas Wilson via Digitalmars-d-learn
On Saturday, 5 November 2016 at 02:24:00 UTC, Konstantin Kutsevalov wrote: Hi, is there a way to catch system signal of "kill" command or "shutdown"? PS: are there some other ways also to send signals to running a D application? have a look in std.process I don't think you can catch kill.

Re: Calling std.variant.visit from a pure function

2016-11-04 Thread Paul Backus via Digitalmars-d-learn
On Friday, 4 November 2016 at 23:38:47 UTC, sarn wrote: I suggest trying it with the latest dmd and filing a bug report. Taking a quick look at the library code (https://github.com/dlang/phobos/blob/master/std/variant.d), it *seems* like everything uses templates and functions returning auto,

Re: is there "this"?

2016-11-04 Thread Konstantin Kutsevalov via Digitalmars-d-learn
On Thursday, 3 November 2016 at 13:40:11 UTC, Steven Schveighoffer wrote: On 11/2/16 4:43 AM, Jonathan M Davis via Digitalmars-d-learn In the case of the original post, however, you *need* to use this.value, as the parameter masks the member of the same name. Using 'this' removes ambiguity.

system's "kill " signal

2016-11-04 Thread Konstantin Kutsevalov via Digitalmars-d-learn
Hi, is there a way to catch system signal of "kill" command or "shutdown"? PS: are there some other ways also to send signals to running a D application?

Re: Calling std.variant.visit from a pure function

2016-11-04 Thread sarn via Digitalmars-d-learn
On Friday, 4 November 2016 at 02:56:07 UTC, Paul Backus wrote: When I compile this (using DMD 2.069 on Debian Linux), I get an error saying that I can't call visit from a pure function. This is surprising, since all visit does (in theory) is call the provided functions, and all of _them_ are pu

Re: not callable error

2016-11-04 Thread lobo via Digitalmars-d-learn
On Friday, 4 November 2016 at 14:37:04 UTC, bluphantom91 wrote: On Friday, 4 November 2016 at 02:59:49 UTC, Paul Backus wrote: On Friday, 4 November 2016 at 02:28:17 UTC, bluphantom91 wrote: Hello, I am trying to finish up a group project but I am running into a small problem. I keep getting

Re: not callable error

2016-11-04 Thread Nemanja Boric via Digitalmars-d-learn
On Friday, 4 November 2016 at 14:37:04 UTC, bluphantom91 wrote: On Friday, 4 November 2016 at 02:59:49 UTC, Paul Backus wrote: On Friday, 4 November 2016 at 02:28:17 UTC, bluphantom91 wrote: Hello, I am trying to finish up a group project but I am running into a small problem. I keep getting

Re: check instance of nested variadic template

2016-11-04 Thread Basile B. via Digitalmars-d-learn
On Friday, 4 November 2016 at 15:50:36 UTC, Gianni Pisetta wrote: Hi all, I am having issues finding a solution for this, i want to check if an alias is an istance of a variadic template nested in another variadic template. [...] there is some sort of workaround? Thanks, Gianni Hello, I'm n

check instance of nested variadic template

2016-11-04 Thread Gianni Pisetta via Digitalmars-d-learn
Hi all, I am having issues finding a solution for this, i want to check if an alias is an istance of a variadic template nested in another variadic template. Here is an example: template A(As...) { template B(Bs...) { } } alias BI = A!(1,2).B!(3,4,5); Now i want to test if BI is an i

Re: Combining "chunkBy" and "until" algorithms

2016-11-04 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Friday, 4 November 2016 at 08:04:12 UTC, Jacob Carlborg wrote: Currently I'm using a standard for loop iterating over the lines. I'm always looking at the current line and the next line. When the current line is the standard pattern and the next line is is not, I do a separate loop until I s

Re: What is the simplest way of doing @nogc string concatenation?

2016-11-04 Thread ketmar via Digitalmars-d-learn
On Friday, 4 November 2016 at 14:56:46 UTC, Guillaume Piolat wrote: On Friday, 4 November 2016 at 14:55:27 UTC, Guillaume Piolat wrote: On Thursday, 3 November 2016 at 18:54:14 UTC, Gary Willoughby wrote: What is the simplest way of doing @nogc string concatenation? I use sprintf + zero-termi

Re: What is the simplest way of doing @nogc string concatenation?

2016-11-04 Thread Guillaume Piolat via Digitalmars-d-learn
On Friday, 4 November 2016 at 14:55:27 UTC, Guillaume Piolat wrote: On Thursday, 3 November 2016 at 18:54:14 UTC, Gary Willoughby wrote: What is the simplest way of doing @nogc string concatenation? I use sprintf + zero-terminated strings (or a RAII struct to convert slices to ZT strings).

Re: What is the simplest way of doing @nogc string concatenation?

2016-11-04 Thread Guillaume Piolat via Digitalmars-d-learn
On Thursday, 3 November 2016 at 18:54:14 UTC, Gary Willoughby wrote: What is the simplest way of doing @nogc string concatenation? I use sprintf + zero-terminated strings (or a RAII struct to convert slices to ZT strings).

Re: not callable error

2016-11-04 Thread bluphantom91 via Digitalmars-d-learn
On Friday, 4 November 2016 at 02:59:49 UTC, Paul Backus wrote: On Friday, 4 November 2016 at 02:28:17 UTC, bluphantom91 wrote: Hello, I am trying to finish up a group project but I am running into a small problem. I keep getting an error about fgetc not being callable. The purpose of my progr

(Solved) Re: Compilation phobos errors with DMD 2.071,2.072 or dub

2016-11-04 Thread Ozan (ONS) via Digitalmars-d-learn
On Thursday, 3 November 2016 at 14:52:26 UTC, Ozan (ONS) wrote: Hi, with a fresh Ubuntu 16.10 installation using "Hello, World" I got a list of following errors like: /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libphobos2.a(thread_256_713.o): relocation R_X86_64_32 against symbol `_D6object9Throw

Combining "chunkBy" and "until" algorithms

2016-11-04 Thread Jacob Carlborg via Digitalmars-d-learn
I have a file with a bunch of lines I want to process. I want to process these lines line by line. Most of these lines have the same pattern. Some of the lines have a different pattern. I want to bundle those lines, which have a non-standard pattern, together with the last line that had the sta

Re: Error: function std.stdio.setmode is not accessible from module a

2016-11-04 Thread Kirill Kryukov via Digitalmars-d-learn
On Wednesday, 2 November 2016 at 11:17:49 UTC, Jonathan M Davis wrote: version(DIGITAL_MARS_STDIO) extern(C) int setmode(int, int) nothrow @nogc; else version(MICROSOFT_STDIO) { extern(C) int _setmode(int, int) nothrow @nogc; alias setmode = _setmode; } It really should be put in dr