* libguile/ports.c (scm_init_ports): Export the port fluids to Scheme,
temporarily.
* module/ice-9/boot-9.scm (fluid->parameter): Turn `current-input-port'
et al into srfi-39 parameters, backed by the exported fluids, then
remove the fluids from the guile module.
(%cond-expand-features): Add srfi-39.
* module/srfi/srfi-39.scm: Re-export features from boot-9.
* test-suite/tests/parameters.test: Add tests.
* libguile/ports.h:
* libguile/ports.c (scm_current_warning_port)
(scm_set_current_warning_port): New functions, wrapping the Scheme
parameter.
* module/ice-9/boot-9.scm (current-warning-port): New parameter,
defining a port for warnings.
* module/ice-9/boot-9.scm (<parameter>, make-parameter, parameter?)
(parameter-fluid, parameter-converter, parameterize): New top-level
bindings, implementing SRFI-39 parameters. Currently,
current-input-port and similar procedures are not yet parameters.
* test-suite/Makefile.am:
* test-suite/tests/parameters.test: Add tests, taken from srfi-39
tests.
* module/ice-9/boot-9.scm (define-module*): Resolve duplicates handlers
only after importing modules. Fixes a bug in which a module with
#:use-module (oop goops) but whose merge-generics handler got resolved
to noop instead of the real merge-generics handler. I can't think of
an easy way to test this, though.
Thanks to David Pirotte for the report!
* libguile/load.c (canonical_to_suffix, scm_primitive_load_path):
* module/ice-9/boot-9.scm (load-in-vicinity):
* module/system/base/compile.scm (compiled-file-name): If the canonical
path of a file is a DOS-style path with a drive letter, turn it into a
path suffix it by removing the colon and prefixing a "/".
Inspired by a patch from Jan Nieuwenhuizen.
* module/ice-9/boot-9.scm (define-module): Fix to load the #:use-module
clauses in the order in which they appear in the define-module form.
Thanks to Jan Nieuwenhuizen for the report.
* test-suite/standalone/test-import-order: Add new test that
define-module and use-modules resolve the interface in the right
order.
* test-suite/standalone/Makefile.am:
* test-suite/standalone/test-import-order-a.scm:
* test-suite/standalone/test-import-order-b.scm:
* test-suite/standalone/test-import-order-c.scm:
* test-suite/standalone/test-import-order-d.scm: Aux files.
* module/ice-9/boot-9.scm (map, for-each): Implement in Scheme instead
of C. There are boot versions before `cond' is defined.
(map-in-order): Define this alias here instead of in evalext.h.
* libguile/eval.c: Stub out the map and for-each definitions to just
call into Scheme.
* libguile/evalext.c: Remove map-in-order definition.
* module/srfi/srfi-1.scm: Replace all calls to map1 with calls to map.
(map, for-each): Define implementations here, in Scheme, instead of in
C.
* test-suite/tests/eval.test (exception:wrong-length, "map"): Update the
expected exception for mapping over lists of different lengths.
* libguile/srfi-1.h:
* libguile/srfi-1.c: Remove map and for-each definitions. Remove the
bit that extended the core `map' primitive with another method: the
right way to do that is with modules.
* 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.
* doc/ref/api-evaluation.texi (Compilation): Add discussion of
--fresh-auto-compile.
* doc/ref/scheme-scripts.texi (Invoking Guile): Add --fresh-auto-compile
option.
* NEWS: Add entry.
* libguile/load.c: Define %fresh-auto-compile.
(scm_primitive_load_path): Use it here.
(scm_init_load_should_auto_compile): Init from GUILE_AUTO_COMPILE env
var, with a value of "fresh".
* module/ice-9/boot-9.scm (load-in-vicinity): Auto-compilation cache is
stale if %fresh-auto-compile is true.
* module/ice-9/command-line.scm (compile-shell-switches): Parse out
--fresh-auto-compile.
* module/ice-9/boot-9.scm (define-inlineable): Moved here from SRFI-9.
* module/srfi/srfi-9 (define-inlinable): Removed here.
* doc/ref/api-procedures.texi (Inlinable Procedures): Add subsection
about `define-inlinable'.
* module/ice-9/boot-9.scm (while): Report an error if `continue' is
passed one or more arguments. Previously, it would report an error if
`(continue arg rest ...)' was found within the `while', but not if
`continue' was found bare and later applied to one or more arguments,
e.g. `(apply continue (list arg rest ...))'.
* module/ice-9/boot-9.scm (module-use-interfaces!): Fix up to prevent
duplication in the use list of multiple incoming interfaces.
* test-suite/tests/modules.test ("module-use"): Add tests.
This fixes a problem with R6RS's `import' in particuliar: when importing
a subset of a library/module, the interface created for that purpose
inherits the name of the module it is derived from. The low-level
primitives that are used for importing would then disregard earlier
imports from the same module.
An example for this bug can be seen with the following library
definition:
(library (test-guile2)
(export foo)
(import (only (rnrs base) define)
(only (rnrs base) error))
(define (foo . args)
#t))
In the above, the import of `define' would be disregarded when `error'
is imported, thus leading to a syntax error, since `(foo . args)' is
treated as an application, since the binding of `define' would be not
present.
* module/ice-9/boot-9.scm (module-use!): Remove the filtering of the
existing imports of the module by name; a check for identity is
already done beforehand.
(module-use-interfaces!): Filter the existing imports by identity
instead of filtering them by their names.
* module/ice-9/boot-9.scm (scm-error-printer): Allow #f for rest args,
interpreting it as '(). Fixes regexp throws, which are of the form:
(regular-expression-syntax "make-regexp" "Invalid preceding regular expression" #f ("?.*"))
* module/ice-9/boot-9.scm (the-scm-module): Make it its own public
interface.
* test-suite/tests/modules.test ("foundations")["the-root-module",
"the-scm-module"]: New tests.
* module/ice-9/boot-9.scm (load-in-vicinity): New helper, loads a file
relative to a path.
(load): Turn into a macro that captures the name of the source file
being expanded, and dispatches to load-in-vicinity. Referencing
`load' by bare name returns a closure that embeds the current source
file name.
* libguile/backtrace.c (scm_print_exception): Add C binding for
print-exception, which dispatches to whatever is defined in Scheme.
(boot_print_exception): Add initial binding, replaced later in
Scheme.
* module/ice-9/boot-9.scm: Expect there to already be a print-exception
binding.
* module/ice-9/boot-9.scm (set-exception-printer!, print-exception):
Define an extensible exception-printing mechanism.
Also register printers for all keys thrown by Guile.
Inspired by a patch by Andreas Rottmann.
* libguile.h:
* libguile/Makefile.am:
* libguile/deprecated.h:
* libguile/deprecated.c:
* libguile/init.c:
* libguile/properties.c:
* libguile/properties.h: Deprecate the "primitive properties"
interface. It was only used to implement object properties, and that
is no longer the case.
* module/ice-9/boot-9.scm (make-object-property): Reimplement just in
terms of weak hash tables, and make threadsafe.
* NEWS:
* doc/ref/api-utility.texi: Update.
* module/ice-9/psyntax.scm (chi-top): When adding to the toplevel
environment at compile-time, default to undefined variables, not
variables defined to #f.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/boot-9.scm (module-add!): Add a new pre-modules version
of this function, so we can add variables the environment, not just
values.
(module-define!): Use module-add!.
* module/ice-9/boot-9.scm (define-module*): New procedure, like
process-define-modules but more structured.
(process-define-module): Reimplement in terms of define-module*.