From: Anthony Jenkins <abjenkins@mindspring.com>
Subject: Re: Runtime object type determination/ runtime generic instantiation
Date: 1997/11/10
Date: 1997-11-10T09:16:22+00:00 [thread overview]
Message-ID: <3466D097.2B505E32@mindspring.com> (raw)
In-Reply-To: ufaffegbg9.fsf@synquiry.com
Jon S Anthony wrote:
>
> Anthony Jenkins <abjenkins@mindspring.com> writes:
>
> > The package I have to create is one for (un)directed graphs, where the
> > vertices can represent numbers, characters or strings (I'm thinking more
> > generically than these 3 types so I can possibly use it later) where the
> > node value type is given in a file. Am I looking at this wrong? I'm
>
> It _seems_ like you certainly are looking at it "wrong". Since you
> are already dealing with a higher level structure (the nodes), why
> don't you create a hierarchy of these? Which would also be
> incrementally extensible, dynamically dispatchable, etc. Here's a
> basic hack:
>
> type Node_Type is abstract tagged private;
> -- or better yet, limited private
>
> -- all the basic operations. Could be abstract as well or a mix.
>
> ...
>
> type Number_Node_Type is abstract new Node_Type;
>
> ... all the common number operations...
> ...
> type Real_Number_Node_Type is new Number_Node_Type with private;
> ...
> type Integer_Number_Node_Type is new Number_Node_Type with private;
>
> -- or you can flip these around and derive one from the other
> -- depending on your point of view.
> ...
> -- For example, here's a similar situation where strings
> -- come from characters...
> --
> type Character_Node_Type is new Node_Type with private;
> ...
> type String_Node_Type is new Character_Node_Type with private;
>
> and so on ...
>
> /Jon
>
Thanks! That *does* make a lot more sense... I wasn't thinking OO
enough.
Anthony Jenkins
http://www.auburn.edu/~jenkian
abjenkins @ mindspring , com (Death to spammers)
-------------
"God is as real as I am," the old man replied. My faith was
restored, for I knew Santa would never lie.
prev parent reply other threads:[~1997-11-10 0:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-11-06 0:00 Runtime object type determination/ runtime generic instantiation Anthony Jenkins
1997-11-08 0:00 ` Jon S Anthony
1997-11-10 0:00 ` Anthony Jenkins [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox