[plt-dev] Inexact integers

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Tue May 25 10:48:46 EDT 2010

On Tue, May 25, 2010 at 6:49 AM, Shriram Krishnamurthi <sk at cs.brown.edu> wrote:
> [It sure would be nice to provide a "JavaScript numbers" language
> level in DrScheme, so people can test under browser numbers and make
> sure those are sufficient for their programs.  If they are, Moby can
> generate much simpler and vastly faster code.]

Wouldn't this just be this (untested, not right for keywords, quasiquote):

#lang racket
(provide (except-out (all-from-out racket) quote #%datum)
  (rename-out [-#%datum #%datum] [-quote quote]))
(define-syntax-rule (-#%datum arg) (-quote arg))
(define-syntax (-quote arg)
  (syntax-case arg ()
    [(_ i)
     (and (number? i) (not (inexact? i)))
     #'(exact->inexact (quote i))]
    [(_ i) (quote i)]))

Or maybe just a reader change to read all numbers as inexact?

sam th
samth at ccs.neu.edu

Posted on the dev mailing list.