I'm working on a #%module-begin variant that provides all module-level
bindings, and I'm having trouble finding the right way to give lexical
context to all-defined-out.

The issue (IIUC) is that all-defined-out only exports identifiers "that
have the same lexical context as the (all-defined-out) form"; however, I
want to have #%module-begin introduce all-defined-out, but have it export
the identifiers defined by the programmer in the body of the module.

Currently what I'm doing is essentially this:

#lang racket

(module lang racket
  (provide (except-out (all-from-out racket)
                       #%module-begin
                       provide
                       ;all-defined-out ;can't omit this
                       )
           (rename-out [providing-module-begin
                        #%module-begin]))
  (require (for-syntax syntax/parse))
  (define-syntax (providing-module-begin stx)
    (syntax-parse stx
      [(_ body:expr ...)
       #`(#%module-begin
          (provide #,(datum->syntax stx '(all-defined-out)))
          body ...)])))

(module demo (submod ".." lang)
  (define something
    "a value"))

(require (submod "." demo))

something


This almost works — the providing happens correctly — but it requires that
the lang module provide all-defined-out, which I don't actually want to be
otherwise available.

Is there a way to give all-defined-out the lexical context I'm looking for?

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to