On Wed, Jan 02, 2013 at 01:31:46PM +0100, Felix wrote: > >> It could. Should it? C just truncates. I dunno. > > > > I think it should. This will be an extra help in detecting bugs; if a > > user accidentally passes a flonum where a fixnum is expected that's > > always a bug, unless the flonum is the result of a fixnum overflow. And > > in the latter case, this should always be an integer value. To catch > > accidental misuse the additional check is useful. > > The flonum/fixnum distinction is a distinction between types. But in > this case it is a property independent of type. Since we are passing > values to C anyway, I don't see a reason to add extra checks in this > case - the values pass the Scheme/C boundary and might as well > be treated using C semantics. I also don't see how this might prevent > bugs, and what type of bugs these would be.
I'm thinking bugs like indexing a pixel or a database record at position 1.5 due to a mistaken offset calculation. I've made mistakes like that in the past and would like those to be caught early. I know we can always add additional checks in wrapper code around the call, but I think that if I'm asking for an integer it makes sense if it complains when passed some fractional value. Cheers, Peter -- http://sjamaan.ath.cx _______________________________________________ Chicken-hackers mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/chicken-hackers
