typedef redux

Ali Cehreli acehreli at yahoo.com
Thu Nov 12 11:09:40 PST 2009


Andrei Alexandrescu Wrote:

> My perception following the discussion around typedef is that we should 
> eliminate it. What we offer is "alias", which is a generalization of C's 
> "typedef", and the change of name is justified by the fact that "alias" 
> defines aliases for more entities than just types.

I've just started experimenting with typedef to see whether it would allow subtyping dchar.

I wanted to have a typedef'ed 'trchar' (Turkish character) that would use specialized functions for capitalization and sorting.

My short experimentation started promising. Although, I would love to say 'a'tr, or "abc"tr too, which may not exist in D2. (I think C++0x is bringing a similar feature.)

Is typedef good for what I've been trying to do without using a full-fledged class? Can I use alias?

It would be nice to be able to use the same syntax as dchar and dstring.

Ali




More information about the Digitalmars-d mailing list