Prior to commit cb14fd2143 (Guile 2.9.7),
autoloading a module would give you access to all its bindings. In
future versions, autoloading a module gives access only to the listed
bindings, as per #:select (see <https://bugs.gnu.org/38895>).
This commit adjusts autoloads to the new semantics, fixing a regression
introduced in cb14fd2143.
* module/web/client.scm <top level>: Remove 'module-autoload!' call.
(gnutls-module, ensure-gnutls): Remove.
(load-gnutls): New procedure.
(tls-wrap): Call it instead of 'ensure-gnutls'. Replace reference to
GNUTLS-MODULE by a call to 'resolve-interface'.
The current implementation of srfi-11s let-values allows later clauses
to access and modify variables bound in earlier clauses when the clause
is not a proper list.
* module/srfi/srfi-11.scm (let-values): Fix switched variable names.
* test-suite/tests/srfi-11.test (let-values): Add test checking that the
variable cannot be changed in later clauses.
* module/language/tree-il/peval.scm (peval): Fix arity check for type
confusion (empty value of "rest" in this context was (), not #f). The
effect was that we'd silently allow extra arguments to inlined calls.
Thanks to Christopher Lam for the report! Fixes#38617.
* test-suite/tests/peval.test ("partial evaluation"): Add a test.
* module/Makefile.am (ice-9/boot-9.go, NOCOMP_SOURCES): Add
r7rs-libraries.
* module/ice-9/boot-9.scm ("ice-9/r7rs-libraries"): Include file.
* module/ice-9/psyntax.scm (call-with-include-port): New definition.
(include): Use call-with-include-port.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/r7rs-libraries.scm: New file.
* module/scheme/base.scm (r7:include, r7:include-ci): Fix mistaken use
of core "include". Use include-ci from core.
(features): Remove features that are already part of core.
* NEWS: Update.
* module/language/cps/closure-conversion.scm (convert-one):
Strongly-connected components of letrec bindings that do not share a
closure may include member functions that have a single free variable,
or even no free variables as a result of free variable pruning.
Handle this case instead of erroring out. Thanks to Stefan Israelsson
Tampe for the report.
* module/ice-9/exceptions.scm (guard): Add guard definition that
re-propagates from original continuation, runs consequents in tail
position in guard continuation, and doesn't rewind the stack.
* module/srfi/srfi-34.scm:
* module/rnrs/exceptions.scm (guard): Re-export from (ice-9
exceptions).
With this patch, these two lines
(vector-fill! vec fill)
(vector-fill! vec fill 0 end)
run at the same speed; before, the second one was much slower.
This patch also makes it an error to call vector-fill! with a non-vector
array. The previous implementation did not work correctly in this case.
* libguile/vectors.c (SCM_VALIDATE_MUTABLE_VECTOR): Better error message.
(vector-fill!): Handle optional arguments start, end. Do not attempt
to handle non-vector arrays. Rename the C binding to
scm_vector_fill_partial_x.
(scm_vector_fill_x): Reuse scm_vector_fill_partial_x.
* module/srfi/srfi-43.scm (vector-fill!): Remove & re-export the core
version instead.
Previously we'd get warnings like:
t.scm:11:0: warning: shadows previous definition of `unused-constructor-51900bdce47d50c' at /tmp/t.scm:6:0
whenever 'define-condition-type' appeared more than once in a source
file.
* module/srfi/srfi-35.scm (define-condition-type): Rewrite as
'syntax-case' and generate UNUSED-CONSTRUCTOR as a function of TYPE.
* module/language/cps/effects-analysis.scm (&header): New memory kind,
for the fixed parts of objects. Distinguishing init-only memory
allows us to determine that vector-set! doesn't stomple
vector-length.
(annotation->memory-kind*): New helper, mapping references to fixed
offsets to &header. Use for scm-ref/immediate et al.
* doc/ref/api-modules.texi (Creating Guile Modules): Document
#:re-export-and-replace.
* module/ice-9/boot-9.scm (module-replacements): New module field.
(make-module, make-autoload-interface): Initialize replacements to an
empty hash table.
(resolve-interface): Propagate replacement info when making custom
interfaces.
(define-module): Parse a #:re-export-and-replace keyword arg.
(define-module*): Handle #:re-export-and-replace.
(module-export!, module-re-export!): Add a keyword arg to indicate
whether to replace or not.
(module-replace!): Call module-export! with #:replace? #t.
(duplicate-handlers): Update replace duplicate handler to look for
replacement info on the interfaces.
* module/srfi/srfi-18.scm (srfi):
* module/srfi/srfi-34.scm (srfi): Update to #:re-export-and-replace
raise-continuable as raise.
* module/language/cps/types.scm (div-result-range): It is possible for a
max value to be less than a minimum. In this bug from zig:
(define (benchmark x)
(let loop ((count 0)
(sum 0))
(if (= count 10)
(exact->inexact (/ sum 10)))
(loop (+ count 1) x)))
Here the first iteration gets peeled, and thus the first "if" can't be
true, because "count" is zero. However on the true branch of the if,
range inference produces bogus ranges -- notably, the variable bound
to 10 is inferred to have a min of 10 and a max of 0. This is fine,
because it's unreachable; but that then infects the division, because
the same variable bound to 10 is used there, resulting in division by
zero.
* module/system/vm/assembler.scm (<arity>): Add new "has-closure?"
flag.
(begin-kw-arity, pack-arity-flags, write-arities): Write
"elided-closure?" flag into binary. A negative flag for compat
reasons.
* module/system/vm/debug.scm (elided-closure?, arity-has-closure?): Add
arity-has-closure? accessor.
* module/system/vm/frame.scm (frame-call-representation): Count from 0
for callees with elided closures.
* module/Makefile.am (SOURCES): Add new files.
* module/scheme/base.scm:
* module/scheme/case-lambda.scm:
* module/scheme/char.scm:
* module/scheme/complex.scm:
* module/scheme/cxr.scm:
* module/scheme/eval.scm:
* module/scheme/file.scm:
* module/scheme/inexact.scm:
* module/scheme/lazy.scm:
* module/scheme/load.scm:
* module/scheme/process-context.scm:
* module/scheme/r5rs.scm:
* module/scheme/read.scm:
* module/scheme/repl.scm:
* module/scheme/time.scm:
* module/scheme/write.scm: New files. Thanks to Göran Weinholt for
akku-scm and OKUMURA Yuki for yuni, off of which some of these files
were based.
* module/ice-9/boot-9.scm (exception-kind, exception-args): Export.
* module/ice-9/exceptions.scm (exception-kind, exception-args):
Re-export.
* module/srfi/srfi-18.scm: Rewrite exception support in terms of core
exceptions, not SRFI-34/35.
* test-suite/tests/srfi-18.test: Since Guile doesn't expose the current
exception handler as such, SRFI-18 captures it using delimited
continuations. This means that we can't compare the result
of (current-exception-handler) with the installed handler using eq?,
even though the procedures are indeed equivalent. So, instead test
handler behavior.
* libguile/exceptions.c:
* libguile/exceptions.h: New files.
* libguile.h: Add exceptions.h.
* libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES):
(DOT_X_FILES, DOT_DOC_FILES, modinclude_HEADERS): Add exceptions.c and
exceptions.h.
* libguile/init.c (scm_i_init_guile): Initialize exceptions.
* libguile/threads.c (scm_spawn_thread): Use new names for
scm_i_make_catch_handler and scm_c_make_thunk.
* libguile/throw.c: Rewrite to be implemented in terms of
with-exception-handler / raise-exception.
* libguile/throw.h: Use data types from exceptions.h. Move
scm_report_stack_overflow and scm_report_out_of_memory to
exceptions.[ch].
* module/ice-9/boot-9.scm (&error, &programming-error)
(&non-continuable, make-exception-from-throw, raise-exception)
(with-exception-handler): New top-level definitions.
(throw, catch, with-throw-handler): Rewrite in terms of
with-exception-handler and raise-exception.
: New top-level definitions.
* module/ice-9/exceptions.scm: Adapt to re-export &error,
&programming-error, &non-continuable, raise-exception, and
with-exception-handler from boot-9.
(make-quit-exception, guile-quit-exception-converter): New exception
converters.
(make-exception-from-throw): Override core binding.
* test-suite/tests/eval.test ("inner trim with prompt tag"): Adapt to
"with-exception-handler" being the procedure on the stack.
("outer trim with prompt tag"): Likewise.
* test-suite/tests/exceptions.test (throw-test): Use pass-if-equal.
* module/srfi/srfi-34.scm: Reimplement in terms of core exceptions, and
make "guard" actually re-raise continuations with the original "raise"
continuation.
* module/ice-9/exceptions.scm: New file, derived from (rnrs
conditions). Perhaps unadvisedly, in this file I've renamed a number
of the identifiers. I have never found that the R6RS identifiers made
sense to me. For now this is an internal module that R6RS and SRFI-35
will be based on.
* module/Makefile.am (SOURCES): Add the new file.
* module/rnrs/conditions.scm (rnrs): Export renamed identifiers
from (ice-9 exceptions).
* module/rnrs/conditions.scm: Use core record facilities to define the
base condition types, define-condition-type, and the standard
condition hierarchy.
(simple-condition?): Rename from condition-internal?.
* module/rnrs/exceptions.scm: Move `raise' definition here, out from the
procedural records layer.
(format-simple-condition): Reimplement in a simpler way, hopefully
producing the same output.
* module/rnrs/records/procedural.scm:
* module/rnrs/records/inspection.scm: Import the exceptions and
conditions modules, and use the normal raise function.
* module/ice-9/boot-9.scm (record-type-uid): New accessor.
(make-record-type): Record UID in record type properties.
* module/rnrs/conditions.scm (define-condition-type): Fix invalid
invocation of make-record-type.
* module/rnrs/records/inspection.scm: Rewrite to use core record
inspection facilities.
* module/rnrs/records/procedural.scm: Rewrite to use core
make-record-type. Incidentally the result is that instances of
derived R6RS record types are now flat instead of nested.
* test-suite/tests/r6rs-records-procedural.test
("make-record-type-descriptor"): Relax a couple condition type checks,
while we redo the exception system.
* module/ice-9/boot-9.scm (make-record-type): Allow (mutable NAME)
or (immutable NAME) as a field name, and record field mutability in a
bitfield.
(record-modifier): Throw an error if the field isn't mutable.
* test-suite/tests/records.test ("records"): Add tests.
* doc/ref/api-data.texi (Records): Update.
* module/srfi/srfi-35.scm: Import (ice-9 match), and remove now-unused
srfi-1 import.
(print-condition): Print more like records, as appears to be the
intention.
(&condition): Define using make-record-type. Adapt all callers.
Also, compound conditions are now a disjoint type, handled specially
by condition-ref, condition?, and so on.
* test-suite/tests/srfi-35.test (v3): Fix an error in which a
subcondition was initialized without initializers for all of its
fields.
* module/ice-9/boot-9.scm (make-record-type): Validate that the fields
are a unique list of symbols. Deprecate passing a string as a type
name.
* module/system/base/syntax.scm (define-record): Update to pass a symbol
as a type name.
* test-suite/tests/records.test (rtd-foo, rtd-fŏŏ, "records"): Adapt to
make record types with symbol names.