Alias syntax removal
kenji hara
k.hara.pg at gmail.com
Sun Feb 10 06:42:39 PST 2013
2013/2/10 kenji hara <k.hara.pg at gmail.com>
>
> I opened the pull request #1413 in the beta term for 2.061, but it had
> _accidentally_ released without deeply discussion.
> https://github.com/D-Programming-Language/dmd/pull/1413
>
> I think and believe that we MUST reset things.
>
Why I argue that the syntax `alias this = sym;` is wrong? Because:
1. A normal alias declaration (creating aliased name for existing symbol)
and alias this feature
(making a *subtyped* struct through implicit access to its field) are
entirely different and has distinct semantics.
They merely share a keyword 'alias'.
2. Instead, we can have much more consistent, useful, and scalable syntax.
At the same time, I proposed a new syntax `alias this : ident;` for alias
this feature.
https://github.com/D-Programming-Language/d-programming-language.org/pull/200
struct S {
int value;
alias this : value; // proposed syntax
}
Benefits of the proposed syntax are:
2a. It is consistent with class inheritance syntax `class C : B {}`.
2b. It is scalable for multiple alias this feature, as like `alias this
: sym1, sym2, ...;` .
If D community highly require the syntax `alias this = sym`, I'll agree to
adding it again.
But for that, we should discuss about its cost and benefit.
Sorry for my poor writing.
Regards.
Kenji Hara
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130210/f60e008d/attachment.html>
More information about the Digitalmars-d
mailing list