On Mar 17, 3:03 pm, "Randy Brukardt" <ra...@[EMAIL PROTECTED]
> wrote:
> In cases like these, you have to pass accessor routines explicitly.
Yeah, I figured that out this morning. I should know better to post
at the end of the day before I've slept on it.
> It gives a
> default for the subprograms [...] (Why you can't have such defaults for
types
> is unknown by me...)
Yeah, we just had that discussion two weeks ago.
> I would prefer to use an interface or tagged type here, but obviously
you
> can't do that. This is not a perfect solution, but it works and is
commonly
> used.
Notationally, it would be better, sure. The problem, as you
acknowledge, is that it's a bad idea for a system library to require
any particular inheritance in order to work. Working on this little
project has given substance to an idea I've had for a while about non-
inheritance type relation****ps. In brief, it's to give a name to the
set of types that satisfy a certain set of signatures that,
critically, need _not_ be sufficient to form an abstract type. This
specification constitutes a partial type. To pick a simple example,
the set of trichotomous types is that which have a total ordering that
satisfy the standard trichotomy axioms (\forall a,b : a < b \land b <
a \implies a = b). Trichotomy is a partial type. It's a natural
parameter for generic ordered containers.
Indeed, partial types are the natural kind of formal type parameter
for any generic. Right now in Ada they have to be simulated by
passing some set of formal parameters. The spirit of Ada would be
better served by giving them an explicit representation.
Eric


|