Re: Determining if a class has a template function

2016-10-14 Thread Meta via Digitalmars-d-learn
On Friday, 14 October 2016 at 09:15:40 UTC, Marc Schütz wrote: On Wednesday, 12 October 2016 at 16:57:50 UTC, Meta wrote: There's also a *very* ugly hack you can do: //A template function's .stringof is of the format name>()() //so match on the number of brackets to determine whether it's a

Re: Cannot link with libphobos2.a with GCC 6.2 on Ubuntu 16.10

2016-10-14 Thread Nordlöw via Digitalmars-d-learn
On Thursday, 13 October 2016 at 19:11:36 UTC, Adam D. Ruppe wrote: Try `-defaultlib=libphobos2.so` with your dmd command line. The .so version is pic compiled. Or you can recompile the whole lib. I don't know how to do that from the command line. I don't want to hand modify the Makefile

Re: Building DMD with DMD or LDC

2016-10-14 Thread Daniel Kozak via Digitalmars-d-learn
Dne 14.10.2016 v 00:06 Nordlöw via Digitalmars-d-learn napsal(a): On Thursday, 13 October 2016 at 19:28:11 UTC, Daniel Kozak wrote: You can easy try it. Just build dmd with dmd, than with ldc. And then try to compile DMD frontend with both dmd versions :) Dne 13.10.2016 v 21:07 Nordlöw via

Re: Building DMD with DMD or LDC

2016-10-14 Thread Nordlöw via Digitalmars-d-learn
On Friday, 14 October 2016 at 06:05:21 UTC, Daniel Kozak wrote: This seems like a bug to me, you should fill an issue on ldc github tracker. Can you try it with latest stable ldc (1.0)? Done: https://github.com/ldc-developers/ldc/issues/1829

Missing functionality in std.process?

2016-10-14 Thread Andre Pany via Digitalmars-d-learn
Hi, I developed an application which starts and stops other applications like NodeJS HTTP server applications or Java Tomee Servlets. A typical NodeJS application has a process tree of 4-5 levels. I had to switch really fast from std.process functionality like kill and wait to OS specific

Re: Variables with scoped destruction in closures

2016-10-14 Thread Nordlöw via Digitalmars-d-learn
On Friday, 14 October 2016 at 14:00:53 UTC, ag0aep6g wrote: As for ways to make this work: 1) You can move s to the heap yourself: auto below3(size_t n, S s = S.init) { import std.algorithm.mutation: moveEmplace; auto onHeap = cast(S*) new ubyte[S.sizeof]; moveEmplace(s,

Re: Building DMD with DMD or LDC

2016-10-14 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, October 13, 2016 19:07:44 Nordlöw via Digitalmars-d-learn wrote: > Is there a large speed difference in compilation time depending > on whether the DMD used is built using DMD or LDC? I would be shocked if there weren't. The dmd backend does a much worse job at optimization

Re: Variables with scoped destruction in closures

2016-10-14 Thread Nordlöw via Digitalmars-d-learn
On Friday, 14 October 2016 at 16:37:06 UTC, Nordlöw wrote: If I remove the explicit dtor from `S` the code compiles. Can That of course being incorrect D code that leaks memory.

Re: Variables with scoped destruction in closures

2016-10-14 Thread ag0aep6g via Digitalmars-d-learn
On Friday, 14 October 2016 at 14:00:53 UTC, ag0aep6g wrote: As for ways to make this work: 1) You can move s to the heap yourself: [...] 2) Or you can move it into a struct that gets returned (more involved): [...] 3) Put a struct on the heap that acts as the closure: auto

Re: opIndexDispatch?

2016-10-14 Thread Marc Schütz via Digitalmars-d-learn
On Thursday, 13 October 2016 at 01:09:06 UTC, Ali Çehreli wrote: On 10/10/2016 12:01 PM, Yuxuan Shui wrote: Hi, Why is there no opIndexDispatch for overloading a[x].func() ? I could not understand the question fully but would using an element proxy work? I assume a proxy would indeed

Re: Variables with scoped destruction in closures

2016-10-14 Thread ag0aep6g via Digitalmars-d-learn
On 10/14/2016 12:18 PM, Nordlöw wrote: import std.algorithm.iteration : filter; import std.algorithm.mutation : move; import std.range : iota; static private struct S { import core.memory : GC; @disable this(this); this(int x) { _ptr =

Re: opIndexDispatch?

2016-10-14 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, October 14, 2016 09:09:33 Marc Schütz via Digitalmars-d-learn wrote: > On Thursday, 13 October 2016 at 01:09:06 UTC, Ali Çehreli wrote: > > On 10/10/2016 12:01 PM, Yuxuan Shui wrote: > >> Hi, > >> > >> Why is there no opIndexDispatch for overloading a[x].func() ? > > > > I could not

Variables with scoped destruction in closures

2016-10-14 Thread Nordlöw via Digitalmars-d-learn
The following code import std.algorithm.iteration : filter; import std.algorithm.mutation : move; import std.range : iota; static private struct S { import core.memory : GC; @disable this(this); this(int x) { _ptr = cast(typeof(_ptr))GC.malloc((*_ptr).sizeof);

Re: Variables with scoped destruction in closures

2016-10-14 Thread Nordlöw via Digitalmars-d-learn
On Friday, 14 October 2016 at 10:18:19 UTC, Nordlöw wrote: t_scope.d(23,6): Error: variable t_scope.below.s ... Correction, should be: t_scope.d(23,6): Error: variable t_scope.below1.s ...

Re: Determining if a class has a template function

2016-10-14 Thread Marc Schütz via Digitalmars-d-learn
On Wednesday, 12 October 2016 at 16:57:50 UTC, Meta wrote: There's also a *very* ugly hack you can do: //A template function's .stringof is of the format name>()() //so match on the number of brackets to determine whether it's a template function or not enum isTemplateFunction =