[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] (file-select ...) and compiler warnings
From: |
J Altfas |
Subject: |
[Chicken-users] (file-select ...) and compiler warnings |
Date: |
Sun, 17 Feb 2013 14:18:32 -0800 |
Hello,
Using 'file-select' as a sub-second sleep procedure works without hitch under csi:
(define (sleeper tm)
(let ((currms (current-milliseconds)))
(let-values (((_ __) (file-select #f #f tm)))
(print (- (current-milliseconds) currms)))))
;1> (sleeper 0.05)
50.0
However, compiling with csc produces several warnings:
Warning: in local procedure `find-err',
in local unknown procedure,
in toplevel unknown procedure:
(compose.scm:260) in procedure call to `file-select', expected argument #1 of type `(list-of fixnum)', but was given an argument of type `boolean'
Warning: in local procedure `find-err',
in local unknown procedure,
in toplevel unknown procedure:
(compose.scm:260) in procedure call to `file-select', expected argument #2 of type `(list-of fixnum)', but was given an argument of type `boolean'
Warning: in local procedure `find-err',
in local unknown procedure,
in toplevel unknown procedure:
(compose.scm:260) in procedure call to `file-select', expected argument #3 of type `fixnum', but was given an argument of type `float'
In types.db, we have:
(file-select (#(procedure #:clean #:enforce) file-select ((list-of fixnum) (list-of fixnum) #!optional fixnum) * *))
Based on the description of 'file-select' in the manual, and performance in csi, it seeems it would be more accurate to declare:
(file-select (#(procedure #:clean #:enforce) file-select ((or boolean (list-of fixnum)) (or boolean (list-of fixnum)) #!optional (or fixnum float) (or boolean (list-of fixnum)) (or boolean (list-of fixnum)))))
Of course, having a "real" usleep function would be cleaner than faking it with file-select, especially as implementing a usleep procedure is pretty trivial:
(define usleep (foreign-lambda int "usleep" unsigned-integer32))
Maybe it wouldn't be too much trouble to add it to the posix (or some other) module.
Thanks,
J. Altfas
- [Chicken-users] (file-select ...) and compiler warnings,
J Altfas <=
- Re: [Chicken-users] (file-select ...) and compiler warnings, Jim Ursetto, 2013/02/17
- Re: [Chicken-users] (file-select ...) and compiler warnings, J Altfas, 2013/02/18
- Re: [Chicken-users] (file-select ...) and compiler warnings, Jim Ursetto, 2013/02/18
- Re: [Chicken-users] (file-select ...) and compiler warnings, J Altfas, 2013/02/18
- Re: [Chicken-users] posix-extras sleep, Jim Ursetto, 2013/02/19
- Re: [Chicken-users] posix-extras sleep, Jim Ursetto, 2013/02/19
- Message not available
- Message not available
- Re: [Chicken-users] posix-extras sleep, J Altfas, 2013/02/20
- Re: [Chicken-users] posix-extras sleep, Jim Ursetto, 2013/02/20
- Re: [Chicken-users] (file-select ...) and compiler warnings, John Cowan, 2013/02/19
Re: [Chicken-users] (file-select ...) and compiler warnings, Felix, 2013/02/18