Re: class interface of roles

HaloO,

Jonathan Lang wrote:
So if I'm reading this right, a class that does both A and B should be
"lower" in the partial ordering than a class that does just one or the
other.  And if A does B, then you'll never have a class that does just
A without also doing B, which trims out a few possible nodes and paths
from the lattice for practical purposes:

Any={}
|  \
|   \
|    \
|     \
|      \
B={y}  C={z}
/ \      |
/   \     |
/     \    |
/       \   |
/         \  |
/           \ |
A|B={x,y}           B|C={y,z}
\             /
\           /
\         /
\       /
\     /
A|B|C={x,y,z}

Correct. The lattice is a structural analysis of the roles.

I note that while the lattice is related to whatever role hierarchies
may or may not exist, it is not the same as them.  In particular,
roles that have no hierarchal relationship to each other _will_ exist
in the same lattice.  In fact, all roles will exist in the same
lattice, on the first row under "Any".  Right?

Yes, if they are disjoined structurally. Otherwise intersection roles
appear as nodes under Any.

Or does the fact that
"A does B" mean that A would be placed where "A|B" is, and "A|C" would
end up in the same node as "A|B|C"?

To get at the node labeled A|B above you either need a definition

role A does B { has \$.x }

or an outright full definition

role A { has \$.x; has \$.y }

So, yes the node should be called A and A|C coincides with A|B|C.

I'm not sure if this ordering of roles can be called duck typing
because it would put roles that have the same content into the
same lattice node. The well known bark method of Dog and Tree
comes to mind. But the arrow types of the methods will be different.
One has type :(Dog --> Dog) the other :(Tree --> Tree) and a joined
node will have type :(Dog&Tree --> Dog|Tree). This might just give
enough information to resolve the issues surrounding the DogTree
class.

By "most specific", you'd mean "closest to the top"?

No, closer to the bottom. The join operator | of the lattice produces
subtypes with a larger interface that is more specific. It's like
the more derived class in a class hierarchy.

Regards, TSa.
--