[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-hackers] [PATCH] Do not assume all fixnum literals will be
From: |
Evan Hanson |
Subject: |
Re: [Chicken-hackers] [PATCH] Do not assume all fixnum literals will be fixnums at runtime [was: Re: [PATCH][5] types.db entries for the overflow-aware ops] |
Date: |
Wed, 24 May 2017 21:25:15 +1200 |
Hi folks,
Good discussion, thank you Peter and Lemon for considering this.
> diff --git a/lfa2.scm b/lfa2.scm
> index 0fd4612..4c7ff84 100644
> --- a/lfa2.scm
> +++ b/lfa2.scm
> @@ -173,17 +173,14 @@
> ;; a simplified variant of the one in scrutinizer.scm
> (cond ((string? lit) 'string)
> ((symbol? lit) 'symbol)
> + ;; Do not assume fixnum width matches target platform's!
> + ((or (big-fixnum? lit)
> + (bignum? lit))
> + 'integer)
> ((fixnum? lit) 'fixnum)
> - ((bignum? lit) 'bignum)
> ((flonum? lit) 'float)
> ((ratnum? lit) 'ratnum)
> ((cplxnum? lit) 'cplxnum)
You use `bignum?' for the non-fixnum part of the width check here in
lfa2.scm, but `small-bignum?' in scrutinizer.scm -- why is that? (This
is in the chicken-5 patch.)
> diff --git a/scrutinizer.scm b/scrutinizer.scm
> index cf7c6ad..2d63f19 100644
> --- a/scrutinizer.scm
> +++ b/scrutinizer.scm
> @@ -196,16 +196,15 @@
> (define (constant-result lit)
> (cond ((string? lit) 'string)
> ((symbol? lit) 'symbol)
> + ;; Do not assume fixnum width matches target platform's!
> + ((or (big-fixnum? lit)
> + (small-bignum? lit))
> + 'integer)
> ((fixnum? lit) 'fixnum)
> - ((flonum? lit) 'float) ; Why not "flonum", for consistency?
> ((bignum? lit) 'bignum)
> + ((flonum? lit) 'float) ; Why not "flonum", for consistency?
> ((ratnum? lit) 'ratnum)
> ((cplxnum? lit) 'cplxnum)
Cheers,
Evan
signature.asc
Description: PGP signature