diff --git a/README.md b/README.md index 46953c69f..c9eb3c136 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ Procedures for each standard are provided by the following R7RS-style libraries: cmake -B build -DCMAKE_BUILD_TYPE=Release cd build make package -sudo apt install build/meevax_0.5.194_amd64.deb +sudo apt install build/meevax_0.5.195_amd64.deb ``` or @@ -122,9 +122,9 @@ sudo rm -rf /usr/local/share/meevax | Target Name | Description |-------------|------------- -| `all` | Build shared-library `libmeevax.0.5.194.so` and executable `meevax` +| `all` | Build shared-library `libmeevax.0.5.195.so` and executable `meevax` | `test` | Test executable `meevax` -| `package` | Generate debian package `meevax_0.5.194_amd64.deb` +| `package` | Generate debian package `meevax_0.5.195_amd64.deb` | `install` | Copy files into `/usr/local` directly ## Usage diff --git a/VERSION b/VERSION index 5d6f8881c..7b0121fc8 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.5.194 +0.5.195 diff --git a/include/meevax/kernel/dynamic_environment.hpp b/include/meevax/kernel/dynamic_environment.hpp index 8dcf56e03..444bd72f1 100644 --- a/include/meevax/kernel/dynamic_environment.hpp +++ b/include/meevax/kernel/dynamic_environment.hpp @@ -56,24 +56,24 @@ inline namespace kernel std::array a; /* - raise is a one-argument procedure for propagating C++ exceptions thrown - in the Meevax kernel to the exception handler of the language running on - the Meevax kernel. + exception_handler is a one-argument procedure for propagating C++ + exceptions thrown in the Meevax kernel to the exception handler of the + language running on the Meevax kernel. - raise is set to null by default. In this default state, that is, if raise - is null, C++ exceptions thrown in the kernel are rethrown to the outer - environment. + exception_handler is set to null by default. In this default state, that + is, if exception_handler is null, C++ exceptions thrown in the kernel + are rethrown to the outer environment. - Although raise can be set to any one-argument procedure by procedure - `kernel-exception-handler-set!`, it is basically assumed to be set to - R7RS Scheme's standard procedure `raise`. + Although exception_handler can be set to any one-argument procedure by + procedure `kernel-exception-handler-set!`, it is basically assumed to be + set to R7RS Scheme's standard procedure `raise`. */ - let static inline raise = nullptr; + let static inline exception_handler = nullptr; template - auto apply(object const& f, Ts&&... xs) -> decltype(auto) + auto apply(object const& procedure, Ts&&... xs) -> decltype(auto) { - s = list(f, list(std::forward(xs)...)); + s = list(procedure, list(std::forward(xs)...)); e = nullptr; c = list(make(instruction::call), make(instruction::stop)); @@ -94,9 +94,9 @@ inline namespace kernel return run(); } - auto reraise(object const& x) -> decltype(auto) + auto raise(object const& x) -> decltype(auto) { - return raise.is() ? throw x : apply(raise, x); + return exception_handler.is() ? throw x : apply(exception_handler, x); } auto run() -> object @@ -119,17 +119,9 @@ inline namespace kernel * * ----------------------------------------------------------------- */ assert(cadr(c).template is()); - - if (let const& x = cdadr(c); x == undefined) - { - throw error(make("undefined variable"), caadr(c)); - } - else - { - s = cons(x, s); - c = cddr(c); - goto fetch; - } + s = cons(cdadr(c), s); + c = cddr(c); + goto fetch; case instruction::load_relative: /* ------------------------------------ * @@ -527,11 +519,11 @@ inline namespace kernel } catch (error const& error) { - return reraise(make(error)); + return raise(make(error)); } catch (std::exception const& exception) { - return reraise(make(make(exception.what()))); + return raise(make(make(exception.what()))); } } }; diff --git a/src/kernel/boot.cpp b/src/kernel/boot.cpp index 50f050cf8..c6f9e2104 100644 --- a/src/kernel/boot.cpp +++ b/src/kernel/boot.cpp @@ -398,7 +398,7 @@ inline namespace kernel library.define("kernel-exception-handler-set!", [](let const& xs) { - environment::raise = car(xs); + environment::exception_handler = car(xs); }); });