summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Update NEWS for records and exceptions workwip-exceptionsAndy Wingo2019-11-142-3/+67
| | | | | * NEWS: Update. * doc/ref/api-data.texi (Records): Fix a typo.
* SRFI-18 uses core exceptionsAndy Wingo2019-11-144-104/+88
| | | | | | | | | | | | | | * 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.
* Update documentation for with-exception-handler et alAndy Wingo2019-11-135-596/+631
| | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Rebase throw/catch on top of raise-exception/with-exception-handlerAndy Wingo2019-11-1313-640/+1111
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Remove boot "catch" definition.Andy Wingo2019-11-071-5/+4
| | | | * libguile/throw.c (scm_init_throw): Remove boot definition of "catch".
* Move exceptions with key and args to coreAndy Wingo2019-11-072-7/+17
| | | | | | | | * module/ice-9/boot-9.scm (&exception-with-key-and-args) (&quit-exception): New definitions. * module/ice-9/exceptions.scm (make-guile-exception): (guile-exception?, guile-exception-key, guile-exception-args): Update definitions.
* Move the core of exception objects into coreAndy Wingo2019-11-072-86/+105
| | | | | | | | * module/ice-9/boot-9.scm (&exception, &compound-exception) (simple-exceptions, make-exception, exception?, exception-type?) (make-exception-type, exception-predicate, exception-accessor): Move these definitions into core, from (ice-9 exceptions). * module/ice-9/exceptions.scm: Re-export definitions from core.
* Move exception-handling routines after records in boot-9Andy Wingo2019-11-071-258/+261
| | | | | * module/ice-9/boot-9.scm: Move down definitions of catch, throw, and so on until they are after records.
* Move false-if-exception down in boot-9Andy Wingo2019-11-071-20/+27
| | | | * module/ice-9/boot-9.scm (false-if-exception): Move down.
* Move adapter between "throw" and "raise" exceptions into coreAndy Wingo2019-11-052-228/+223
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * module/ice-9/exceptions.scm (&guile): (default-guile-exception-converter): (guile-common-exceptions): (convert-guile-exception): (&raise-object-wrapper): (make-raise-object-wrapper): (raise-object-wrapper?): (raise-object-wrapper-obj): (raise-object-wrapper-continuation): (raise-exception): (raise-continuable): (with-exception-handler): (exception-printer): (format-exception): (format-simple-exception): (%exception): (guile-syntax-error-converter): (guile-lexical-error-converter): (guile-assertion-failure-converter): (guile-undefined-variable-error-converter): (guile-implementation-restriction-converter): (guile-external-error-converter): (guile-system-error-converter): (guile-exception-converters): (set-guile-exception-converter!): Move here, from (rnrs exceptions). * module/rnrs/exceptions.scm: Re-export bindings from (ice-9 exceptions).
* Rebase SRFI-35 on top of (ice-9 exceptions)Andy Wingo2019-11-042-179/+70
| | | | | * module/ice-9/exceptions.scm (exception-type?): New export. * module/srfi/srfi-35.scm: Rewrite in terms of (ice-9 exceptions).
* Add (ice-9 exceptions) moduleAndy Wingo2019-11-033-116/+283
| | | | | | | | | | | * 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).
* Add `record-type-has-parent?'.Andy Wingo2019-11-032-6/+8
| | | | | * module/ice-9/boot-9.scm (record-type-has-parent?): New function. * module/srfi/srfi-35.scm (condition-type?): Use it.
* Remove circularity in r6rs by rebasing conditions on core recordsAndy Wingo2019-10-304-202/+121
| | | | | | | | | | | | | | * 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.
* Rebase R6RS records on top of core recordsAndy Wingo2019-10-295-257/+183
| | | | | | | | | | | | | | | * 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.
* Add record-type-parent definition.Andy Wingo2019-10-291-0/+5
| | | | * module/ice-9/boot-9.scm (record-type-parent): New definition.
* Add support for immutable fields in core recordsAndy Wingo2019-10-283-8/+78
| | | | | | | | | * 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.
* Rename final? record type flag; add support for opaque?Andy Wingo2019-10-274-21/+51
| | | | | | | | | | | | | * module/ice-9/boot-9.scm (record-type-extensible?): Rename from record-type-final?, with the opposite sense. (record-type-opaque?): New accessor. (make-record-type): Change #:final? to #:extensible?, with the opposite meaning. Add #:opaque? arg. * test-suite/tests/records.test ("records"): Add opaque tests; update extensible tests. * doc/ref/api-data.texi (Records): Update. * module/srfi/srfi-35.scm (&condition, make-condition-type): Update for make-record-type API change.
* Guile `make-record-type' supports non-generative definitionAndy Wingo2019-10-273-24/+81
| | | | | | | * module/ice-9/boot-9.scm (prefab-record-types): New definition. (make-record-type): Add #:uid keyword. * test-suite/tests/records.test ("records"): Add tests. * doc/ref/api-data.texi (Records): Document #:uid
* Change record type "flags" field to "properties"Andy Wingo2019-10-272-11/+11
| | | | | | | | | * module/ice-9/boot-9.scm (record-type-properties): Rename from record-type-flags. (record-type-final?): New accessor. (make-record-type): (define-record-type): * test-suite/tests/records.test ("records"): Adapt.
* Fix one remaining use of make-record-type with string type nameAndy Wingo2019-10-231-1/+1
| | | | | * test-suite/tests/gc.test ("weak-values versus records"): Fix to pass a symbol.
* Rebase srfi-35 conditions on top of make-record-typeAndy Wingo2019-10-232-232/+136
| | | | | | | | | | | | | * 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.
* make-record-type does more validation on the fieldsAndy Wingo2019-10-233-15/+45
| | | | | | | | | | * 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.
* SRFI-9 uses make-record-typeAndy Wingo2019-10-231-12/+7
| | | | | * module/srfi/srfi-9.scm (%define-record-type): Use make-record-type, instead of rolling our own vtable. Shouldn't have any perf impact.
* Record accessors respect subtypingAndy Wingo2019-10-223-41/+108
| | | | | | | | | | | | * module/ice-9/boot-9.scm (make-record-type): Don't allow subtyping of final types. (%record-type-error): Remove helper. (record-accessor, record-modifier): Use computed record type predicate, to allow for subtyping. (define-record-type): Adapt to %record-type-error going away; these types are final so no accessor adaptation is needed. * test-suite/tests/records.test: Add tests. * doc/ref/api-data.texi (Records): Update.
* Allow records to be subtypedAndy Wingo2019-10-222-34/+98
| | | | | | | | | | | | | | | * module/ice-9/boot-9.scm (record-type-vtable): Add slots for "flags" and a parent vector. (record-type-name, record-type-fields): Move up in the file. (record-type-constructor, record-type-flags, record-type-parents): New accessors. (make-record-type): Take #:final? and #:parent keyword arguments. (record-constructor): Delegate to record-type-constructor. (record-predicate): For non-final types --types that can be extended by subtyping -- implement an O(1) type predicate. (define-record-type): Initialize the new fields. * module/srfi/srfi-9.scm (%define-record-type): Initialize flags and parent fields.
* Fix deprecated 1-arg `make-module' in testsAndy Wingo2019-10-221-2/+2
| | | | | * test-suite/tests/modules.test ("circular imports"): Use nullary make-module.
* Deprecate two-arg `record-constructor'Andy Wingo2019-10-221-11/+18
| | | | | * module/ice-9/boot-9.scm (record-constructor): Deprecate the two-arg form.
* Re-implement (ice-9 gap-buffer) records in terms of srfi-9Andy Wingo2019-10-221-38/+24
| | | | * module/ice-9/gap-buffer.scm (gap-buffer): Use srfi-9.
* Remove (ice-9 channel)Andy Wingo2019-10-212-171/+0
| | | | | | | * module/ice-9/channel.scm: Remove. This file has had a bug since 2.0 or so that prevented loading the module; I can only conclude that it hasn't worked for years. * module/Makefile.am (SOURCES): Remove ice-9/channel.scm.
* Refactor PEG recordsAndy Wingo2019-10-211-21/+20
| | | | | | | * module/ice-9/peg/using-parsers.scm (prec): Use SRFI-9 to define PEG record types. (peg:start, peg:end, peg:string, peg:tree, peg:substring): Implement in a more efficient way.
* Extend `import' to allow R7RS-style srfi referencesAndy Wingo2019-09-271-7/+15
| | | | | * module/ice-9/r6rs-libraries.scm (resolve-r6rs-interface): Allow for srfis to be accessed via (srfi 42 foo) in addition to (srfi :42 foo).
* (ice-9 safe-r5rs) fixes for bound aux syntaxAndy Wingo2019-09-272-129/+214
| | | | | | | | * module/ice-9/safe-r5rs.scm: Define local versions of `case' and `cond' that assume aux syntax is unbound. If this doesn't work, we can switch to exporting aux syntax. * module/ice-9/top-repl.scm (top-repl): Don't add (ice-9 r5rs) to the REPL environment.
* (ice-9 null) also exports aux syntax, syntax-rulesAndy Wingo2019-09-271-13/+16
| | | | * module/ice-9/null.scm: Add more syntactic exports.
* Deprecate passing a non-zero size to make-moduleAndy Wingo2019-09-278-27/+29
| | | | | | | | | | | | | * module/ice-9/boot-9.scm (make-module): Issue a deprecation warning if users pass a non-zero size. (nested-define-module!, make-modules-in, beautify-user-module!) (resolve-interface, make-autoload-interface, %cond-expand-table): * module/ice-9/popen.scm (port/pid-table): * module/ice-9/session.scm (make-fold-modules): * module/language/ecmascript/function.scm (*program-wrappers*): * module/scripts/api-diff.scm (read-api-alist-file): * module/srfi/srfi-10.scm (reader-ctors): Update callers. Also remove some make-hash-table sizes.
* (ice-9 null) also re-exports core aux syntaxAndy Wingo2019-09-271-2/+2
| | | | * module/ice-9/null.scm: Re-export _, else, =>, and the ellipsis.
* Avoid mutating arguments to resolve-interfaceAndy Wingo2019-09-271-23/+28
| | | | | | * module/ice-9/boot-9.scm (resolve-interface): This function used to mutate the #:hide argument, which results in terrorism if the value is a literal.
* Remove "vm" testsAndy Wingo2019-09-2724-422/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | These tests are no longer useful. * configure.ac: * test-suite/Makefile.am: Remove mentions. * test-suite/vm/Makefile.am: * test-suite/vm/run-vm-tests.scm: * test-suite/vm/t-basic-contructs.scm: * test-suite/vm/t-call-cc.scm: * test-suite/vm/t-catch.scm: * test-suite/vm/t-closure.scm: * test-suite/vm/t-closure2.scm: * test-suite/vm/t-closure3.scm: * test-suite/vm/t-closure4.scm: * test-suite/vm/t-do-loop.scm: * test-suite/vm/t-global-bindings.scm: * test-suite/vm/t-literal-integers.scm: * test-suite/vm/t-macros.scm: * test-suite/vm/t-macros2.scm: * test-suite/vm/t-map.scm: * test-suite/vm/t-match.scm: * test-suite/vm/t-mutual-toplevel-defines.scm: * test-suite/vm/t-or.scm: * test-suite/vm/t-proc-with-setter.scm: * test-suite/vm/t-quasiquote.scm: * test-suite/vm/t-records.scm: * test-suite/vm/t-values.scm: Remove.
* Adapt ftw.test for pending test-suite changesAndy Wingo2019-09-271-1/+1
| | | | | * test-suite/tests/ftw.test ("file-system-fold"): Check "standalone" instead of "vm".
* Fix doc syntax errorAndy Wingo2019-09-271-1/+1
| | | | * doc/ref/r6rs.texi (R6RS Incompatibilities): Fix syntax error.
* Better R6RS compatibilityAndy Wingo2019-09-272-1/+7
| | | | | | | * module/ice-9/boot-9.scm (install-r6rs!): Also enable `hungry-eol-escapes'. * doc/ref/r6rs.texi (R6RS Incompatibilities): Document lack of unicode escapes in symbols.
* Add --r6rs NEWSAndy Wingo2019-09-251-0/+7
| | | | * NEWS: Add --r6rs news.
* Add --r6rs command-line optionAndy Wingo2019-09-253-2/+17
| | | | | | | | * doc/ref/guile-invoke.texi (Command-line Options): Document --r6rs. * doc/ref/r6rs.texi (R6RS Incompatibilities): Mention that --r6rs calls install-r6rs!. * module/ice-9/command-line.scm (*usage*, compile-shell-switches): Implement --r6rs.
* New function: install-r6rs!Andy Wingo2019-09-252-0/+26
| | | | | * doc/ref/r6rs.texi (R6RS Incompatibilities): Document install-r6rs!. * module/ice-9/boot-9.scm (install-r6rs!): New function.
* Update NEWS for 2.9.5Andy Wingo2019-09-191-30/+44
| | | | * NEWS: Update.
* Add documentation for else, =>, _, ... aux syntaxAndy Wingo2019-09-191-0/+20
| | | | * doc/ref/api-macros.texi (Syntax Rules): Document aux syntax.
* Define top-level bindings for aux syntax: else, =>, _, ...Andy Wingo2019-09-124-4/+21
| | | | | | | | | * module/ice-9/boot-9.scm (else, =>, ..., _): New definitions. These are specified by the r6rs and the r7rs. * module/ice-9/sandbox.scm (core-bindings): Include the aux syntax definitions. * module/rnrs/base.scm: * module/rnrs.scm: Re-export aux syntax.
* Use "G_" as the conventional alias for gettextAndy Wingo2019-09-124-27/+32
| | | | | | | | | | | | | | Since the change in 2.2 noted in the NEWS as "Fix literal matching for module-bound literals", defining `_' makes `syntax-rules' and `match' fail to recognize `_' as the catch-all literal. This change adapts the recommendations to current practice in 2.2, as users have had to adapt to this change. * doc/ref/api-i18n.texi (Gettext Support): Update documentation. * module/language/tree-il/analyze.scm (proc-ref?, gettext?): G_ is the conventional abbreviation, not _. * test-suite/tests/tree-il.test: Adapt. * module/ice-9/command-line.scm: Use G_ instead of _.
* Optimize fixnum or s64 -> f64 conversionsAndy Wingo2019-09-0113-5/+96
| | | | | | | | | | | | | | | | | | | | | * libguile/intrinsics.c (scm_bootstrap_intrinsics): * libguile/intrinsics.h (SCM_FOR_ALL_VM_INTRINSICS): Add "inexact" intrinsic. * libguile/jit.c (compile_s64_to_f64): New compiler. * libguile/vm-engine.c (s64->f64): New instruction. * module/language/cps/effects-analysis.scm (heap-numbers-equal?): * module/language/cps/reify-primitives.scm (compute-known-primitives): * module/language/cps/slot-allocation.scm (compute-var-representations): * module/language/cps/specialize-numbers.scm (fixnum->f64): (specialize-operations): * module/language/cps/type-fold.scm (scm->f64, inexact): * module/language/cps/types.scm (inexact, s64->f64): * module/language/tree-il/cps-primitives.scm (exact->inexact): * module/language/tree-il/primitives.scm (*interesting-primitive-names*): (*effect-free-primitives*): * module/system/vm/assembler.scm: Recognize exact->inexact as a primitive, and optimize it. Add compiler support for new "inexact" and "s64->f64" primcalls.
* Have disassemble-file accept an optional output portDaniel Llorens2019-08-291-2/+2
| | | | * module/system/vm/disassembler.scm (disassemble-file): As stated.