What happened to the alias this = identifier syntax in 2.062?
Joshua Niehus
jm.niehus at gmail.com
Fri Feb 22 15:45:52 PST 2013
On Friday, 22 February 2013 at 23:20:55 UTC, Timon Gehr wrote:
>
> auto opPseudonym() { ... }
>
> alias opPseudonym=foo;
Isn't that creating multiple functions for the same thing?
<shamelessly copies Ali's example>
struct Fraction
{
long numerator;
long denominator;
double value() const @property
{
return cast(double)numerator / denominator;
}
alias this = value;
}
as opposed to:
struct Fraction
{
long numerator;
long denominator;
double value() const @property
{
return cast(double)numerator / denominator;
}
@pseudonym value;
// in the year 2000...
@pseudonym value, value2, value3;
}
More information about the Digitalmars-d
mailing list