> Ah, I get it. But why would you want that -- treating Foo and Baz as > synonymous? Shouldn't you always be using Baz instead of Foo, if you > really mean Baz and not Foo, and vice versa? Because later on, if you > changed it such that: > > class Foo is Bar; > typedef Baz is Bar is blarpy; > > Foo.isa("Baz") == FALSE; # BOOM! > > ...which would break anything that relied on the symmetry.
Ahh, but I think it is important. When programming in C++ I use typedefs all over the place for various reasons. A typedef is more than a class that behaves exactly the same... it's more of a pointer. To a data type. It allows you to do stuff like type-linked-lists ("typelists" Alexandrescu calls them), and without it, these things would actually be impossible. Of course, in the realm of Perl, things might not be so important. Because of Perl's power, typelists and their siblings aren't all that useful. You could, I imagine, get about the same effect with: my $Baz is constant = Bar is blarpy; With the psychological disadvantage of holding a type in a dollar-variable. [But then he remembers the := operator] class Baz := Bar is blarpy; I've seen the design team refer to things like this, so I think we've got it. Oh, on an off-topic note, "Modern C++ Design" is a super spiffy book. People who wonder what C++ has on Java haven't read this book :). Luke