On 29 Sep 2009, at 5:14 pm, Brian Harvey wrote:

>> (with-fixed-size-numbers-that-overflow-to-inexacts ...stuff...)
>
> Warning: I'm going to talk about jewels again.  :-)
>
> One of the beautiful things that has distinguished Scheme from other
> languages is that the Scheme user doesn't have to think about the
> limitations of physical computers, but can instead compute with
> mathematical numbers, leaving the representation issue to the Scheme
> implementor.  The orthogonality of exactness with integerness is
> wonderful.  I think this is why all the proposals to push
> representation
> onto the user are having underwhelming responses.

I agree. I'd like that behaviour to be the default, and any funny
variations on it, useful as they may be, as optional extensions that
the programmer has to ask for in some way.

> Personally, I support Thomas Lord's repeated suggestion that bignum
> magnitude be limited to something well below the size of memory,
> raising
> an exception on overflow.  The exception-catching mechanism that we
> should
> have in general would then allow programs to convert to flonum, crash,
> invent roll-your-own floating point, or whatever it wanted to do.
> That
> means everyone except astronomers and cryptographers can go on
> thinking
> of numbers as numbers.

That'd be reasonable, as long as "s/something well below the size of
memory/some implementation-specified maximum/". I don't care if some
implementation sets that bar at +/-128, as long as it says so on the
box so that people can know this system isn't good at numbers (but is
a lovely way of programming an 8-bit microcontroller in Scheme ;-)

Yes, it'd be inefficient to implement exact->inexact overflow that
way, by trapping to arbitrary user exception handlers that do stuff;
but implementations that want to provide optimised implementations for
that sort of arithmetic can get together and agree a shared SRFI
interface for providing a standard condition handler for this
behaviour, with a portable reference implementation, and their
implementations can special-case the presence of that handler by
setting a flag bit to enable their hardware inexact-overflow ALUs or
whatever.

ABS

--
Alaric Snell-Pym
Work: http://www.snell-systems.co.uk/
Play: http://www.snell-pym.org.uk/alaric/
Blog: http://www.snell-pym.org.uk/archives/author/alaric/




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

Reply via email to