~ chicken-core (master) 9e5cddfd06219385884080a3c54714440de28e2c
commit 9e5cddfd06219385884080a3c54714440de28e2c
Author: felix <felix@call-with-current-continuation.org>
AuthorDate: Thu Sep 24 11:01:34 2026 +0200
Commit: felix <felix@call-with-current-continuation.org>
CommitDate: Thu Sep 24 11:01:34 2026 +0200
semantics for "include" are now the same as for "include-relative" for better compatibility to other Schemes, deprecate the latter
diff --git a/DEPRECATED b/DEPRECATED
index 8c68157b..4001481b 100644
--- a/DEPRECATED
+++ b/DEPRECATED
@@ -6,6 +6,8 @@ Deprecated functions and variables
codepoints when a non-binary encoding is used in the port. It
will be replaced by a method that returns bytevectors in the
future.
+- "include-relative" is not needed, as "include" already takes the
+ including file directory into account.
6.0.0
- The foreign type "blob" is obsolete and equivalent to the
diff --git a/chicken-syntax.scm b/chicken-syntax.scm
index 6e968405..e47c4ca6 100644
--- a/chicken-syntax.scm
+++ b/chicken-syntax.scm
@@ -433,7 +433,7 @@
(##sys#er-transformer
(lambda (form r c)
(##sys#check-syntax 'include form '(_ . #(string 1)))
- `(##core#begin ,@(map (lambda (x) `(##core#include ,x #f))
+ `(##core#begin ,@(map (lambda (x) `(##core#include ,x ,##sys#current-source-filename))
(cdr form))))))
(##sys#extend-macro-environment
@@ -441,10 +441,10 @@
(##sys#er-transformer
(lambda (form r c)
(##sys#check-syntax 'include-ci form '(_ . #(string 1)))
- `(##core#begin ,@(map (lambda (x) `(##core#include-ci ,x #f))
+ `(##core#begin ,@(map (lambda (x) `(##core#include-ci ,x ,##sys#current-source-filename))
(cdr form))))))
-(##sys#extend-macro-environment
+(##sys#extend-macro-environment ; DEPRECATED
'include-relative '()
(##sys#er-transformer
(lambda (form r c)
diff --git a/library.scm b/library.scm
index 4cb11129..db4e4d39 100644
--- a/library.scm
+++ b/library.scm
@@ -829,7 +829,7 @@ EOF
(;; [syntax] and-let* case-lambda cut cute declare define-constant
;; define-inline define-record define-record-type
;; define-values delay-force fluid-let include
- ;; include-relative let-optionals let-values let*-values letrec*
+ ;; let-optionals let-values let*-values letrec*
;; letrec-values nth-value optional parameterize rec receive
;; require-library require-extension set!-values syntax unless when
bignum? flonum? fixnum? ratnum? cplxnum? finite? infinite? nan?
diff --git a/manual/Module (chicken base) b/manual/Module (chicken base)
index eccf3b94..920c14b0 100644
--- a/manual/Module (chicken base)
+++ b/manual/Module (chicken base)
@@ -1142,13 +1142,6 @@ need to be aware of:
* If source code is loaded from a port, then that port is closed after all expressions have been read.
* A compiled file can only be loaded once. Subsequent attempts to load the same file have no effect.
-==== include-relative
-
-<macro>(include-relative STRING)</macro>
-
-Works like {{include}}, but the filename is searched for relative to the
-including file rather than the current directory.
-
=== Making extra libraries and extensions available
diff --git a/manual/Module (scheme base) b/manual/Module (scheme base)
index 087c579a..b92b1b72 100644
--- a/manual/Module (scheme base)
+++ b/manual/Module (scheme base)
@@ -274,8 +274,7 @@ implements [[http://srfi.schemers.org/srfi-17/srfi-17.html|SRFI-17]].
<macro>(include-ci STRING1 STRING2 ...)</macro>
Semantics: Both {{include}} and {{include-ci}} take one or
-more filenames expressed as string literals, apply an
-implementation-specific algorithm to find corresponding
+more filenames expressed as string literals, find the corresponding
files, read the contents of the files in the specified order
as if by repeated applications of {{read}}, and effectively replace the {{include}}
or {{include-ci}} expression with a {{begin}}
@@ -284,6 +283,12 @@ difference between the two is that {{include-ci}} reads each
file as if it began with the {{#!fold-case}} directive, while
{{include}} does not.
+If the given filenames are relative paths, they are searched in the
+directory containing the file where the {{include}} form appears,
+then in the paths given in the list returned by {{include-path}}
+(from the {{(chicken platform)}} module) or in the extension
+repository directory.
+
=== Derived expression types
diff --git a/tests/runtests.sh b/tests/runtests.sh
index e3bceea7..54a5b4b4 100755
--- a/tests/runtests.sh
+++ b/tests/runtests.sh
@@ -502,20 +502,20 @@ echo '(include "a/b/ok.scm")' > a/b/include.scm
$compile -analyze-only a/b/include.scm
echo '(include "b/ok.scm")' > a/b/include.scm
$compile -analyze-only a/b/include.scm -include-path a
-echo '(include-relative "ok.scm")' > a/b/include.scm
+echo '(include "ok.scm")' > a/b/include.scm
$compile -analyze-only a/b/include.scm
-echo '(include-relative "b/ok.scm")' > a/include.scm
+echo '(include "b/ok.scm")' > a/include.scm
$compile -analyze-only a/include.scm
-echo '(include-relative "b/ok.scm")' > a/b/include.scm
+echo '(include "b/ok.scm")' > a/b/include.scm
$compile -analyze-only a/b/include.scm -include-path a
echo > a/b/other.scm
# make sure first include doesn't change state for second:
-echo '(include-relative "b/ok.scm") (include-relative "b/other.scm")' > a/include.scm
+echo '(include "b/ok.scm") (include "b/other.scm")' > a/include.scm
$compile -analyze-only a/include.scm
-echo '(include-relative "ok.scm")' > a/b/other.scm
-echo '(include-relative "b/other.scm")' > a/include.scm
+echo '(include "ok.scm")' > a/b/other.scm
+echo '(include "b/other.scm")' > a/include.scm
$compile -analyze-only a/include.scm
-echo '(include-relative "b/other.scm") (let () (include-relative "b/ok.scm") (include-relative "b/ok.scm"))' > a/include.scm
+echo '(include "b/other.scm") (let () (include "b/ok.scm") (include "b/ok.scm"))' > a/include.scm
$compile -analyze-only a/include.scm
rm -r a
Trap