chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] [PATCH] Re: make check failing


From: Peter Bex
Subject: Re: [Chicken-hackers] [PATCH] Re: make check failing
Date: Wed, 2 Jan 2013 20:23:38 +0100
User-agent: Mutt/1.4.2.3i

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]