Thread overview
[Issue 9569] New: 'alias this' syntax is not accepted by dmd
Feb 22, 2013
Ali Cehreli
Feb 22, 2013
Andrej Mitrovic
Feb 22, 2013
Andrej Mitrovic
Feb 22, 2013
Andrej Mitrovic
Feb 23, 2013
Michael
February 22, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9569

           Summary: 'alias this' syntax is not accepted by dmd
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: acehreli@yahoo.com


--- Comment #0 from Ali Cehreli <acehreli@yahoo.com> 2013-02-22 09:25:51 PST ---
struct Test
{
    int i;
    alias this = i;    // <-- Compilation error
}

void main()
{}

The compiler says:

deneme.d(121089): Error: no identifier for declarator this
deneme.d(121089): Error: alias cannot have initializer

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 22, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9569


bearophile_hugs@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs@eml.cc


--- Comment #1 from bearophile_hugs@eml.cc 2013-02-22 09:36:44 PST ---
This is working as designed, and probably should be closed.

See also:

http://forum.dlang.org/thread/evldispcxhyarckmkycg@forum.dlang.org

https://github.com/D-Programming-Language/dmd/issues/1413

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 22, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9569


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, spec
                 CC|                            |andrej.mitrovich@gmail.com


--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-02-22 09:58:26 PST ---
This is a spec issue covered with http://d.puremagic.com/issues/show_bug.cgi?id=9569

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 22, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9569



--- Comment #3 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-02-22 10:06:44 PST ---
(In reply to comment #2)
> This is a spec issue covered with http://d.puremagic.com/issues/show_bug.cgi?id=9569

https://github.com/D-Programming-Language/d-programming-language.org/pull/284

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 22, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9569


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|regression                  |normal


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 23, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9569


Michael <pr@m1xa.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pr@m1xa.com


--- Comment #4 from Michael <pr@m1xa.com> 2013-02-23 14:00:38 PST ---
We have a one alias beast, so  now will have two beast... after month three beast ... (period) ... nth beast.

Bad idea.

Alias this used like class inheritance is bad idea too, because it's not a class inheritance.

One syntax, one alias beast - it's good.

About multiple alias this:

alias this = ...;
alias this = ...;
...
alias this = ...;

It's good because many uses of alias this is not desirable (although allowed) and people will think twice to use this feature.

And I think it's more demonstrable when I want to show what I was mean when put it (alias this) into source code.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------