digitalmars.D - alias two froms
- eles (8/8) Sep 11 2014 See this:
- Peter Alexander (7/15) Sep 11 2014 This was discussed recently.
- ketmar via Digitalmars-d (3/5) Sep 11 2014 so people can write even more old-styled code...
- eles (8/11) Sep 11 2014 Breaking? :-o Why?
- Mike (23/28) Sep 11 2014 If the desire is to deprecate something in the language, it is
- Brian Schott (7/8) Sep 11 2014 I tried to get people to agree to deprecate an old syntax that
- Mike (7/15) Sep 11 2014 I share your frustration.
- Brian Schott (7/11) Sep 11 2014 dfix will remain unwritten until Walter is willing to make the
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (6/14) Sep 11 2014 The 'alias this = A' syntax did appear for one release as an
- eles (7/10) Sep 11 2014 Having two syntaxes for alias makes everything looking worse and
- Nick Treleaven (13/19) Sep 12 2014 'alias this' is different from normal aliasing. The 'alias ... this'
See this: http://forum.dlang.org/post/kfdkkwikrfvaukhctrmq forum.dlang.org "alias" supports two syntaxes, one of them specifically to address writing things like alias A this. That's inconsistent. I agree not the most urgent thing in the world, but while the fixing things happens (see the property), why not address this too? So? Deprecate the old syntax?
Sep 11 2014
On Thursday, 11 September 2014 at 19:08:27 UTC, eles wrote:See this: http://forum.dlang.org/post/kfdkkwikrfvaukhctrmq forum.dlang.org "alias" supports two syntaxes, one of them specifically to address writing things like alias A this. That's inconsistent. I agree not the most urgent thing in the world, but while the fixing things happens (see the property), why not address this too? So? Deprecate the old syntax?This was discussed recently. The problem is that the new syntax is only a few versions old, so deprecating the old syntax means breaking all D code that's more than a year old. If D had no existing customers then yeah, we'd remove it, but I think it's too early to start deprecation.
Sep 11 2014
On Thu, 11 Sep 2014 20:06:15 +0000 Peter Alexander via Digitalmars-d <digitalmars-d puremagic.com> wrote:If D had no existing customers then yeah, we'd remove it, but I=20 think it's too early to start deprecation.so people can write even more old-styled code...
Sep 11 2014
On Thursday, 11 September 2014 at 20:06:17 UTC, Peter Alexander wrote:On Thursday, 11 September 2014 at 19:08:27 UTC, eles wrote:See this:so deprecating the old syntax means breaking all D code that'sBreaking? :-o Why? IIRC, D uses as first stage a strange "scheduled for deprecation" that won't break anything, except will print a warning. And, when would you plan to start deprecation? Next year? After the GC is precised? Why keep things in limbo for so long? I see no practical reasons to mark them as "scheduled for deprecation".
Sep 11 2014
On Thursday, 11 September 2014 at 20:06:17 UTC, Peter Alexander wrote:The problem is that the new syntax is only a few versions old, so deprecating the old syntax means breaking all D code that's more than a year old. If D had no existing customers then yeah, we'd remove it, but I think it's too early to start deprecation.If the desire is to deprecate something in the language, it is best to start early to prevent the problem from getting worse. I believe this could be done gradually with little, or no disruption. 1. Create a dfix utility to automate updating the alias syntax, 2. Update documentation to fix all examples using the old syntax 3. Update documentation stating that while both syntaxes are allowed the latter is preferred 4. Using the dfix utility, update phobos, druntime, and potentially other projects in the D ecosystem 5. Give users a few versions to let it sink in 6. Mark old syntax as deprecated so users get a warning 7. Give users a few versions to adjust 8. Finally deprecate old syntax This recipe could potentially be used to fix many annoyances in the language besides the one that started this thread. But it first requires someone (like me) to first create the dfix utility. The existence of such a tool could potentially change D's culture as well. Automating the upgrade of the alias syntax would set an important precedent. Mike
Sep 11 2014
On Thursday, 11 September 2014 at 19:08:27 UTC, eles wrote:So? Deprecate the old syntax?I tried to get people to agree to deprecate an old syntax that was worse. I also wrote an automated upgrade tool that would fix people's code. I couldn't get it approved. As far as I can tell, the official position is that parser bugs and language inconsistencies are permanent.
Sep 11 2014
On Thursday, 11 September 2014 at 20:14:47 UTC, Brian Schott wrote:On Thursday, 11 September 2014 at 19:08:27 UTC, eles wrote:I share your frustration. I saw your code to automate a fix in support of DIP65, but I haven't seen any code to automate updating the alias syntax. If you have this on hand would be willing to share it? MikeSo? Deprecate the old syntax?I tried to get people to agree to deprecate an old syntax that was worse. I also wrote an automated upgrade tool that would fix people's code. I couldn't get it approved. As far as I can tell, the official position is that parser bugs and language inconsistencies are permanent.
Sep 11 2014
On Thursday, 11 September 2014 at 22:54:49 UTC, Mike wrote:I saw your code to automate a fix in support of DIP65, but I haven't seen any code to automate updating the alias syntax. If you have this on hand would be willing to share it? Mikedfix will remain unwritten until Walter is willing to make the decisions that would require it. I have several other things to work on in my spare time, and those other things will actually be used. In the meantime you can use D-Scanner to find instances of old alias declarations (and other things) in your code.
Sep 11 2014
On 09/11/2014 12:08 PM, eles wrote:See this: http://forum.dlang.org/post/kfdkkwikrfvaukhctrmq forum.dlang.org "alias" supports two syntaxes, one of them specifically to address writing things like alias A this. That's inconsistent. I agree not the most urgent thing in the world, but while the fixing things happens (see the property), why not address this too? So? Deprecate the old syntax?The 'alias this = A' syntax did appear for one release as an unintentional feature: http://forum.dlang.org/thread/aaflopktcjmljxdnoizj forum.dlang.org#post-aaflopktcjmljxdnoizj:40forum.dlang.org Ali
Sep 11 2014
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. I would rather go with something like: alias alpha~=beta; if I would need multiple aliases (see alpha as a list of aliased types).
Sep 11 2014
On 12/09/2014 07:48, eles wrote:On Thursday, 11 September 2014 at 23:05:19 UTC, Ali Çehreli wrote:'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 }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.
Sep 12 2014