Non-strict top-level identifier matching now works if the identifier

is bound in only one of the environments.  This is necessary in the
case where a library uses an unbound keyword (e.g. "with" in (chibi
loop)), but you want to use it along with a binding for the
keyword (e.g. "with" in (chibi show)).  The alternative to work with
the current logic is to always require such keywords to be bound, in
this case to add a dummy "with" auxiliary syntax binding to (chibi
loop), however this doesn't seem any safer than the new logic, and the
whole point of the feature is convenience.  Fixes issue #221.
This commit is contained in:
Alex Shinn 2015-04-25 10:56:58 +09:00
parent 82bc3b931f
commit 2e481d57e9

7
eval.c
View file

@ -619,9 +619,10 @@ sexp sexp_identifier_eq_op (sexp ctx, sexp self, sexp_sint_t n, sexp e1, sexp id
if ((id1 == id2) if ((id1 == id2)
&& ((!cell1 && !cell2) && ((!cell1 && !cell2)
#if !SEXP_USE_STRICT_TOPLEVEL_BINDINGS #if !SEXP_USE_STRICT_TOPLEVEL_BINDINGS
|| ((cell1 && cell2) || ((!cell1 || (!sexp_lambdap(sexp_cdr(cell1)) &&
&& (!sexp_lambdap(sexp_cdr(cell1)) && !sexp_env_cell_syntactic_p(cell1)) !sexp_env_cell_syntactic_p(cell1))) &&
&& (!sexp_lambdap(sexp_cdr(cell2)) && !sexp_env_cell_syntactic_p(cell2))) (!cell2 || (!sexp_lambdap(sexp_cdr(cell2)) &&
!sexp_env_cell_syntactic_p(cell2))))
#endif #endif
)) ))
return SEXP_TRUE; return SEXP_TRUE;