comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@acm.org
Subject: Re: Generics???
Date: Tue, 03 Jul 2001 19:09:45 GMT
Date: 2001-07-03T19:09:45+00:00	[thread overview]
Message-ID: <ZLo07.148917$%i7.100501697@news1.rdc1.sfba.home.com> (raw)
In-Reply-To: Yah07.80$Qb2.6962@read2.inet.fi

>Suppose I use the example provided by Frank Beard and want to round up the
>result when the type is an integer.
>How do I test which type the parameter (in the example: Item) is?
>Something like the pseudocode:
>
>   function Divide (the_Left  : Item;
>                    the_Right : Item) return Item is
  If you are passing in the operations as generic parameters, you will
have passed in a "/", either an integer one that does rounding, or a
floating point one that doesn't.  If you want a special "rounded_divide"
operation, you'll pass one in and the floating point one will not
actually do any rounding.
  If someone calls your package asking for integer arithmetic, doesn't
that indicate they don't care too much about accuracy in things like
a divide, anyway?



  parent reply	other threads:[~2001-07-03 19:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-02 18:42 Generics??? Beard, Frank
2001-07-03 10:32 ` Generics??? Anders Wirzenius
2001-07-03 17:31   ` Generics??? Stephen Leake
2001-07-03 19:09   ` tmoran [this message]
2001-07-04  5:30     ` Generics??? Anders Wirzenius
  -- strict thread matches above, loose matches on Subject: below --
2001-07-02 22:33 Generics??? Michael Andersson
2001-07-02 17:48 ` Generics??? James Rogers
2001-07-02 18:54   ` Generics??? Ehud Lamm
1992-09-14 15:00 Generics? cis.ohio-state.edu!zaphod.mps.ohio-state.edu!darwin.sura.net!jvnc.net!net
1992-09-09  5:26 Generics? Andrew Dunstan
1992-09-09  1:34 Generics?  Rob Allen
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox