On Fri, 18 Mar 2011 15:09:23 +0100, Nick Sabalausky <a@a.a> wrote:

"Bekenn" <leav...@alone.com> wrote in message
news:ilv2pd$1vkd$1...@digitalmars.com...
On 3/17/2011 2:36 PM, Andrei Alexandrescu wrote:

I'm with y'all too. Even Walter needs to stop and think for a second.
We're considering enabling

alias a = b;

as an equivalent for

alias b a;


Along similar lines (hoping this isn't too far off-topic), what's the
current plan for typedef?  I'm aware that it's deprecated (and for good
reason), but some of my reading suggests that there's a successor on the
horizon.

I was thinking of asking about that, too. Specifically, would it make sence
for "typedef b a;" (or "typedef a = b;") to be lowered to something like:

struct a
{
    b _tmp;
    alias _tmp this;
}

Hmm, then again, IIUC, that would allow 'a' to be implicity converted to 'b'
which would defeat half the point, so maybe not.

Yeah. Typedef is too blunt an instrument for our purposes. What we want is:

alias Subtype!int SubInt;
alias Supertype!int SupInt;
alias Standalone!int NaturalNumber;

Where the following work:

int a = SubInt(3);
SupInt b = 3;
NaturalNumber c = NaturalNumber(3);

and the following do not:

SubInt d = 3;
int e = SupInt(3);
NaturalNumber f = 3;
int g = NaturalNumber(3);

And of course:

alias Subtype!int SubInt2;
alias Supertype!int SupInt2;
alias Standalone!int NaturalNumber2;

Where these do not work:

SubInt2 h = SubInt(3);
SupInt2 i = SupInt(3);
NaturalNumber2 j = NaturalNumber(3);


--
Simen

Reply via email to