Clarify comment re `fixnum?' non-use at the syntax level, and add a note

to the `fixnum?' documentation.
This commit is contained in:
Eli Barzilay 2010-11-05 01:46:01 -04:00
parent 84ec108c32
commit 9a485064ed
2 changed files with 8 additions and 4 deletions

View File

@ -149,7 +149,10 @@ Returns @racket[(and (real? v) (inexact? v))].}
@defproc[(fixnum? [v any/c]) boolean?]{
Return @racket[#t] if @racket[v] is a @techlink{fixnum}, @racket[#f]
otherwise.}
otherwise.
Note: the result of this function is platform-dependent, so using it in
syntax transformers can lead to platform-dependent bytecode files.}
@defproc[(flonum? [v any/c]) boolean?]{

View File

@ -21,9 +21,10 @@
(import tc-if^ tc-lambda^ tc-app^ tc-let^ check-subforms^)
(export tc-expr^)
;; Is the number a fixnum on all the platforms Racket supports?
;; This relies on Racket being compiled only on 32+ bit systems.
;; This check is done at compile time to typecheck literals.
;; Is the number a fixnum on *all* the platforms Racket supports? This
;; works because Racket compiles only on 32+ bit systems. This check is
;; done at compile time to typecheck literals -- so use it instead of
;; `fixnum?' to avoid creating platform-dependent .zo files.
(define (portable-fixnum? n)
(and (exact-integer? n)
(< n (expt 2 31))