Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kill the syntax alias this = sym; #1413

Merged
merged 1 commit into from Feb 9, 2013
Merged

Kill the syntax alias this = sym; #1413

merged 1 commit into from Feb 9, 2013

Conversation

9rnsr
Copy link
Contributor

@9rnsr 9rnsr commented Dec 27, 2012

In the pull dlang/dlang.org#200, we discussed to replace the syntax alias this = sym;, which introduced by the pull #1187.

To keep the discussion continuable, we should not contain the syntax in 2.061 release.
(As far as I know, it is not deeply discussed in @1187.)

@WalterBright , please merge this in 2.061 release.

@9rnsr
Copy link
Contributor Author

9rnsr commented Dec 28, 2012

I fixed the failure which appears in auto-tester result.

@9rnsr
Copy link
Contributor Author

9rnsr commented Dec 29, 2012

To @WalterBright and @andralex
I think this is an emergency pull. We need to decide that the alias this syntax alias this = ident;should be released in 2.061 or not. I think it shouldn't.
Please comment here.

@andralex
Copy link
Member

I personally think alias this = ident; should be allowed lest we need to explain everybody that it's not allowed. I understand it encodes a different notion than other uses of alias, so I don't feel strongly about this. Leaving it to @WalterBright.

@9rnsr
Copy link
Contributor Author

9rnsr commented Dec 29, 2012

In the spec discussion, @ntrel pointed out about a syntax for super class constructor aliasing.

alias this = super.this;

I had no thought about it, but I don't want to kill the possibility of forgive such syntax.

@andralex
Copy link
Member

One thought - it would be pretty odd if we allowed both alias x this and alias this = super.this with completely different meanings.

@9rnsr
Copy link
Contributor Author

9rnsr commented Dec 29, 2012

I think alias this feature is completely different concept with normal aliasing. (They are only just share the keyword alias.) Therefore it is not so weird, at least to me.

alias ident = sym; <--> alias sym ident;
alias this : ident; <--> alias ident this; (A new syntax I recommended)
alias this = super.this; <--> nothing

@9rnsr
Copy link
Contributor Author

9rnsr commented Dec 29, 2012

I opened documentation fix related to this.
dlang/dlang.org#224

@ntrel
Copy link
Contributor

ntrel commented Dec 30, 2012

andralex:

it would be pretty odd if we allowed both alias x this and alias this = super.this with completely different meanings

True, but isn't that a short term issue? alias x this would become the 'old' syntax. If we adopted alias this : x syntax, and someone attempted to use alias this = x we could have a compile error "x is not a constructor". The error message could even remind the user of the correct alias this : x syntax.

But if we stay with the current master, is there a way to allow superclass constructor aliasing (assuming that's a sensible feature)? It would be nice to have. Would a template solution be as robust as aliasing regarding corner cases?

I would vote for alias this : x syntax. (BTW thanks for all your work on this @9rnsr ;-)).

@andralex
Copy link
Member

Bottom line I'm leaving this decision to @9rnsr and @WalterBright. All I'm saying is that this is in the syntax already which makes it distinguished seeing as this is a keyword. Making syntax even more subtly different e.g. by replacing = with : etc. seems gratuitous to me as we'll always have to explain it to people.

@alexrp
Copy link
Member

alexrp commented Feb 1, 2013

ping

@ghost
Copy link

ghost commented Feb 8, 2013

Unfortunately I think it might be too late for this. I've seen several examples of people already using this syntax in their code. It's very likely the pull would break code now.

@9rnsr
Copy link
Contributor Author

9rnsr commented Feb 9, 2013

NO. One month, one release is not too late. This syntax was not deeply discussed in forum. There was just only little discussion on the github pull request. It was MY WORST mistake in 2.061 development. WE MUST RESET things.

@andralex Please, PLEASE reconsider. alias this and type/symbol aliasing are completely different things. YET they should not have same syntax. (Yes, IF a forum discussion will really approval this syntax, I can agree re-adding this syntax. But it is YET NOT done.)

@andralex
Copy link
Member

andralex commented Feb 9, 2013

@9rsr if you feel so strongly about it no problem from me. @WalterBright?

@9rnsr
Copy link
Contributor Author

9rnsr commented Feb 9, 2013

Thanks, @andralex !!
@WalterBright Could you please consider this?

@ghost
Copy link

ghost commented Feb 9, 2013

The real issue is that @WalterBright completely ignored the messages in this pull and went ahead with a release.

@braddr
Copy link
Member

braddr commented Feb 9, 2013

It'd do this community a lot of good if people would stop assuming malice when simple unawareness is far more likely. If there's issues that should block releases, those that are aware of the blockers really need to raise them. Don't assume that every pull request and every thread is read by those that need to see them.

@ghost
Copy link

ghost commented Feb 9, 2013

Not malice, but simply lack of good decision making. Releasing the compiler at January 1st and giving out the beta in the last weeks before new years eve was a bad idea, there was barely anyone around to test the betas.

@ghost
Copy link

ghost commented Feb 9, 2013

It would also do this community a lot of good if we actually had a schedule for the releases, rather than randomly deciding when it's a good idea to start releasing the beta's, and waiting for Walter to randomly pick when the final version is released.

@WalterBright
Copy link
Member

I proposed entering the beta cycle on the beta mailing list on 2/1. I presume those who care about such things will be subscribed to that list.

@WalterBright
Copy link
Member

@9rnsr I agree with removing the syntax for the time being.

WalterBright added a commit that referenced this pull request Feb 9, 2013
Kill the syntax `alias this = sym`;
@WalterBright WalterBright merged commit b58ef83 into dlang:master Feb 9, 2013
WalterBright added a commit to WalterBright/dmd that referenced this pull request Feb 10, 2013
yebblies added a commit that referenced this pull request Feb 10, 2013
Merge pull request #1413 from 9rnsr/x3011
@9rnsr
Copy link
Contributor Author

9rnsr commented Feb 10, 2013

Thanks!!

9rnsr pushed a commit to 9rnsr/dmd that referenced this pull request Feb 11, 2013
Kill the syntax `alias this = sym`;
@MartinNowak
Copy link
Member

Any progress on alias this = something;.
Now we have to explain this to everyone and at least I am often mistyping it.

I don't think that alias this = super.this; would conflict with the other alias this = ident; meaning because it doesn't make sense to alias-this a class to the constructor of it's base class. It's also the normal function overload syntax and the super is easy to distinguish.

@ntrel
Copy link
Contributor

ntrel commented Oct 31, 2014

I don't think that alias this = super.this; would conflict with the other alias this = ident;

True, it wouldn't conflict, but if super is replaced with some long type expression, the trailing .this might be off-screen, so it's not ideal. It's better to have separate alias this : ident syntax, but really we should just resolve the syntax one way or another and move on.

@MartinNowak
Copy link
Member

True, it wouldn't conflict, but if super is replaced with some long type expression, the trailing .this might be off-screen, so it's not ideal.

What's the use-case for the long type expression? With what would you overload a constructor but a base class constructor? To me it looks like alias this = super.this is the only exception needed (for something that isn't even possible right now Issue 9066).
Also alias super.this this would conflict in the same way so that argument isn't too good.

dkorpel pushed a commit to pbackus/dmd that referenced this pull request May 10, 2023
When assignment-style syntax for alias declarations was first
implemented in DMD 2.061 [1][2], `alias this = identifier;` was accepted
as equivalent to the existing `alias identifier this;`. One release
later, in DMD 2.062, it was removed. [3]

The rationale for this change, given in both the changelog [4] and a
related spec PR thread [5], was to allow for the possibility that, in
the future, the syntax `alias this = super.this;` might be used to merge
a derived class's constructor overload set with that of its base class.
However, this proposal was never implemented, and seems to have been
abandoned in the intervening years.

For the sake of consistency, and since the rationale for its removal no
longer applies, this commit reinstates `alias this = identifier;` as
valid syntax for an `alias this` declaration.

[1] dlang#1187
[2] https://dlang.org/changelog/2.061.html
[3] dlang#1413
[4] https://dlang.org/changelog/2.062.html
[5] dlang/dlang.org#200 (comment)
kinke pushed a commit to ldc-developers/ldc that referenced this pull request Jun 7, 2023
When assignment-style syntax for alias declarations was first
implemented in DMD 2.061 [1][2], `alias this = identifier;` was accepted
as equivalent to the existing `alias identifier this;`. One release
later, in DMD 2.062, it was removed. [3]

The rationale for this change, given in both the changelog [4] and a
related spec PR thread [5], was to allow for the possibility that, in
the future, the syntax `alias this = super.this;` might be used to merge
a derived class's constructor overload set with that of its base class.
However, this proposal was never implemented, and seems to have been
abandoned in the intervening years.

For the sake of consistency, and since the rationale for its removal no
longer applies, this commit reinstates `alias this = identifier;` as
valid syntax for an `alias this` declaration.

[1] dlang/dmd#1187
[2] https://dlang.org/changelog/2.061.html
[3] dlang/dmd#1413
[4] https://dlang.org/changelog/2.062.html
[5] dlang/dlang.org#200 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants