Re: Implicit cast to immutable

2011-10-05 Thread bearophile
Andrej Mitrovic: > Maybe: > > immutable(int[]) foo(in int[] x) pure { >return new immutable(int[1]); > } > > void main() {} I'd like to know why the code in my original post doesn't compile. I suspect it's a DMD bug, but I am not sure. > Or does this have something to do with implicit ca

Re: Implicit cast to immutable

2011-10-05 Thread Andrej Mitrovic
Maybe: immutable(int[]) foo(in int[] x) pure { return new immutable(int[1]); } void main() {} Or does this have something to do with implicit casts to immutable for pure functions? I'm only vaguely familiar with pure..

Implicit cast to immutable

2011-10-05 Thread bearophile
Do you know why this program doesn't compile (with DMD 2.056head)? immutable(int[]) foo(in int[] x) pure { return new int[1]; } void main() {} It gives: test.d(2): Error: cannot implicitly convert expression (new int[](1u)) of type int[] to immutable(int[]) This program instead compiles (

Re: check for running process

2011-10-05 Thread Kagamin
Steven Schveighoffer Wrote: > It's just the getting of the pid based on the name is not straightforward. There's an open standard for this: http://en.wikipedia.org/wiki/Common_Information_Model_%28computing%29

Re: check for running process

2011-10-05 Thread Regan Heath
On Wed, 05 Oct 2011 16:05:02 +0100, Steven Schveighoffer wrote: On Wed, 05 Oct 2011 10:38:58 -0400, Dsmith wrote: In the core.thread library, there is a method isRunning() which takes a thread. To make code more portable, rather than use a system call or getenv(), how might isRunning

Re: check for running process

2011-10-05 Thread Steven Schveighoffer
On Wed, 05 Oct 2011 10:38:58 -0400, Dsmith wrote: In the core.thread library, there is a method isRunning() which takes a thread. To make code more portable, rather than use a system call or getenv(), how might isRunning() be adapted to check if a program is running? Ideally: isrunning(pr

Re: Simple I know, but could use some help compiling with make

2011-10-05 Thread Ola Ost
I had exactly this problem too, I asked on the Derelict forums: http://www.dsource.org/forums/viewtopic.php?t=5856&sid=8ebff671fafec3bd8962ddfceaf99eb8 At the moment I've resolved this by building Derelict with make, first a normal full build, then a second run using the cleandi target, which rem

check for running process

2011-10-05 Thread Dsmith
In the core.thread library, there is a method isRunning() which takes a thread. To make code more portable, rather than use a system call or getenv(), how might isRunning() be adapted to check if a program is running? Ideally: isrunning(program_name);

Re: operator overloading and templates

2011-10-05 Thread Steven Schveighoffer
On Tue, 04 Oct 2011 12:24:52 -0400, jimmy wrote: Hi, I have the following code. struct Foo(int DIM) { Foo!(DIM) opBinary(string op) (Foo!(DIM) rhs) if (op == "+" || op == "-") { return Foo!(DIM)(); } } unittest { auto u = Foo!(2