~ chicken-r7rs (master) 6e45b962b052c1de7aa4dbadee7a9e9e61d8114e
commit 6e45b962b052c1de7aa4dbadee7a9e9e61d8114e
Author: Peter Bex <peter@more-magic.net>
AuthorDate: Sat Jul 6 19:11:19 2013 +0000
Commit: Evan Hanson <evhan@foldling.org>
CommitDate: Sat Jul 6 19:11:19 2013 +0000
Don't cache the command-line! his change also makes it fully pure
diff --git a/scheme.process-context.scm b/scheme.process-context.scm
index 2202cf0..488e210 100644
--- a/scheme.process-context.scm
+++ b/scheme.process-context.scm
@@ -14,17 +14,13 @@
;;; 6.14. System interface.
;;;
-(: command-line (-> (list-of string)))
+(: command-line (--> (list-of string)))
(: exit (* -> noreturn))
(: emergency-exit (* -> noreturn))
-(define command-line
- (let ((command-line #f)
- (arguments (command-line-arguments)))
- (lambda ()
- (unless command-line
- (set! command-line (cons (program-name) arguments)))
- command-line)))
+(define (command-line)
+ ;; Don't cache these; they may be parameterized at any time!
+ (cons (program-name) (command-line-arguments)))
(define (->exit-status obj)
(cond ((integer? obj) obj)
Trap