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.

On Sun, Nov 10, 2019, 4:44 PM Christopher Lemmer Webber <
cweb...@dustycloud.org> wrote:

> 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 player-name)))
>
> (define (entrypoint read-save-file)
>   (make-keyword-procedure
>    (lambda (kws kw-args method-name . args)
>      (define method
>        (case method-name
>          ['start-game (make-start-game read-save-file)]
>          ['what-is-make-start-game (lambda () make-start-game)]
>          ['throw-error
>           (lambda ()
>             (error "oh no :("))]
>          [else (error "owch!")]))
>      (keyword-apply method kws kw-args args))))
>
> (provide entrypoint)
> ```
>
> It seems I'm able to read things in:
>
> ```
> read-example.rkt> (parameterize ([current-namespace
>                                    (module->namespace 'racket/base)]
>                                   [read-accept-reader #t])
>                      (define stx
>                        (call-with-input-file "example1.rkt"
>                          (lambda (ip)
>                            (read-syntax 'my-module ip))))
>                      (eval stx)
>                      (eval '(require 'example1))
>                      (dynamic-require ''example1 'entrypoint))
> #<procedure:entrypoint>
> ```
>
> I know that's kludgy, but it seems closer to being on track.  Thanks to
> everyone who has responded.
>
> --
> 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 racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/87sgmvh0dr.fsf%40dustycloud.org
> .
>

-- 
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 racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAE8gKofVBFEgZGeVEdKE4-gi3j-Bca4j7%2BMEx3qgu6Q9L2A71w%40mail.gmail.com.

Reply via email to