[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Why would anyone want opacity?
From: "Guillermo J. Rozas" <gjr@martigny.ai.mit.edu>
Subject: Re: Why would anyone want opacity?
Date: Mon, 13 May 96 13:53:05 -0400
> | Date: Mon, 13 May 1996 12:22:29 -0400 (EDT)
> | From: david carlton <carlton@math.mit.edu>
> |
[ example of why one sometimes needs generic arithmetic deleted ]
>
[ another example of why one sometimes needs bignums deleted ]
Of course there are times when one needs such things. My objection is
to making generic numbers the *default*. Most of the numbers in my
programs are small integers, and I expect this to be true even in
heavy generic math packages. We can safely assume that loop indices,
array subscripts, etc., are not quaternions most of the time. And
most of the numbers (at least in my programs) are loop indices of some
sort.
If you really need to use a generic Number type it would be better to
define a signature for the corresponding algebraic structure (pun
intended) and abstract your code over this structure.
> One of the decisions in the design of ML that I have never figured out
> was the requirement that integer overflow raise an exception.
> This makes virtually every program dependent on the word size.
Well, you certainly put your finger on a weak spot here, but the same
spot is even weaker in current Scheme, because implementations are
only encouraged, but not required to provide bignums. Moreover, there
is no standard way of defending against overflow in Scheme right now,
so virtually every program potentially depends on word size and
implementation.
Moreover, the new standard basis for ML defined the structure Int32,
which provides 32-bit integers for those who need them.
-Matthias