* doc/ref/api-binding.texi (Local Bindings): Document multiple-value
returns for let.
* doc/ref/api-control.texi (begin): Document multiple-value returns for
begin.
(Conditionals): Document multiple-value returns and use 'body' in the
syntax description of when, unless, cond, case.
(Multiple values): Document multiple-value returns and use 'body' in
the syntax description of SRFI-8 receive.
(Fluids and Dynamic States): Use 'body' in the syntax description of
'with-fluids'.
This commit adds internal definitions to the following derived
forms: when, unless, cond, case, with-fluids, and and-let*.
* doc/ref/api-control.texi (Conditionals): Update the syntax and docs
of when, unless, cond, and case.
* module/ice-9/and-let-star.scm (and-let*): Changed begins to let.
* module/ice-9/boot-9.scm (cond, case, when, unless, with-fluids):
Changed begins to let.
Suggested by Dale P. Smith <dsmich@roadrunner.com>.
* libguile/deprecated.h (SCM_MEMORY_ERROR): New macro.
* doc/ref/api-control.texi (Dynamic Wind): Use 'scm_report_out_of_memory'.
'scm_memory_error' was deprecated in 2014 in commit
c2247b782a and removed in 2017 in commit
c248ea10be. This is a followup.
* libguile/error.h (SCM_MEMORY_ERROR): Remove.
* doc/guile-api.alist: Remove 'scm_memory_error'.
* doc/ref/api-control.texi (Handling Errors): Likewise.
(Dynamic Wind): Use 'scm_misc_error' instead of 'scm_memory_error'.
* doc/ref/api-control.texi (Prompt Primitives): Reference the newer
exception facilities.
(Exceptions): Rewrite to use the new exception primitives.
(Exception Terminology): Remove superfluous section.
(Exception Objects): New section.
(Raising and Handling Exceptions): New section.
(Throw and Catch): New section, coalescing the previous catch,
with-throw-handler, and throw sections.
(Exceptions and C): New section, for miscellaneous procedures.
(Handling Errors): Mention the transitional period regarding exception
handling.
* doc/ref/api-debug.texi (Catching Exceptions): Rewrite to use newer
exception facilities.
(Capturing Stacks): Remove, as it's not really recommendable any
more.
(Pre-Unwind Debugging): Rewrite to use the new primitives.
(Standard Error Handling): Add note about transitional status.
(Stack Overflow): Reference new exception section.
* doc/ref/api-scheduling.texi (Mutexes and Condition Variables):
Reference new exception section.
* doc/ref/r6rs.texi (rnrs exceptions, rnrs conditions): Update to
mention compatibility with SRFI-34/35 and to relate to core
exceptions.
* doc/ref/srfi-modules.texi (SRFI-34): Document.
* libguile/fluids.h (struct scm_dynamic_state): Add thread_local_values
table. Thread locals are flushed to a separate thread-local table.
The references are strong references since the table never escapes the
thread.
(scm_make_thread_local_fluid, scm_fluid_thread_local_p): New
functions.
* libguile/fluids.c (FLUID_F_THREAD_LOCAL):
(SCM_I_FLUID_THREAD_LOCAL_P): New macros.
(restore_dynamic_state): Add comment about precondition.
(save_dynamic_state): Flush thread locals.
(scm_i_fluid_print): Print thread locals nicely.
(new_fluid): Add flags arg.
(scm_make_fluid, scm_make_fluid_with_default, scm_make_unbound_fluid):
Adapt.
(scm_make_thread_local_fluid, scm_fluid_thread_local_p): New
functions.
(fluid_set_x): Special flushing logic for thread-locals.
(fluid_ref): Special cache miss logic for thread locals.
* libguile/stacks.c (scm_init_stacks):
* libguile/throw.c (scm_init_throw): %stacks and %exception-handler are
thread-locals.
* libguile/threads.c (guilify_self_2): Init thread locals table.
* test-suite/tests/fluids.test ("dynamic states"): Add test.
* doc/ref/api-control.texi (Fluids and Dynamic States): Add link to
Thread-Local Variables.
* doc/ref/api-scheduling.texi (Thread Local Variables): Update with real
thread-locals.
* NEWS: Update.
* libguile/dynstack.h:
* libguile/dynstack.c (scm_dynstack_find_old_fluid_value): New
function.
* libguile/fluids.c (saved_dynamic_state_ref): New helper.
(scm_fluid_ref): Fix docstring.
(scm_fluid_ref_star): New function allowing access to previous values
for a fluid.
(scm_dynamic_state_ref): New internal function.
* libguile/fluids.h: Add scm_fluid_ref_star and scm_dynamic_state_ref.
* libguile/stacks.c (scm_stack_id): Adapt to %stacks not being a chain.
* libguile/throw.c (catch, throw_without_pre_unwind): Adapt to
%exception-handlers not being a chain.
* module/ice-9/boot-9.scm (catch, dispatch-exception): Instead of having
%exception-handlers be a chain, use fluid-ref* to access the chain
that is in place at the time the exception is thrown. Prevents
unintended undelimited capture of the current exception handler stack
by a delimited "catch".
(%start-stack): Similarly, don't be a chain.
* module/system/repl/debug.scm (frame->stack-vector):
* module/system/repl/error-handling.scm (call-with-error-handling):
* module/ice-9/save-stack.scm (save-stack): Adapt to %stacks not being a
chain.
* test-suite/tests/exceptions.test ("delimited exception handlers"): Add
tests.
* doc/ref/api-control.texi (Fluids and Dynamic States): Add docs.
* doc/ref/api-control.texi (Prompt Primitives): Remove mention of
one-shot continuations, as it's possible to invoke them multiple times
if the continuation is re-entered through other means.
* doc/ref/api-io.texi: Update to document ports more thoroughly. Still
some work needed.
* doc/ref/r6rs.texi: Move ports documentation back to r6rs.texi, now
that Guile has a more thorough binary/textual I/O story, heavily based
on R6RS.
* doc/ref/api-control.texi:
* doc/ref/api-data.texi:
* doc/ref/api-options.texi:
* doc/ref/misc-modules.texi:
* doc/ref/posix.texi:
* doc/ref/srfi-modules.texi: Update references.
* doc/ref/libguile-smobs.texi: Remove; this tutorial is superseded by
libguile-foreign-objects.
* doc/ref/libguile-foreign-objects.texi: Proofreading.
* doc/ref/libguile-program.texi: Update Dia examples to refer to foreign
objects.
* doc/ref/libguile-concepts.texi (Garbage Collection): Update to
accurately describe the BDW-GC, and to avoid reference to mark
functions.
* doc/ref/guile.texi: Remove libguile-smobs, and reword API menu.
* doc/ref/api-utility.texi (Equality): Mention GOOPS instead of SMOBs.
* doc/ref/api-smobs.texi (Smobs): Describe as a legacy interface.
Exhort readers against the writing of mark functions.
* doc/ref/api-foreign-objects.texi (Foreign Objects): Proofreading.
* doc/ref/api-control.texi (Catch): Fix ref to point to foreign
objects.
* doc/ref/Makefile.am: Remove libguile-smobs.texi.
* libguile/vm.c (vm_error_kwargs_invalid_keyword,
vm_error_kwargs_unrecognized_keyword): Add parameter. Pass it
enclosed in a list as the last argument to `scm_error_scm'.
* libguile/vm-i-system.c (bind_kwargs): Adjust accordingly.
* libguile/eval.c (error_invalid_keyword, error_unrecognized_keyword):
Add parameter.
(prepare_boot_closure_env_for_apply): Adjust accordingly.
* module/ice-9/eval.scm (primitive-eval): Likewise.
* libguile/error.c (scm_error_scm): Mention `keyword-argument-error' in
docstring.
* module/ice-9/boot-9.scm (keyword-error-printer): New procedure; use it.
* test-suite/tests/optargs.test (c&e, with-test-prefix/c&e): Remove.
("define*")["unrecognized keyword"]: Test the value passed along the
`keyword-argument-error' exception.
["invalid keyword"]: New test.
* doc/ref/api-control.texi (Error Reporting): Update `scm-error'
description.
Based on a patch by Nala Ginrut <nalaginrut@gmail.com>,
with suggestions from Mark H. Weaver.
* module/ice-9/control.scm (call-with-escape-continuation, call/ec): New
procedures.
(let-escape-continuation, let/ec): New macros.
* module/ice-9/futures.scm (let/ec): Remove.
* test-suite/tests/control.test ("escape-only continuations")["call/ec",
"let/ec"]: New tests.
* doc/ref/api-control.texi (Prompt Primitives): Document `call/ec',
`let/ec', and their long names.
* doc/ref/api-control.texi (Handling Errors): Move misplaced description
for `scm_memory_error' & co.
* doc/ref/r6rs.texi (rnrs base): Change `deffnx' of `let-syntax' and
`letrec-syntax' to fit on one line.
* module/ice-9/boot-9.scm (default-prompt-tag): Once parameters have
booted, redefine as a parameter.
(make-prompt-tag): Change from a gensym to a list. Thanks to Mark
Weaver for the suggestion.
* doc/ref/api-control.texi (Prompt Primitives): Update docs.
* module/ice-9/boot-9.scm (cond, case): Reimplement using syntax-case,
with improved error messages and support for '=>' within 'case' as
mandated by the R7RS. Add warnings for duplicate case datums and
case datums that cannot be meaningfully compared using 'eqv?'.
* module/system/base/message.scm (%warning-types): Add 'bad-case-datum'
and 'duplicate-case-datum' warning types.
* test-suite/tests/syntax.test (cond, case): Update tests to reflect
improved error reporting. Add tests for '=>' within 'case'.
* test-suite/tests/tree-il.test (partial evaluation): Update tests to
reflect changes in how 'case' is expanded.
* doc/ref/api-control.texi (Conditionals): Document '=>' within 'case'.
Based on a patch by Julian Graham <julian@member.fsf.org>
* libguile/values.c, libguile/values.h (scm_c_value_ref): New function.
* doc/ref/api-control.texi (Multiple Values): Add documentation.
* test-suite/standalone/test-scm-values.c: New test program.
* test-suite/standalone/Makefile.am: Add test-scm-values test.
* libguile/deprecated.h: Mark scm_immutable_cell and
scm_immutable_double_cell as being SCM_DEPRECATED, not SCM_API.
Deprecate SCM_ASRTGO.
* libguile/deprecated.c (scm_i_deprecated_asrtgo): New support
procedure.
* doc/ref/api-control.texi (Handling Errors): Remove ASRTGO docs.
* doc/ref/api-control.texi (begin): Update to distinguish between
splicing begin and sequencing begin.
* module/ice-9/psyntax.scm (expand-expr): Add a back-compatibility shim
for `(begin)'.
* module/ice-9/psyntax-pp.scm: Regenerate.
* test-suite/tests/syntax.test: Update to run illegal (begin) test only
if we are not including deprecated features.
* doc/ref/api-control.texi (Prompt Primitives): Break call-with-prompt
and abort-to-prompt out into a subsubsection.
(Shift and Reset): New subsubsection.
* module/ice-9/boot-9.scm (while): Specify the return value as #f under
normal conditions, #t under (break), and arg... under (break arg...).
* test-suite/tests/syntax.test ("while"): Test.
* doc/ref/api-control.texi (while do): Document.