Conversation
|
Strage bug on Win64. I can't repeat it on Linux64. |
|
If this PR is accepted, you will also be able to claim this bounty: https://www.bountysource.com/issues/1375081-tdpl-there-can-be-only-one-alias-this |
|
Timon Gehr suggested But this debate was merely about syntax, and I don't see how there there could then be multiple |
|
You write: "This magic works only if we have exact match." However, I think implicitly convertible types should be allowed, too. They work with the current implementation. The documentation also requires it to be an error if multiple |
They allowed, but direct alias this hides base-types aliasthises only if match is exact. However the next example are works:
If I don't create mistake, this should works as you say. I'll add it to tests. |
Good news. Thanks =) |
ab5aa74 to
0515fd8
Compare
|
All green. I've moved local struct-member static functions to global scope and it starts to work on windows.
Yes, my implementation do it as you say. I've added a corresponding test. |
src/aggregate.h
Outdated
There was a problem hiding this comment.
Please use aliasThisSymbols or something. thises is awkward.
f2dd288 to
7497d1a
Compare
|
Ping |
|
Wow. I have been waiting for this feature for a long time! Can't wait to see this merged. Ping @WalterBright ? |
|
@IgorStepanov I'm not reviewing the code yet, but the |
7497d1a to
5420ec3
Compare
Done |
|
@andralex Ping. Please comment the tests and conflict resolving semantic. |
5420ec3 to
50bacea
Compare
|
@andralex ping |
934357c to
f5d6d45
Compare
|
I don't see a strong use-case for the ambiguity resolution. So instead of adding a special rule, making the feature/language more complex, I would stick to the existing |
Example: May be this example is not best, but it reflect the idea. Base type declares that it is subtype of T, derived types support this subtyping, but add own behaviour. |
|
Alias this is more then C++ multiple inheritance. And it can have semantic, different with C++ multiple inheritance. |
test/runnable/aliasthis.d
Outdated
f7d6a99 to
2e82d1a
Compare
|
@WalterBright @andralex |
|
ping |
|
Ping ? I need this. Please @andralex and @WalterBright either merge this or propose actionable items to make this move forward. Right now there is not much to do to have this move forward and that is a problem. |
|
@andralex AFAIR, you planned to merge this until Jul, 8. Four days remaining:) |
2e82d1a to
be75d6a
Compare
There was a problem hiding this comment.
Errors shouldn't have any capitals in the message, only symbol names have that privilege. ;)
|
I agree with @WalterBright and @andralex - there definitely appears to be too much going on, some of which looks like needless noise - such as moving entire functions from When looking around at some of the areas that need changing, I was rather taken aback by the spaghetti code used by the existing My feeling is that we must first untangle this unwieldy flow of code, only then will it become a "modest addition". |
|
@andralex Hello. I was out and will nd I will be absent for some time becauseI'm busy with graduate work at the university and is very busy at the job. I'll return to this work and other D works after a couple of months. Sorry. BTW, I have some ideas about this implementation. |
|
@yebblies @andralex |
|
@IgorStepanov Welcome back! There used to be a script for automatic conversion, but I can't find it anymore. There's also this page on the Wiki about porting PRs to the D version. I guess it's largely no longer relevant now (e.g. magicport.json is gone). As for which D constructs are allowed: |
|
Ok. AA may be usefull if it acceptable. |
|
The procedure in #4922 should work to convert this, once it's rebased onto the last C++ commit using the procedure from the wiki page. Phobos and the GC are currently being avoided, while some code has been refactored to use foreach. auto and scope delegates. I would advise doing a direct conversion before any refactoring. |
|
Thanks. Looks simpler that I expected. Will do it. |
|
How is this going? |
|
Any update on this? |
|
In the State of D survey, this was among the top five missed language features https://rawgit.com/wilzbach/state-of-d/master/report.html As this is still based on the C++ frontend, it might take a serious effort to revive it. |
|
This implementation by and large was rejected, as we think that multiple alias this shouldn't be a big change to add support for. Preliminary PRs may need to be made in order to make the existing alias this support grokable though. Which is probably why this ended up to unwieldy. |
|
Closing as #8378 superseded this PR. |

This PR introduces multiple alias this.
The old alias this implemenation doesn't imply alias this conflicts.
All alias this-es in old implementation are serializable: compiler successively applies a, a->aliasthis, a->aliasthis->aliasthis while right expression is not found.
This implementation allows tree of alias this subtypes.
Type can has a direct "alias this"-es and "alias this"-es, inherited from base classes/interfaces. Thus, there can be conflict between several matching "alias this"-es.
In common case compile should raise error if several "alias this"-es have found.
However, in the next situation conflict can be resolved:
When we try to cast
Test9to int we can find several variants:t9.a.a,t9.b.a,t9.c.However,
t9.cis preferred, becauseTest9author is explicitly pointed out thatTest9should be converted tointthroughcfield. This magic works only if we have exact match.short a = t9;causes error.This PR have a one limitation: it doesn't support multiple tuple alias this. It don't clearly understand how them should works. Multiple tuple alias this can be implemented in future in a separate PR.