~ chicken-core (master) 350eabf47cb129b318ace79737500e791941983c


commit 350eabf47cb129b318ace79737500e791941983c
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Sat Oct 10 23:55:18 2026 +0200
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Sat Oct 10 23:55:18 2026 +0200

    deprecate "exit" and "emergency-exit" in chicken.base

diff --git a/DEPRECATED b/DEPRECATED
index 4001481b..fd98a13d 100644
--- a/DEPRECATED
+++ b/DEPRECATED
@@ -8,6 +8,9 @@ Deprecated functions and variables
   future.
 - "include-relative" is not needed, as "include" already takes the
   including file directory into account.
+- "exit" and "emergency-exit" from "(chicken base)" are deprecated, 
+  use the R7RS standard procedures from "(scheme process-context)" 
+  instead.
 
 6.0.0
 - The foreign type "blob" is obsolete and equivalent to the 
diff --git a/chicken.base.import.scm b/chicken.base.import.scm
index 0dec96d0..3326475e 100644
--- a/chicken.base.import.scm
+++ b/chicken.base.import.scm
@@ -46,12 +46,12 @@
    (current-error-port . chicken.base#current-error-port)
    (disjoin . chicken.base#disjoin)
    (each . chicken.base#each)
-   (emergency-exit . chicken.base#emergency-exit)
+   (emergency-exit . chicken.base#emergency-exit)   ; DEPRECATED
    (enable-warnings . chicken.base#enable-warnings)
    (equal=? . chicken.base#equal=?)
    (error . chicken.base#error)
    (exact-integer-nth-root . chicken.base#exact-integer-nth-root)
-   (exit . chicken.base#exit)
+   (exit . chicken.base#exit)                       ; DEPRECATED
    (exit-handler . chicken.base#exit-handler)
    (finite? . chicken.base#finite?)
    (fixnum? . chicken.base#fixnum?)
diff --git a/library.scm b/library.scm
index 7508a6c5..df7d43d0 100644
--- a/library.scm
+++ b/library.scm
@@ -963,10 +963,10 @@ EOF
 (define (on-exit thunk)
   (set! cleanup-tasks (cons thunk chicken.base#cleanup-tasks)))
 
-(define (exit #!optional (code 0))
+(define (exit #!optional (code 0))      ; DEPRECATED
   ((exit-handler) code))
 
-(define (emergency-exit #!optional (code 0))
+(define (emergency-exit #!optional (code 0))    ; DEPRECATED (move to scheme.process-context)
   (##sys#check-fixnum code 'emergency-exit)
   (##core#inline "C_exit_runtime" code))
 
diff --git a/manual/Module (chicken base) b/manual/Module (chicken base)
index 920c14b0..3230a841 100644
--- a/manual/Module (chicken base)	
+++ b/manual/Module (chicken base)	
@@ -1196,15 +1196,6 @@ defined:
 
 === Process shutdown
 
-==== emergency-exit
-
-<procedure>(emergency-exit [CODE])</procedure>
-
-Exits the current process without flushing any buffered output (using
-the C function {{_exit}}).  Note that the {{exit-handler}} is not called
-when this procedure is invoked. The optional exit status code {{CODE}}
-defaults to {{0}}.
-
 
 ==== exit
 
@@ -1215,6 +1206,9 @@ Exit the running process and return exit-code, which defaults to 0
 
 Note that pending {{dynamic-wind}} thunks are ''not'' invoked when exiting your program in this way.
 
+This procedure is deprecated in favor of the {{exit}} procedure in the
+[[Module (scheme process-context)|(scheme process-context)|] module.
+
 
 === exit-handler
 
diff --git a/r7lib.scm b/r7lib.scm
index 6c691d9a..15aa6557 100644
--- a/r7lib.scm
+++ b/r7lib.scm
@@ -246,7 +246,7 @@
   (import scheme
           chicken.process-context
           chicken.type
-	  (rename chicken.base (exit chicken-exit)))
+          (except chicken.base exit))
 
 (define (command-line)
   ;; Don't cache these; they may be parameterized at any time!
@@ -267,7 +267,7 @@
         (after)
         (unwind))))
   ;; The built-in exit runs cleanup handlers for us.
-  (chicken-exit (->exit-status obj)))
+  ((exit-handler) (->exit-status obj)))
 
 )
 
Trap