Re: Stack overflow / recursive expansion with alias this

2012-06-27 Thread Kenji Hara

On Tuesday, 24 April 2012 at 20:09:32 UTC, Namespace wrote:

On Tuesday, 24 April 2012 at 19:34:26 UTC, Timon Gehr wrote:

On 04/24/2012 07:09 PM, Namespace wrote:

...
And therefore i get the same error, as if i wrote return
NotNull!(Foo)(this); instead of return 
assumeNotNull(this);, in the
_convert method of NotNull. The Output is Stack 
overflow. I think
that comes from recursive calls which fills the stack? Is 
that a bug?




Yes.


I found nothing like that. Is the bug reported?


I remember reporting a similar issue, but that one seems to 
have been fixed. Feel free to create a new ticket.


That's what I do now. Thanks a lot for your help.


Today I posted a pull to detect recursive alias this dependency.
https://github.com/D-Programming-Language/dmd/pull/1028

Bye.

Kenji Hara


Re: Stack overflow / recursive expansion with alias this

2012-04-24 Thread Namespace

Hm, doesn't anybody know anything about it?


Re: Stack overflow / recursive expansion with alias this

2012-04-24 Thread Timon Gehr

On 04/23/2012 11:29 PM, Namespace wrote:

I have this code:


...

 T _get() {
 return this._value;
 }

 const(T) _get() const {
 return this._value;
 }



You missed the 'immutable' and 'inout cases.
Just use inout(T) _get() inout { return _value; } instead of the two 
declarations you have.



...
And therefore i get the same error, as if i wrote return
NotNull!(Foo)(this); instead of return assumeNotNull(this);, in the
_convert method of NotNull. The Output is Stack overflow. I think
that comes from recursive calls which fills the stack? Is that a bug?



Yes.


Re: Stack overflow / recursive expansion with alias this

2012-04-24 Thread Namespace



You missed the 'immutable' and 'inout cases.
Just use inout(T) _get() inout { return _value; } instead of 
the two declarations you have.


Oh, thanks a lot, i'm forgetting this often.




...
And therefore i get the same error, as if i wrote return
NotNull!(Foo)(this); instead of return 
assumeNotNull(this);, in the
_convert method of NotNull. The Output is Stack overflow. 
I think
that comes from recursive calls which fills the stack? Is that 
a bug?




Yes.


Some ideas how i can implement this otherwise? And would the bug 
fix come with 2.060?

With this functionality, the NotNull struct would be perfect.




Re: Stack overflow / recursive expansion with alias this

2012-04-24 Thread Namespace

...
And therefore i get the same error, as if i wrote return
NotNull!(Foo)(this); instead of return 
assumeNotNull(this);, in the
_convert method of NotNull. The Output is Stack overflow. 
I think
that comes from recursive calls which fills the stack? Is that 
a bug?




Yes.


I found nothing like that. Is the bug reported?


Re: Stack overflow / recursive expansion with alias this

2012-04-24 Thread Timon Gehr

On 04/24/2012 07:09 PM, Namespace wrote:

...
And therefore i get the same error, as if i wrote return
NotNull!(Foo)(this); instead of return assumeNotNull(this);, in the
_convert method of NotNull. The Output is Stack overflow. I think
that comes from recursive calls which fills the stack? Is that a bug?



Yes.


I found nothing like that. Is the bug reported?


I remember reporting a similar issue, but that one seems to have been 
fixed. Feel free to create a new ticket.


Re: Stack overflow / recursive expansion with alias this

2012-04-24 Thread Namespace

On Tuesday, 24 April 2012 at 19:34:26 UTC, Timon Gehr wrote:

On 04/24/2012 07:09 PM, Namespace wrote:

...
And therefore i get the same error, as if i wrote return
NotNull!(Foo)(this); instead of return 
assumeNotNull(this);, in the
_convert method of NotNull. The Output is Stack 
overflow. I think
that comes from recursive calls which fills the stack? Is 
that a bug?




Yes.


I found nothing like that. Is the bug reported?


I remember reporting a similar issue, but that one seems to 
have been fixed. Feel free to create a new ticket.


That's what I do now. Thanks a lot for your help.