[plt-dev] Inexact integers

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Sat May 22 08:56:04 EDT 2010

On Fri, May 21, 2010 at 9:32 PM, David Van Horn <dvanhorn at ccs.neu.edu> wrote:
> I talked with the PLTers who attended TFP and it was agreed that inexact
> integers, a holdover from Scheme standards, are counter intuitive.  I wonder
> if it is worth doing away with them in Racket?

Maybe in a later release. But the design of the number hierarchy is
complex so if we were to contemplate such a thing, the proposal would
probably have to be more concrete. (After all, we dno't want to do
away with something float-like completely, for performance reasons.)

> They cause a mess with the types in Typed Scheme (IME) and lead to bugs in
> contracts and code.  For example, the contract on `text' in 2htdp/image says
> the font size argument is an `integer?', but really it should be
> `exact-integer?'.  For example:
>
>   #lang racket
>   (require 2htdp/image)
>   (text "hi" 12.0 'black)
>
> This gives:
>
> find-or-create-font in font-list% (family id case): expected argument of
> type <exact integer in [1, 255]>; given 12.0

This is fixed (not yet pushed).

Anyone know if this holds for all x (where => is implication)?

  (=> (integer? x) (integer? (inexact->exact x)))

Robby


Posted on the dev mailing list.