typedef alternative

Jonathan M Davis jmdavisprog at gmail.com
Sat Aug 14 18:05:04 PDT 2010


Okay, I'm not familiar with what typedef is supposed to have done in D. I've 
only ever used alias. But what is wrong with

On Saturday 14 August 2010 17:47:44 Yao G. wrote:
> // This should be typedef, but as it's going to be deprecated...
> alias Foo Year;
> alias Foo Month;
> alias Foo Day;

Is it because Year, Month, Day, and Foo are still completely interchangeable, 
and you should be able to do things like pass a Year to function that takes a 
Month? Are you looking to create a new type that while technically identical to 
another type is not considered the same as that type by the type system?

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list