digitalmars.D - Re: dst = src rather than src dst
- "Janice Caron" <caron serenityfirefly.com> Sep 06 2007
-----Original Message----- From: digitalmars-d-bounces puremagic.com [mailto:digitalmars-d-bounces puremagic.com] On Behalf Of Janice Caron Sent: 06 September 2007 13:37 To: D Subject: Re: dst = src rather than src dstIn reality, it's a type definition - the keyword typedef is closer in meaning to struct, class or enum (or in C++, namespace) than anything else. In fact, typedef B A; could reasonably be rewritten in D2.0+ as struct A { B b; alias b this; }
For that matter, if struct inheritance syntax is ever allowed, typedef B A; could be rewritten as struct A : B {} which really makes it really, really clear that "typedef" is not a declaration. Come to think of it, "typedef" is short for TYPE DEFinition, so it's very /name/ tells you it's a definition, not a declaration. Of course, that struct trick won't work for alias. Also, let's not forget that alias has many other uses beyond replacing C's typedef. Those other uses more than justify having a different syntax. There is no logic in saying that alias long_and_complicated.name.For!(Something) i; needs to be that way round, purely because of how typedef evolved in C.
Sep 06 2007