[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: meta-comment on typing

This page is part of the web mail archives of SRFI 77 from before July 7th, 2015. The new archives for SRFI 77 contain all messages, not just those from before July 7th, 2015.



Marcin 'Qrczak' Kowalczyk wrote:
Per Bothner <per@xxxxxxxxxxx> writes:


Since it *optional* static typing, I'm assuming that the specific
operations are "consistent" in the sense of the following example:

If (and (fixnum? x) (fixnum? y))
then: (eqv? (+ x y) (fx+ x y))


It's not the same: (fx+ x y) returns a fixnum even if it overflows.

As I wrote: I'm *assuming* that + when operating on fixnums
will return a fixnum even if it "overflows".

I.e. that arithmetic on fixnums are defined "modularly" and
fixnums are *not* just a subset of the integers.

This implies that (fixnum? 0) is not true, though of course 0
can be trivially *converted* to a fixnum: (fixnum? (as <fixnum> 0))
is true.

I can see that this might be a bit too radical.
--
	--Per Bothner
per@xxxxxxxxxxx   http://per.bothner.com/