Re: CRUNCH in CHICKEN issues

Felix Winkelmann via Chicken-users <[email protected]>
Newsgroups gmane.lisp.scheme.chicken
Message-ID <[email protected]>
On Sun Oct 19, 2025 at 9:56 PM CEST, Diogo via Chicken-users wrote:
>
> I am trying to embed crunch modules in test cases written in chicken like this:
>
>     ; test.scm
>     (import (scheme base) test crunch)
>     (crunch (include "something-in-crunch.scm"))
>     (import something-in-crunch)
>     ; chicken tests ...
>
> But that fails. Here is a minimal example showing the issue:
>
>[...]
>
> The symbol foo is being exported in the module crunch-example, why can't I
> access it in the top level? Am I missing something?

The mapping of exported toplevel names inside crunched code to
qualified names in the outer Scheme environment is a bit tricky
and may be buggy, I'll investigate this. In the meantime you can
move the crunching into the module, as a workaround, which is
also (IMHO) somewhat more in the style as this is intended to be
used:

(module crunch-example (foo)
  (import (scheme base))
  (import (crunch))
  (crunch (define (foo) 123)))

(import (scheme write))
(import crunch-example)
(display (foo))
(newline)

> (error ...) does not do what I'd expect. Consider this example:

As siiky pointed out, the argument must be a string. I will clarify
this in the docs.

> The option -emit-wrappers is not working. The case in `crunch-driver.scm` seems
> to have a weird form, so I changed it as follows:

Indeed, that code is buggy, thanks for reporting this.


cheers,
felix
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.