I'm working on building a standalone executable for a #lang that can be 
used in two ways:

1. foo awesome.foo: execute file awesome.foo, which is written in #lang foo

2. foo (no arguments): fire up a REPL. Expressions are to be written in the 
foo language.

I can get (1) to work, after wrestling with raco exe (using ++lang) and 
raco distribute (using ++collects-copy). An invocation that works for me is:

### begin script snippet

raco exe ++lang foo ++lang racket/base ++lang brag foo.rkt

# copy the source code of foo into collects/foo
mkdir -p collects/foo

find . -mindepth 1 -maxdepth 1 -name '*.rkt' -exec cp {} collects/foo ';'

raco distribute ++collects-copy collects dist foo

### end script snippet

This works for making a standalone executable that can exectute foo 
programs specified on the command line, but doesn't work for a REPL. The 
difficulty seems to be the `namespace-require` part of `run-repl`, defined 
like this:

````
(define (run-repl)
  (parameterize ([current-namespace (make-base-empty-namespace)])
    (namespace-require 'foo/expander)
    (read-eval-print-loop)))
````

When I invoke the executable with no arguments, `run-repl` gets called. But 
this leads to:

````
standard-module-name-resolver: collection not found
  for module path: racket/base/lang/reader
  collection: "racket/base/lang"
````

expander.rkt in foo is written in racket/base, so I suppose that's what 
triggers the issue.

My question, crudely put, is: How do I "embed" racket/base so that I can 
use `namespace-require` as seen in `run-repl`? (I assume namespace-require 
is what I need; if that's wrong, please do correct me.) It appears that 
++lang racket/base bit in raco exe isn't enough. A related question about 
raco exe is: if racket/base isn't available, what *is* available?



-- 
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/4c9c1881-61bb-4e84-a80d-4b3d9e9affd4%40googlegroups.com.

Reply via email to