Re: inout delegate

2016-10-09 Thread Manu via Digitalmars-d
On 9 October 2016 at 16:04, Nicholas Wilson via Digitalmars-d wrote: > On Friday, 7 October 2016 at 02:13:21 UTC, Manu wrote: >> >> Perhaps you'd like to give it a go ;) >> >> Something like: >> >> template delegateTypeForInoutMethod(T, string method) >> { >> alias delegateTypeForInoutMethod = [

Re: inout delegate

2016-10-09 Thread Adam D. Ruppe via Digitalmars-d
On Sunday, 9 October 2016 at 04:20:26 UTC, Nicholas Wilson wrote: Do you know the cause? i.e. would dustmiting/`git bisect` tell you anything you don't already know? On the bug report, I linked to the commit and a small patch that fixes the problem: https://github.com/dlang/dmd/commit/3c53a0f

Re: inout delegate

2016-10-08 Thread Nicholas Wilson via Digitalmars-d
On Friday, 7 October 2016 at 02:13:21 UTC, Manu wrote: Perhaps you'd like to give it a go ;) Something like: template delegateTypeForInoutMethod(T, string method) { alias delegateTypeForInoutMethod = [write lots of stuff here]; } struct S { inout(int)[] f(ref const(int) arg) inout pure not

Re: inout delegate

2016-10-08 Thread Nicholas Wilson via Digitalmars-d
On Sunday, 2 October 2016 at 09:55:26 UTC, Manu wrote: Can someone explain this to me? class Test { inout(int) f() inout { return 10; } void t() { f(); // calls fine with mutable 'this' auto d = &this.f; // error : inout method Test.f is not callable using a mutable this d()

Re: inout delegate

2016-10-08 Thread Nicholas Wilson via Digitalmars-d
On Friday, 7 October 2016 at 02:13:21 UTC, Manu wrote: Since this is a bug (and a very recent regression no less) Do you know the cause? i.e. would dustmiting/`git bisect` tell you anything you don't already know?

Re: inout delegate

2016-10-08 Thread Manu via Digitalmars-d
On 7 October 2016 at 01:00, Manu wrote: > On 6 October 2016 at 00:29, Manu wrote: >> On 4 October 2016 at 11:15, Manu wrote: >>> On 4 October 2016 at 10:50, Timon Gehr via Digitalmars-d >>> wrote: On 03.10.2016 05:06, Manu via Digitalmars-d wrote: > > Okay, well my current project

Re: inout delegate

2016-10-06 Thread Manu via Digitalmars-d
On 7 October 2016 at 05:58, Jinx via Digitalmars-d wrote: > On Thursday, 6 October 2016 at 15:00:56 UTC, Manu wrote: >> >> On 6 October 2016 at 00:29, Manu wrote: >>> >>> On 4 October 2016 at 11:15, Manu wrote: [...] >>> >>> >>> I'm really struggling with this issue.. multiple times a

Re: inout delegate

2016-10-06 Thread Jinx via Digitalmars-d
On Thursday, 6 October 2016 at 15:00:56 UTC, Manu wrote: On 6 October 2016 at 00:29, Manu wrote: On 4 October 2016 at 11:15, Manu wrote: [...] I'm really struggling with this issue.. multiple times a day. I can't find a reasonable workaround. casting, or trying to re-synth the delegate typ

Re: inout delegate

2016-10-06 Thread Manu via Digitalmars-d
On 6 October 2016 at 00:29, Manu wrote: > On 4 October 2016 at 11:15, Manu wrote: >> On 4 October 2016 at 10:50, Timon Gehr via Digitalmars-d >> wrote: >>> On 03.10.2016 05:06, Manu via Digitalmars-d wrote: Okay, well my current project is blocked on this. I can't progress. https:

Re: inout delegate

2016-10-05 Thread Manu via Digitalmars-d
On 4 October 2016 at 11:15, Manu wrote: > On 4 October 2016 at 10:50, Timon Gehr via Digitalmars-d > wrote: >> On 03.10.2016 05:06, Manu via Digitalmars-d wrote: >>> >>> Okay, well my current project is blocked on this. I can't progress. >>> https://issues.dlang.org/show_bug.cgi?id=16572 >> >> >>

Re: inout delegate

2016-10-03 Thread Manu via Digitalmars-d
On 4 October 2016 at 10:50, Timon Gehr via Digitalmars-d wrote: > On 03.10.2016 05:06, Manu via Digitalmars-d wrote: >> >> Okay, well my current project is blocked on this. I can't progress. >> https://issues.dlang.org/show_bug.cgi?id=16572 > > > Probably you can work around the issue using unsafe

Re: inout delegate

2016-10-03 Thread Timon Gehr via Digitalmars-d
On 03.10.2016 05:06, Manu via Digitalmars-d wrote: Okay, well my current project is blocked on this. I can't progress. https://issues.dlang.org/show_bug.cgi?id=16572 Probably you can work around the issue using unsafe type casts.

Re: inout delegate

2016-10-03 Thread David Nadlinger via Digitalmars-d
On Monday, 3 October 2016 at 02:47:09 UTC, Manu wrote: On 3 October 2016 at 02:37, Timon Gehr via Digitalmars-d This is a known issue: https://issues.dlang.org/show_bug.cgi?id=3720 (What I do is: typeof(&typeof(this).f) is int delegate(), but auto x = &f does not compile as the 'this' refere

Re: inout delegate

2016-10-03 Thread Manu via Digitalmars-d
On 3 October 2016 at 17:18, Jacob Carlborg via Digitalmars-d wrote: > On 2016-10-03 05:06, Manu via Digitalmars-d wrote: > >> Okay, well my current project is blocked on this. I can't progress. >> https://issues.dlang.org/show_bug.cgi?id=16572 > > > I You can remove "inout" ;) That just makes a d

Re: inout delegate

2016-10-03 Thread Jacob Carlborg via Digitalmars-d
On 2016-10-03 05:06, Manu via Digitalmars-d wrote: Okay, well my current project is blocked on this. I can't progress. https://issues.dlang.org/show_bug.cgi?id=16572 I You can remove "inout" ;) -- /Jacob Carlborg

Re: inout delegate

2016-10-02 Thread Manu via Digitalmars-d
On 3 October 2016 at 02:00, Steven Schveighoffer via Digitalmars-d wrote: > On 10/2/16 2:55 AM, Manu via Digitalmars-d wrote: >> >> Can someone explain this to me? >> >> class Test >> { >> inout(int) f() inout { return 10; } >> >> void t() >> { >> f(); // calls fine with mutable 'this' >

Re: inout delegate

2016-10-02 Thread Manu via Digitalmars-d
On 3 October 2016 at 02:37, Timon Gehr via Digitalmars-d wrote: > On 02.10.2016 13:27, Manu via Digitalmars-d wrote: >> >> And what's the logic behind this: >> >> class Test >> { >> int f() { return 10; } >> >> static assert(is(typeof(&typeof(this).f) == int function())); // huh? >> >> stati

Re: inout delegate

2016-10-02 Thread Timon Gehr via Digitalmars-d
On 02.10.2016 13:27, Manu via Digitalmars-d wrote: And what's the logic behind this: class Test { int f() { return 10; } static assert(is(typeof(&typeof(this).f) == int function())); // huh? static void t() { // as expected: f(); // error : need 'this' for 'f' of type 'int()'

Re: inout delegate

2016-10-02 Thread Timon Gehr via Digitalmars-d
On 02.10.2016 18:00, Steven Schveighoffer wrote: On 10/2/16 2:55 AM, Manu via Digitalmars-d wrote: Can someone explain this to me? class Test { inout(int) f() inout { return 10; } void t() { f(); // calls fine with mutable 'this' auto d = &this.f; // error : inout method Test.f i

Re: inout delegate

2016-10-02 Thread Steven Schveighoffer via Digitalmars-d
On 10/2/16 2:55 AM, Manu via Digitalmars-d wrote: Can someone explain this to me? class Test { inout(int) f() inout { return 10; } void t() { f(); // calls fine with mutable 'this' auto d = &this.f; // error : inout method Test.f is not callable using a mutable this d(); } }

Re: inout delegate

2016-10-02 Thread Manu via Digitalmars-d
And what's the logic behind this: class Test { int f() { return 10; } static assert(is(typeof(&typeof(this).f) == int function())); // huh? static void t() { // as expected: f(); // error : need 'this' for 'f' of type 'int()' // calling a method without a context pointer...

inout delegate

2016-10-02 Thread Manu via Digitalmars-d
Can someone explain this to me? class Test { inout(int) f() inout { return 10; } void t() { f(); // calls fine with mutable 'this' auto d = &this.f; // error : inout method Test.f is not callable using a mutable this d(); } } That error message seems very unhelpful, and it's