mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-18 21:29:19 +02:00
Add more specific warning for error on no import, clarify docs.
This commit is contained in:
parent
97a04bd2fc
commit
29dd1a3b81
3 changed files with 23 additions and 2 deletions
|
@ -136,6 +136,8 @@ documentation system described in
|
||||||
build this manual. \ccode{chibi-ffi} is a tool to build wrappers for
|
build this manual. \ccode{chibi-ffi} is a tool to build wrappers for
|
||||||
C libraries, described in the FFI section below.
|
C libraries, described in the FFI section below.
|
||||||
|
|
||||||
|
See the examples directory for some sample programs.
|
||||||
|
|
||||||
\section{Default Language}
|
\section{Default Language}
|
||||||
|
|
||||||
\subsection{Scheme Standard}
|
\subsection{Scheme Standard}
|
||||||
|
@ -231,6 +233,15 @@ These forms perform basic selection and renaming of individual
|
||||||
identifiers from the given module. They may be composed to perform
|
identifiers from the given module. They may be composed to perform
|
||||||
combined selection and renaming.
|
combined selection and renaming.
|
||||||
|
|
||||||
|
Note while the repl provides default bindings as a convenience,
|
||||||
|
programs have strict semantics as in R7RS and must start with at least
|
||||||
|
one import, e.g.
|
||||||
|
|
||||||
|
\schemeblock{
|
||||||
|
(import (scheme base))
|
||||||
|
(write-string "Hello world!\n")
|
||||||
|
}
|
||||||
|
|
||||||
Some modules can be statically included in the initial configuration,
|
Some modules can be statically included in the initial configuration,
|
||||||
and even more may be included in image files, however in general
|
and even more may be included in image files, however in general
|
||||||
modules are searched for in a module load path. The definition of the
|
modules are searched for in a module load path. The definition of the
|
||||||
|
|
11
eval.c
11
eval.c
|
@ -45,7 +45,9 @@ void sexp_warn (sexp ctx, const char *msg, sexp x) {
|
||||||
if (sexp_oportp(out)) {
|
if (sexp_oportp(out)) {
|
||||||
sexp_write_string(ctx, strictp ? "ERROR: " : "WARNING: ", out);
|
sexp_write_string(ctx, strictp ? "ERROR: " : "WARNING: ", out);
|
||||||
sexp_write_string(ctx, msg, out);
|
sexp_write_string(ctx, msg, out);
|
||||||
sexp_write(ctx, x, out);
|
if (x != SEXP_UNDEF) {
|
||||||
|
sexp_write(ctx, x, out);
|
||||||
|
}
|
||||||
sexp_write_char(ctx, '\n', out);
|
sexp_write_char(ctx, '\n', out);
|
||||||
if (strictp) sexp_stack_trace(ctx, out);
|
if (strictp) sexp_stack_trace(ctx, out);
|
||||||
}
|
}
|
||||||
|
@ -1100,8 +1102,13 @@ static sexp analyze (sexp ctx, sexp object, int depth, int defok) {
|
||||||
} else if (sexp_idp(sexp_car(x))) {
|
} else if (sexp_idp(sexp_car(x))) {
|
||||||
if (! cell) {
|
if (! cell) {
|
||||||
res = analyze_app(ctx, x, depth);
|
res = analyze_app(ctx, x, depth);
|
||||||
if (sexp_exceptionp(res))
|
if (sexp_exceptionp(res)) {
|
||||||
sexp_warn(ctx, "exception inside undefined operator: ", sexp_car(x));
|
sexp_warn(ctx, "exception inside undefined operator: ", sexp_car(x));
|
||||||
|
/* the common case of no imports */
|
||||||
|
if (!sexp_env_parent(sexp_context_env(ctx))) {
|
||||||
|
sexp_warn(ctx, "did you forget to import a language? e.g. (import (scheme base))", SEXP_UNDEF);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
op = sexp_cdr(cell);
|
op = sexp_cdr(cell);
|
||||||
if (sexp_corep(op)) {
|
if (sexp_corep(op)) {
|
||||||
|
|
3
examples/hello.scm
Normal file
3
examples/hello.scm
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
(import (scheme base))
|
||||||
|
|
||||||
|
(write-string "Hello world!\n")
|
Loading…
Add table
Reference in a new issue