What happened to the alias this = identifier syntax in 2.062?

Timon Gehr timon.gehr at gmx.ch
Fri Feb 22 13:23:03 PST 2013


On 02/22/2013 07:30 PM, Marco Leise wrote:
> Am Fri, 22 Feb 2013 09:38:48 -0800
> schrieb Ali Çehreli <acehreli at yahoo.com>:
>
>> I appreciate everybody's contributions to D but that is not an
>> intention, that is a change to dmd that caused a regression. A syntax
>> that used to work in the previous version simply stopped working in
>> 2.062. That is the definition of a regression. Normally, regressions are
>> fixed as quickly as possible.
>>
>> I have a feeling that there must have been some newsgroup discussions as
>> well but unfortunately I must have been busy with other things at the
>> time. Not all of us read github.
>>
>> Ali
>
> No, this was not meant to be a feature. It slipped in and
> people started using it.  It's like being able to break "scope"
> parameters by storing aliases to what's inside of them.

It is nothing like that.

See https://github.com/D-Programming-Language/dmd/pull/1187/files#L0R2780

It is explicitly handled in the code. Looking at the code for two 
seconds reveals that this syntax is being added.

> If you rely on that now and it is fixed in a future version, it's not
> a regression.

Maybe it is not a regression. In any case it is a breaking language 
change. (also holds for the scope stuff; there is no spec for it.)

> That said I started using "alias this = ..." as well and was
> surprised it was removed, but noticed it in time as a DFeed
> line on IRC.
>

There is no justification for this.

I guess the main issue is that alias blah this; shouldn't have made it 
into the grammar in the first place. But this was obviously done in 
order to establish a broken analogy to the other uses of alias. Either 
alias this=blah; must be kept or the alias this syntax should be 
deprecated in favour of a specially named member function.


More information about the Digitalmars-d mailing list