Discussion Thread: DIP 1040--Copying, Moving, and Forwarding--Community Review Round 1
Walter Bright
newshound2 at digitalmars.com
Mon Mar 15 08:01:02 UTC 2021
On 3/13/2021 11:47 AM, 12345swordy wrote:
> On Saturday, 13 March 2021 at 03:06:35 UTC, Walter Bright wrote:
>> On 3/11/2021 10:56 AM, 12345swordy wrote:
>>> How does it handle move constructors when a class have struct type variable
>>> that is being alias this?
>>
>> #DIP1040 only applies to structs, not classes.
>
> That doesn't answer the question.
The question doesn't make a lot of sense, as what does it have to do with classes?
> How does the DIP interact with the current alias this system?
> If I alias this a struct variable with move schematics in struct/class
> definition called A, does A have the move schematics of the struct variable?
> Replying "only applied to structs and not classes" isn't helpful here. I am not
> talking about defining move schematics for classes, I am talking about the class
> inheriting the struct that has move schematics defined, via alias this.
Classes don't inherit structs. But I will guess at what you mean.
We've discovered that alias this and classes produce a semantic quagmire that
every proposed resolution just leads to worse weird cases. Hence:
1. I recommend NEVER using alias this in a class.
2. I'd like to make it illegal.
3. Any questions about how alias this works in a class, I refer to (1).
DIP1040 does not apply to classes. If you have a class that has an alias this
that refers to a struct with move semantics, you're going to be sorry :-/
I recommend NEVER using alias this in a class.
More information about the Digitalmars-d
mailing list