Re: Inconsistency with function pointers

2012-08-04 Thread Russel Winder
On Sat, 2012-08-04 at 21:03 +0200, David Nadlinger wrote: […] > You are trying to pass a delegate which returns a delegate – > this isn't going to work. ;) But that is my whole point, it does a lot of the time, and it depends on whether you are working with named functions and delegates or with a

Re: Inconsistency with function pointers

2012-08-04 Thread David Nadlinger
On Saturday, 4 August 2012 at 19:03:30 UTC, David Nadlinger wrote: In your first example is that […] Darn, make this »In your first example, …«.

Re: Inconsistency with function pointers

2012-08-04 Thread David Nadlinger
On Saturday, 4 August 2012 at 15:23:39 UTC, Russel Winder wrote: trial.d(7): Error: constructor core.thread.Thread.this (void function() fn, ulong sz = cast(ulong)0) is not callable using argument types (void delegate() delegate() pure nothrow @safe) Failed: 'dmd' '-v' '-o-' 'trial.d' '-I.' So

Re: Inconsistency with function pointers

2012-08-04 Thread Jacob Carlborg
On 2012-08-04 18:41, Russel Winder wrote: Isn't there an overload for function and one for delegate? threadFunctionPointerUnnamed.d(5): Error: constructor core.thread.Thread.this called with argument types: ((void function())) matches both: core.thread.Thread.this(void function

Re: Inconsistency with function pointers

2012-08-04 Thread anonymous
On Saturday, 4 August 2012 at 15:23:39 UTC, Russel Winder wrote: [...] I can do: [...] auto f() { return delegate () { writeln("Hello World."); }; } auto t = new Thread(f); [...] However: [...] auto t = new Thread( delegate () { return delegate () { writeln("H

Re: Inconsistency with function pointers

2012-08-04 Thread Russel Winder
Jacob, On Sat, 2012-08-04 at 18:02 +0200, Jacob Carlborg wrote: > On 2012-08-04 17:06, Russel Winder wrote: > > I am sure I am just missing something simple, but I need the nudge… > > > > I can do: > > > > import core.thread ; > > import std.stdio ; > > > > int main(immu

Re: Inconsistency with function pointers

2012-08-04 Thread Jacob Carlborg
On 2012-08-04 17:06, Russel Winder wrote: I am sure I am just missing something simple, but I need the nudge… I can do: import core.thread ; import std.stdio ; int main(immutable string[] args) { auto f() { return delegate () { writeln("Hello World."); };

Inconsistency with function pointers

2012-08-04 Thread Russel Winder
I am sure I am just missing something simple, but I need the nudge… I can do: import core.thread ; import std.stdio ; int main(immutable string[] args) { auto f() { return delegate () { writeln("Hello World."); }; } auto t = new Thread(f);