On Monday, 24 April 2017 at 16:52:49 UTC, Carl Sturtivant wrote:
On Friday, 21 April 2017 at 14:55:31 UTC, Steven Schveighoffer
wrote:
I agree, I like how this solves the ambiguity problem nicely.
However, this disallows using introspection to declare
multiple alias this piecemeal. e.g.:
struct S(bool foo)
{
int x;
alias x this;
static if(foo)
{
string y;
alias y this;
}
}
One thing we can do also is just use declaration order to
prioritize which alias this to use.
Not necessary in this case:
struct S(bool foo)
{
int x;
static if(!foo)
{
alias x this;
}
else
{
string y;
alias x, y this;
}
}
It's easier to analyze if isn't distributed, i.e. if only one
location applies.
It's easier to analyze if AliasThis isn't distributed, i.e. if
only one location appears in a given instantiation.