From: eachus@mitre-bedford.arpa (Robert I. Eachus)
Subject: Re: What's the difference between...
Date: 16 Feb 93 15:03:55 GMT [thread overview]
Message-ID: <EACHUS.93Feb16100355@goldfinger.mitre.org> (raw)
In article <75650@cup.portal.com> R_Tim_Coslet@cup.portal.com writes:
> Well, if you REALLY want this level of control, creat a package with all
> your types in it and make them PRIVATE and only define the operations
> that are actually physically correct. Then the compiler catches everything
> at compile time.
Actually, for this example the best choice is to use a fixed point
type for Apples. The only predefined multiply and divide operations
you get (that don't require conversions) are for multplication and
division by integers:
type Apples is delta 1.0 range 0.0..2.0**31;
-- Use a smaller delta if you need to slice apples.
subtype Crates is Integer range 0.0..Integer'LAST;
-- Could use a type and define * and / for Apples, but then 2 *
-- Apples would be ambiguous.
A,T: Apples;
C: Crates;
begin
T := A * C; -- OK;
T := A * A; -- wrong.
..
--
Robert I. Eachus
with Standard_Disclaimer;
use Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...
next reply other threads:[~1993-02-16 15:03 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
1993-02-16 15:03 Robert I. Eachus [this message]
-- strict thread matches above, loose matches on Subject: below --
1993-02-16 17:34 What's the difference between John Bollenbacher
1993-02-16 16:17 enterpoop.mit.edu!ira.uka.de!scsing.switch.ch!sicsun!disuns2!lglsun!kipfe
1993-02-15 13:24 cis.ohio-state.edu!zaphod.mps.ohio-state.edu!darwin.sura.net!haven.umd.ed
1993-02-15 1:55 cis.ohio-state.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!portal!cup.portal
1993-02-14 19:55 Adam Beneschan
1993-02-14 3:08 agate!spool.mu.edu!sdd.hp.com!portal!cup.portal.com!R_Tim_Coslet
1993-02-13 19:18 agate!spool.mu.edu!hri.com!noc.near.net!inmet!spock!stt
1993-02-13 5:30 Alex Blakemore
1993-02-12 23:57 Mark A Biggar
1993-02-12 23:51 kronos.arc.nasa.gov!butch!LMSC5.IS.LMSC.LOCKHEED.COM!LJ10891
1993-02-12 22:58 Robert I. Eachus
1993-02-12 18:52 Kenneth Anderson
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox