On Thu, 2009-09-24 at 19:54 -0700, Brian Harvey wrote:
> > Get (or configure) a small Scheme that's -%bignums -%inexact.
> 
> I submit that this whole configurable options thing doesn't look very 
> Schemely.
> I would rather say
>       (set-auto-promote-bignum! #f)
> or
>       (set-fixnum-oflo-hook (lambda (value) ...))
> if I really have to change the behavior of my Scheme system.  

Note that these are not "normal" variables.  In order to do what 
you want these flags have to be passed from the call site to the 
(transitive closure of) functions called.  That makes them part 
of the dynamic environment, which Scheme has been pretending 
doesn't exist despite dynamic variables like current-input-port 
and so on. 

So to give it an orthogonal treatment as a bunch of special forms 
because we don't like free use of dynamic variables, you'd probably 
want a form like:
...
        (with-fixnum-overflow arg
             <body>)

   arg, which is not evaluated, must be a symbol from the set 
   coerce-float, coerce-bignum, wraparound, or signal-error.  
   Some WG1 implementations may support only one of these 
   arguments.  On encountering an unsupported arg, however, 
   an error must be signaled. ...

in addition to the (set-fixnum-overflow! arg) form of which you 
gave an example, which presumably sets it at "top level". 

We already have examples of at least most of these behaviors in 
extant schemes; MIT/GNU (and many others) coerce to bignum, Stalin
(and many others) silently wraparound, and I've seen at least one
system that coerces to float and one that reports an overflow 
error, although their creators may not have been calling them 
"scheme" at the time. 

On the downside, making the overflow treatment configurable 
could slow down arithmetic operations and may prevent inlining in 
some cases.  

                        Bear



_______________________________________________
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss

Reply via email to