From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: Generics question
Date: 1997/07/23
Date: 1997-07-23T00:00:00+00:00 [thread overview]
Message-ID: <dewar.869633163@merv> (raw)
In-Reply-To: 5r37k9$h4p$1@kelp.mbay.net
Skip Carter says
<< I have a computational algorithm that I've implemented that has
the (admitedly unusual) property that it is perfectly valid for either
arrays of Integers or arrays of Floats. As far as I can see I
CANNOT make a generic version of the package that will work for
both, e.g.:
Generic
Type Element is <something meaning INTEGER or FLOAT subtypes>
Type DataArray is Array(Natural Range<>) of Element;
>>
No problem, just make the generic formal type private, and then require
the user (by default if convenient) to pass in the set of operators you
require, i.e. put statements like
with "+"(L,R : Element) return Element
That will work fine.
next prev parent reply other threads:[~1997-07-23 0:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-07-22 0:00 Generics question Skip Carter
1997-07-22 0:00 ` W. Wesley Groleau x4923
1997-07-23 0:00 ` Robert Dewar [this message]
1997-07-23 0:00 ` Brian Rogoff
1997-07-24 0:00 ` Michael F Brenner
1997-07-24 0:00 ` Jon S Anthony
1997-07-24 0:00 ` Brian Rogoff
-- strict thread matches above, loose matches on Subject: below --
1989-09-19 23:03 Generics Question Jay Labhart
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox