Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check:mode and check:proc are unbound #7

Closed
diamond-lizard opened this issue Nov 19, 2020 · 0 comments
Closed

check:mode and check:proc are unbound #7

diamond-lizard opened this issue Nov 19, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@diamond-lizard
Copy link
Owner

When running the simplest of tests, like (check (+ 1 1) => 2), I get an error:

Error: unbound variable: check:mode

	Call history:

	<eval>	  (chicken.load#load-extension (##core#quote srfi-78) (##core#quote (srfi-78#)) (##core#quote require)...
	<syntax>	  (include "srfi-78-tests.scm")
	<syntax>	  (##core#include "srfi-78-tests.scm" #f)
	<syntax>	  (##core#begin (check (+ 1 1) => 2))
	<syntax>	  (check (+ 1 1) => 2)
	<syntax>	  (##core#if (>=74 check:mode75 1) (check:proc76 (quote77 (+ 1 1)) (lambda78 () (+ 1 1)) equal?71 2))
	<syntax>	  (>=74 check:mode75 1)
	<syntax>	  (check:proc76 (quote77 (+ 1 1)) (lambda78 () (+ 1 1)) equal?71 2)
	<syntax>	  (quote77 (+ 1 1))
	<syntax>	  (##core#quote (+ 1 1))
	<syntax>	  (lambda78 () (+ 1 1))
	<syntax>	  (##core#lambda () (+ 1 1))
	<syntax>	  (##core#begin (+ 1 1))
	<syntax>	  (+ 1 1)
	<syntax>	  (##core#undefined)
	<eval>	  (>=74 check:mode75 1)	<--

The fix is to (export (check check:mode).

After that, a chicken complains that check:proc is unbound, and there's a similar fix for that: (export (check check:proc))

It is important to do an (export (check check:mode)), which is called an "indirect export", rather than doing a simple (export check:mode), because the latter breaks encapsulation by allowing external access to the check:mode variable, while the former does not.

@diamond-lizard diamond-lizard added the bug Something isn't working label Nov 19, 2020
diamond-lizard pushed a commit that referenced this issue Nov 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant