typedef redux

Justin Johansson no at spam.com
Thu Nov 12 11:45:55 PST 2009


Andrei Alexandrescu Wrote:

> Sean Kelly wrote:
> > 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.
> >> 
> >> Does all that sound good?
> > 
> > I like that typedef purports to offer an inheritance model of sorts
> > to concrete types.  Aliasing is all well and good, but it isn't
> > always appropriate.  But I really haven't spent much time with
> > typedef recently.  From what I've read, it sounds like the
> > implementation doesn't live up to the promise.  Is this true?
> 
> The current implementation is just broken because there was no 
> definition of the feature. It just does the moral equivalent of what an 
> unintended switch fall-through does :o).
> 
> One basic problem was that Walter and I couldn't even make a water-tight 
> case of which direction the inheritance should go: I thought typedef 
> should introduce a subtype, and he thought it should introduce a 
> supertype. We both had examples. We both saw the other's argument. We 
> both realized the shortcomings of the feature, regardless of whatever 
> direction we chose. We both saw the costs in the implementation and in 
> the language definition, and we realized the paucity of benefits.
> 
> So there's not only an implementation that doesn't live up to the 
> promise, we even don't have a reasonable promise to fulfill.

"One basic problem was that Walter and I couldn't even make a water-tight 
case of which direction the inheritance should go: I thought typedef"

I remember the discussion ... and if two intelligent folks in language
design can't agree on "inheritance direction" ... and given the paucity of benefits ... 
there is only one reasonable promise to fulfill ...

                                D. typedef

                               2006 - 2009

                                     RIP






More information about the Digitalmars-d mailing list