[Types-sig] Why have two hierarchies? (*EUREKA!*)
Sun, 6 Dec 1998 04:02:37 -0500
[Just van Rossum]
> What is a DAG?
> Directed Acyclic Graph,
> Yeah right, like that would help a poor graphic designer <wink>.
The problem for you may be that DAG is a Swedish name, as in Dag Hjalmar
AgnÚ Carl Hammarskj÷ld, former secretary-general of the United Nations.
Which aren't so united after all, so they take turns blaming each other.
Like everyone blames Donald for the metaclass hook, but Donald doesn't blame
That's a graph! We're the nodes, and our pointing fingers of shame are
arrows connecting the nodes. Since our fingers have nails, they have
distinguished ends, which is good else we'd never be able to tell who we
were pointing *at*. And that makes it a directed graph. Without a
direction to the blame, all of Usenet would collapse! Which would make life
simpler, so people would rather work with undirected graphs when they can.
Here we can't, though -- someone must pay.
So, in technical language, a directed graph is a bunch of nannies wagging
their fingers at Donald and going "tsk, tsk". So long as Donald never
points back, a small flying ant following the trail of blame will eventually
come to a place it can sleep, most likely near Donald's nose. Much as Dag
Hammarskj÷ld now rests peacefully in death, to which node all life choices
eventually lead in their own directed-graph way.
But if Guido blames Donald and Donald blames Guido right back, that poor ant
will follow those fingers back & forth & back & forth, getting as tired as
any poor reader trying to get thru Dag Hammarskj÷ld's "Night Is Drawing
Nigh" -- which also never ends.
So if an immortal small flying ant never runs out of pointing fingers to
follow (ant brains aren't big enough to remember which fingers they've
already followed), that's called a cycle. Mostly because even if the ant
*had* a motorcycle with plenty of gas and euler, it *still* wouldn't find an
end to the blame. But if the blame always comes to an end, no matter which
pointing finger we start at or which path we follow, then the graph is
called acyclic. Meaning you always arrive at a dead end even without a
motorcycle. Things get a bit more complicated if the graph itself is
infinite, but that's an irrelevant distraction so good thing I didn't
Now don't go confusing acyclic with acyclovir! Acyclovir is a drug used
mainly to treat genital herpes infections, which, although surely related to
the type/class split, and despite that they too can be discreetly ignored on
a first date, are much easier to cure.
All right. Now you're thinking "OK, Uncle Timmy! I apologize for bringing
venereal diseases into this. But doesn't acyclic mean 'a cycle'?". No! It
actually means *without* a cycle (let alone an ic). Let's study this
illuminating quote from Dag Hammarskj÷ld: "Life yields only to the
conqueror. Never accept what can be gained by giving in. You will be
living off stolen goods, and your muscles will atrophy." See? He didn't
mean your muscles would get a trophy, he meant they would become so weak &
flabby they would not get a trophy. It's a quirk of English that even a
Swede once mastered, so a gawky Dutchman's younger psychotic brother should
be able to master it too. Not to be confused with an agawky Dutchman, which
Just is, meaning not the opposite of gawky but rather without gawkiness
(BTW, Guido isn't gawky at all! But let's pretend he is, in the interests
of effective pedagogy.).
We haven't even mentioned trolls or butter knives yet, let alone their
connections to saunas and lutefisk. But it may suffice to leave it at this:
all DAG means in this context is that if you follow the pointing finger of
class inheritance, then no matter which class you (or a small immortal
flying ant -- your choice) start at, or which path you follow, you'll never
come back to the class you started at. Or, IOW, you'll always reach a dead
end. Or, IOW, no class is its own anscestor or its own descendant. Or,
IOW, if X and Y are distinct classes, it's never the case that issubclass(X,
Y) and issubclass(Y, X) are both true.
Now about "delegation", that just means getting someone else to do your work
for you, but in an honest way, not in a way that would make anyone take away
your muscles' trophies. Like Sweden sent a delegation to the United Nations
to do their collective inter-nation-al negotiating for them. Or maybe it
was just to get that preachy Dag Hammarskj÷ld out of their country, but the
end result is the same either way: they sat on their butts while the
delegation did all the work.
Dag's all, folks!
fatigue-dulls-the-pain-but-awakes-enticing-thoughts-of-death-ly y'rs - dag