Jay McCarthy writes:
> I feel like I might not understand what you want, but it feels like
> you just want to use `make-module-evaluator` from `racket/sandbox`:
>
> ```
> #lang racket/base
> (require racket/sandbox)
>
> (define (read-script s)
> (((make-module-evaluator s) 'script) 5))
>
> (modu
Don't forget to handle multiple value return. What will you do if the last
line in the file is (values a b)?
Also, side effects. Do you care if someone includes a print/write/display
statement? You mentioned that the code would be safe, so presumably
tcp-connect and sqlite3-connect are not issues.
I feel like I might not understand what you want, but it feels like
you just want to use `make-module-evaluator` from `racket/sandbox`:
```
#lang racket/base
(require racket/sandbox)
(define (read-script s)
(((make-module-evaluator s) 'script) 5))
(module+ test
(read-script
"#lang racket/
Hey Eric! Thanks, I'll try to soak in this a bit tomorrow. :)
Eric Griffis writes:
> This works:
>
> 1. mkdir foo; cd foo; raco pkg install
>
> 2. create foo/main.rkt:
>
> ```
> #lang racket/base
>
> (module reader racket/base
> (require racket/port)
> (provide (rename-out [foo-read read]
>
This works:
1. mkdir foo; cd foo; raco pkg install
2. create foo/main.rkt:
```
#lang racket/base
(module reader racket/base
(require racket/port)
(provide (rename-out [foo-read read]
[foo-read-syntax read-syntax]))
(define (foo-read port)
`(module ,(gensym 'foo)
Well, I think I figured out how to get further:
with example1.rkt being:
```
#lang racket/base
;; #lang dungeon/misery
(define ((make-start-game read-save-file) player-name)
(list 'running-this-read-save-file: read-save-file
'on-player-name: player-name
'result: (read-save-file
Hi Eric! Thanks very much for the reply.
Eric Griffis writes:
>> It appears there must be; when I look at `build-program` in
>> sandbox.rkt it also looks like it's wrapping things in a module
>> structure... but I don't see how it then exports from that module or
>> how the code evaluating it im
On Sun, Nov 10, 2019 at 6:45 AM Christopher Lemmer Webber <
cweb...@dustycloud.org> wrote:
>
> It sounds like what I want is the case of the export.
I'll run with this.
> I guess a question remaining then is: if I'm doing this kind of dynamic
> import of the module, is there a way to require from
Christopher Lemmer Webber writes:
> I guess a question remaining then is: if I'm doing this kind of dynamic
> import of the module, is there a way to require from it (especially if
> it isn't assigned to a "filename" on disk?). It appears there must be;
> when I look at `build-program` in sandbox
Thanks Jay for the helpful response as usual Jay; I really do appreciate
it.
It sounds like what I want is the case of the export. I think I can
figure out how to modify the #%module-begin to do that.
I guess a question remaining then is: if I'm doing this kind of dynamic
import of the module, i
Modules don't evaluate to values. They have effects and they have
exported symbols. If you want to observe the evaluation of your
language's module, you'll have to look at one of those two things.
Both are used by existing Racket languages and infrastructure: `raco
test` relies on test modules maki
11 matches
Mail list logo