alias two froms

Nick Treleaven via Digitalmars-d digitalmars-d at puremagic.com
Fri Sep 12 04:50:35 PDT 2014


On 12/09/2014 07:48, eles wrote:
> On Thursday, 11 September 2014 at 23:05:19 UTC, Ali Çehreli wrote:
>> On 09/11/2014 12:08 PM, eles wrote:
>
>> The 'alias this = A' syntax did appear for one release as an
>> unintentional feature:
>
> Having two syntaxes for alias makes everything looking worse and is an
> unnecessary noise.

'alias this' is different from normal aliasing. The 'alias ... this' 
syntax should be replaced, but we haven't agreed on by what. I think 
Timon Gehr's opThis solution is best:

http://forum.dlang.org/thread/xjevtasyafnkvusprldp@forum.dlang.org?page=2#post-ld5c9r:2418lt:241:40digitalmars.com

Using the opThis identifier (or similar) avoids having to introduce a 
separate 'get' property function when you need to add const qualifiers 
to the forwarded symbol, or do some processing first.

P.S. As I noted in that thread, the suggested syntax for forwarding 
constructors is not so ambiguous, it should be:

class D : C {
     alias this = super.this;	// note .this to name base ctor
}


More information about the Digitalmars-d mailing list