Inconsistency between `AllMembers` and `hasMember`

2018-11-17 Thread drug via Digitalmars-d-learn
https://run.dlang.io/is/IygU5D AllMembers states that struct S contains "this" member, but hasMember negates it. Is it bug or misusing?

Re: Inconsistency between `AllMembers` and `hasMember`

2018-11-17 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 17 November 2018 at 20:54:24 UTC, drug wrote: https://run.dlang.io/is/IygU5D AllMembers states that struct S contains "this" member, but hasMember negates it. Is it bug or misusing? I'm not sure what it is supposed to do, but since this is kinda special - it is a keyword for the

Re: Inconsistency between `AllMembers` and `hasMember`

2018-11-17 Thread drug via Digitalmars-d-learn
On 18.11.2018 0:09, Adam D. Ruppe wrote: On Saturday, 17 November 2018 at 20:54:24 UTC, drug wrote: https://run.dlang.io/is/IygU5D AllMembers states that struct S contains "this" member, but hasMember negates it. Is it bug or misusing? I'm not sure what it is supposed to do, but since this i

Re: Inconsistency between `AllMembers` and `hasMember`

2018-11-17 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 17 November 2018 at 21:33:37 UTC, drug wrote: Another problem I'm trying to resolve is that if I define struct S outside of unittest or inside of unittest but using static qualifier AllMembers does not return "this". Also if struct S do not have methods AllMembers also doesn't retu

Re: Inconsistency between `AllMembers` and `hasMember`

2018-11-17 Thread drug via Digitalmars-d-learn
On 18.11.2018 1:26, Adam D. Ruppe wrote: That's because the compiler passes it a hidden pointer to refer to the context outside. The compiler could perhaps be smarter about it, and see if those methods actually refer to the context, but it seems to simply say if the method is there, it might

Re: Inconsistency between `AllMembers` and `hasMember`

2018-11-17 Thread Stanislav Blinov via Digitalmars-d-learn
On Sunday, 18 November 2018 at 00:51:51 UTC, drug wrote: On 18.11.2018 1:26, Adam D. Ruppe wrote: That's because the compiler passes it a hidden pointer to refer to the context outside. The compiler could perhaps be smarter about it, and see if those methods actually refer to the context, bu

Re: Inconsistency between `AllMembers` and `hasMember`

2018-11-18 Thread bauss via Digitalmars-d-learn
On Sunday, 18 November 2018 at 02:37:13 UTC, Stanislav Blinov wrote: On Sunday, 18 November 2018 at 00:51:51 UTC, drug wrote: On 18.11.2018 1:26, Adam D. Ruppe wrote: That's because the compiler passes it a hidden pointer to refer to the context outside. The compiler could perhaps be smarter

Re: Inconsistency between `AllMembers` and `hasMember`

2018-11-18 Thread Stanislav Blinov via Digitalmars-d-learn
On Sunday, 18 November 2018 at 09:10:57 UTC, bauss wrote: On Sunday, 18 November 2018 at 02:37:13 UTC, Stanislav Blinov wrote: It's only "hidden" in that there's no symbol to access it... But in that case shouldn't you be able to tell whether it has it or not through hasMember? Yah, a cas

Re: Inconsistency between `AllMembers` and `hasMember`

2018-11-18 Thread drug via Digitalmars-d-learn
On 18.11.2018 5:37, Stanislav Blinov wrote: It's only "hidden" in that there's no symbol to access it. But you can still access it via .tupleof, and it still of course affects the ABI (i.e. S.sizeof is always at least pointer size when S is nested). If you want to iterate fields, .tupleof is a

Re: Inconsistency between `AllMembers` and `hasMember`

2018-11-18 Thread Stanislav Blinov via Digitalmars-d-learn
Reported: https://issues.dlang.org/show_bug.cgi?id=19410