Re: Is it feasible to slowly rewrite a C++ codebase in D?

2018-07-11 Thread Dukc via Digitalmars-d-learn
On Wednesday, 11 July 2018 at 19:41:37 UTC, Jordi Gutiérrez Hermoso wrote: Just getting it into -betterC territory seems like a very daunting task. You do not need -betterC anymore. At least the LDC frontend will only add linking hooks for what you use, -betterC or no. No need build a stub ru

Re: Is it feasible to slowly rewrite a C++ codebase in D?

2018-07-11 Thread Jordi Gutiérrez Hermoso via Digitalmars-d-learn
On Tuesday, 10 July 2018 at 20:28:00 UTC, Seb wrote: Maybe looking at the recent DMD Backend to D conversion PRs (https://github.com/dlang/dmd/pulls?utf8=%E2%9C%93&q=is%3Apr+label%3A%22D+Conversion%22+) helps? Here -betterC is used. Octave is so far from -betterC, though. It's very C++-heav

Re: Using dub and rdmd together?

2018-07-11 Thread Timoses via Digitalmars-d-learn
On Wednesday, 11 July 2018 at 16:43:24 UTC, Seb wrote: I don't know of an easy way to do out of the box. However, with dmd's new -i option, it could be as easy as: --- dub fetch requests cat > test.d << EOF import std.stdio; import requests; void main() { auto content = postContent("http://

[std.process] get Pid class by Process ID?

2018-07-11 Thread Jonathan Villa via Digitalmars-d-learn
Hi everyone, Is it possible to get a Pid (class) from a process id (int)?. I need to use the wait function from std.process but it asks for a Pid, and I have only the process id (integer). auto pd = new Pid(processID); // doesn't work I want to verify that the parent process is still alive,

Re: Using dub and rdmd together?

2018-07-11 Thread Seb via Digitalmars-d-learn
On Wednesday, 11 July 2018 at 16:13:56 UTC, Matthew OConnor wrote: Hi, I'm new to D and trying to make some command line tools that are run with `#!/usr/bin/env rdmd`. But I would also like to reference external packages from dub. I know I can do this with: #!/usr/bin/env dub /+ dub.

Using dub and rdmd together?

2018-07-11 Thread Matthew OConnor via Digitalmars-d-learn
Hi, I'm new to D and trying to make some command line tools that are run with `#!/usr/bin/env rdmd`. But I would also like to reference external packages from dub. I know I can do this with: #!/usr/bin/env dub /+ dub.sdl: name "get" dependency "requests" version="~>0.3.2"

Re: Troubles creating templated inout objects

2018-07-11 Thread Timoses via Digitalmars-d-learn
On Tuesday, 10 July 2018 at 18:01:59 UTC, Steven Schveighoffer wrote: You are overthinking :) inout typically is much easier than you expect, until you need to create temporary structs or types with inout members, then it becomes problematic. https://run.dlang.io/is/kosYuC I had to put in a s

Re: taskPool.reduce vs algorithm.reduce

2018-07-11 Thread Timoses via Digitalmars-d-learn
On Wednesday, 11 July 2018 at 08:31:30 UTC, Dorian Haglund wrote: Hi. I'm trying to use taskPool.reduce with a delegate, for example: import std.parallelism; int main(string[] args) { int f(int a, int b) { if (args.length > 1) return a+b; else return a-b; } auto re

Re: taskPool.reduce vs algorithm.reduce

2018-07-11 Thread Paul Backus via Digitalmars-d-learn
On Wednesday, 11 July 2018 at 08:31:30 UTC, Dorian Haglund wrote: But it fails to compile (with gdc 8.1.0, dmd v2.081) complaining that template instance reduce!(f) cannot use local 'f' as parameter to non-global template reduce(functions...) Congratulations! You've just run into issue 571

Re: Better diagnostics for null classes dereferencing

2018-07-11 Thread Per Nordlöw via Digitalmars-d-learn
On Wednesday, 11 July 2018 at 04:17:49 UTC, Seb wrote: https://github.com/dlang/druntime/pull/2249 Thanks!

Re: vibe.d: problematic "Non-@safe methods are deprecated in REST interfaces"

2018-07-11 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, 11 July 2018 01:46:10 MDT Piotr Mitana via Digitalmars-d-learn wrote: > On Tuesday, 10 July 2018 at 13:24:43 UTC, WebFreak001 wrote: > > It's supposed to make webservers safe and not crash because of > > segmentation faults, etc. > > > > If you still want to write code like you are u

taskPool.reduce vs algorithm.reduce

2018-07-11 Thread Dorian Haglund via Digitalmars-d-learn
Hi. I'm trying to use taskPool.reduce with a delegate, for example: import std.parallelism; int main(string[] args) { int f(int a, int b) { if (args.length > 1) return a+b; else return a-b; } auto res = taskPool.reduce!f([1, 2, 3]); return 0; } But it fails to c

Re: vibe.d: problematic "Non-@safe methods are deprecated in REST interfaces"

2018-07-11 Thread Piotr Mitana via Digitalmars-d-learn
On Tuesday, 10 July 2018 at 13:24:43 UTC, WebFreak001 wrote: It's supposed to make webservers safe and not crash because of segmentation faults, etc. If you still want to write code like you are used to and don't care about that in your webserver, just mark everything in the implementation @t