(Caveat: I know the sandbox evaluator exists. I'm trying to understand
how to do this without it, to understand the evaluation machinery for
something.)
Let's say I write "#lang foo". For whatever reason, I have programs
that are coming in from users that are not necessarily being saved
to a file on disk... they may be coming from a GUI, read over the
network, etc etc. The only important thing is that at the end of the
program, the last expression returns some value, and I want access to
that value. Simplest example, let's say we have the following program
```
#lang foo
(define bar 1)
(+ bar 2)
```
I'd like to read this in and evaluate it, so presumably I'd want to get
3 returned.
I've tried to figure out how to do this from trivial examples but I'm
not having success. I can see that I can read in a module:
```
racket-sandbox.rkt> (parameterize ([read-accept-reader #t])
(call-with-input-string "#lang racket/base
(+ 1 2)"
(lambda (ip)
(read-syntax 'foo ip))))
#<syntax:foo::7 (module anonymous-module racket/base (#%module-begin (+ 1 2)))>
```
Cool, ok.
But when I pass this module-wrapped structure to eval, the result is void.
What should I do? Help appreciated!
--
You received this message because you are subscribed to the Google Groups
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/racket-users/8736exhzh8.fsf%40dustycloud.org.