digitalmars.D.learn - Should these aliases kind be illegal ?
- anonymous (21/21) Aug 12 2015 The following alias declaration is totally legal but actually
- Timon Gehr (14/35) Aug 12 2015 I believe it currently just does the same thing as:
The following alias declaration is totally legal but actually
it's not usable
---
class Foo
{
void something(size_t param){}
}
class Bar
{
private Foo foo;
this(){foo = new Foo;}
alias somethingelse = foo.something;
}
void main(string[] args)
{
auto bar = new Bar;
//bar.somethingelse(0u);
}
---
The call doesn't work but the declaration is fine. What is
possible to make with this declaration ?
Aug 12 2015
On 08/13/2015 12:17 AM, anonymous wrote:
The following alias declaration is totally legal but actually it's not
usable
---
class Foo
{
void something(size_t param){}
}
class Bar
{
private Foo foo;
this(){foo = new Foo;}
alias somethingelse = foo.something;
}
void main(string[] args)
{
auto bar = new Bar;
//bar.somethingelse(0u);
}
---
The call doesn't work but the declaration is fine. What is possible to
make with this declaration ?
I believe it currently just does the same thing as:
---
class Foo{
void something(size_t param){}
}
class Bar{
private Foo foo;
this(){foo = new Foo;}
alias somethingelse = typeof(foo).something;
}
---
But IMO the appropriate response here is to just make it work as one
would expect, not to make it illegal.
Aug 12 2015








Timon Gehr <timon.gehr gmx.ch>