Hello Racketeers,

it seemed to me that writing a data format for my project by simply
introducing a new syntax forms and then just eval'uating the file (maybe
eval-syntax) was a great idea. I've done things like that many times but
my initial bindings were always in a separate file. Like:

==== sandbox.rkt
#lang racket/base
(provide #%app #%datum test)
(define (test) (displayln 'test))
====

Then a simple example looks like:

(parameterize ((current-namespace (make-base-empty-namespace)))
  (namespace-require "sandbox.rkt")
  (eval '(test)))

Easy and works without a flaw.

If I however try to achieve the same goal using module form within my
module, it always fails:

(module sandbox racket/base
  (provide #%app #%datum test)
  (define (test) (displayln 'test)))
(parameterize ((current-namespace (make-base-empty-namespace)))
  (namespace-require ''sandbox)
  (eval '(test)))

It fails with:

require: unknown module
  module name: 'm

Of course, without double-quoting, it yields:

standard-module-name-resolver: collection not found
  for module path: m
  collection: "m"
...

Which is expected. And require'ing the module doesn't change a thing (of
course, (require 'm) require's it in the surrounding module).

After going through the modules and namespaces documentation back and
forth I feel like I am overlooking something.

Roughly the goal is to define a bunch of structs in the encapsulating
module, provide syntax to the evaluation namespace, evaluate the file
with data and get the result.

Any hint would be very appreciated.


Cheers,
Dominik

-- 
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/100b00a9-33bd-1b82-a3ec-afef7d3d8fe1%40trustica.cz.

Reply via email to