www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9569] New: 'alias this' syntax is not accepted by dmd

reply d-bugmail puremagic.com writes:
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



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: -------
Feb 22 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9569


bearophile_hugs eml.cc changed:

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



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: -------
Feb 22 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
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



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: -------
Feb 22 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9569




10:06:44 PST ---

 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: -------
Feb 22 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
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: -------
Feb 22 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9569


Michael <pr m1xa.com> changed:

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



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: -------
Feb 23 2013