diff --git a/main-helper.rkt b/main-helper.rkt index 91b8fd8..b82bc80 100644 --- a/main-helper.rkt +++ b/main-helper.rkt @@ -4,20 +4,10 @@ (require (for-syntax racket/rerequire pollen/tools pollen/world)) (require pollen/tools pollen/world) -(provide (except-out (all-defined-out) top~) - (rename-out (top~ #%top))) +(provide (all-defined-out)) (module+ test (require rackunit)) -(define-syntax-rule (top~ . id) - (λ x `(id ,@x))) - -(define-syntax (bound/c stx) - (syntax-case stx () - [(_ x) - (if (identifier-binding #'x ) - #'x - #'(#%top . x))])) (define-for-syntax (put-file-in-require-form file) `(file ,(->string file))) diff --git a/main-imports.rkt b/main-imports.rkt index 582f81d..c329d3d 100644 --- a/main-imports.rkt +++ b/main-imports.rkt @@ -4,13 +4,14 @@ ;; so they can be imported into the render.rkt namespace ;; and cached for the benefit of the render eval function. - (require racket/list pollen/tools pollen/main-helper + pollen/top (only-in pollen/ptree ptree-source-decode path->pnode ptree?)) (provide (all-from-out racket/list pollen/tools pollen/main-helper + pollen/top pollen/ptree)) \ No newline at end of file diff --git a/main.rkt b/main.rkt index ddd8acd..6949cc7 100644 --- a/main.rkt +++ b/main.rkt @@ -22,7 +22,11 @@ (module pollen-inner pollen/lang/doclang2_raw ;; use same requires as top of main.rkt ;; (can't import them from surrounding module due to submodule rules) - (require pollen/tools pollen/main-helper) + ;; todo: how to keep these two lists in sync? + ;; and why doesn't this work: + ;; (require pollen/main-imports) + ;; (provide (all-from-out pollen/main-imports)) + (require pollen/tools pollen/main-helper pollen/top pollen/ptree) (require-and-provide-extras) ; brings in the project require files expr ... ; body of module diff --git a/render.rkt b/render.rkt index b2a81ec..f17102a 100644 --- a/render.rkt +++ b/render.rkt @@ -350,7 +350,8 @@ ;; for include-template (used below) (require web-server/templates) ;; for ptree navigation functions, and template commands - (require pollen/debug pollen/ptree pollen/template pollen/main-helper) + ;; todo: main-helper is here for #%top and bound/c — should they go elsewhere? + (require pollen/debug pollen/ptree pollen/template pollen/top) ;; import source into eval space. This sets up main & metas (require ,(->string source-name)) (parameterize ([current-ptree (make-project-ptree ,PROJECT_ROOT)] diff --git a/top.rkt b/top.rkt new file mode 100644 index 0000000..27d65a2 --- /dev/null +++ b/top.rkt @@ -0,0 +1,14 @@ +#lang racket + +(provide (except-out (all-defined-out) top~) + (rename-out (top~ #%top))) + +(define-syntax-rule (top~ . id) + (λ x `(id ,@x))) + +(define-syntax (bound/c stx) + (syntax-case stx () + [(_ x) + (if (identifier-binding #'x ) + #'x + #'(#%top . x))]))