Ah, that is actually not true. The `doc` relies on "pollen.rkt", but the `metas` do not, because they live in an independent submodule. See [1]. This is deliberate, so you can fetch the metas quickly, without the overhead of running "pollen.rkt". The side effect is that there is no circular dependency.
But you still need to pass the metas to the `foo` function somehow. Of course, you can do this explicitly ...
◊foo2[metas]{bar}
... but it's sleeker to use a macro. Here's one way to do it:
;; pollen.rkt
#lang racket/base
(provide (all-defined-out))
(require (for-syntax racket/base) pollen/file sugar/file pollen/core)
;; if this macro doesn't make sense I will elaborate
(define-syntax (foo2 stx)
(syntax-case stx ()
[(_ ARG ...)
(with-syntax ([METAS (datum->syntax stx 'metas)])
#'(do-foo2 (select-from-metas 'here-path METAS) ARG ...))]))
(define (do-foo2 here-path . xs)
(define ext (string->symbol (get-ext (->output-path here-path))))
(case ext
[(atom) 'do-atom-foo2]
[else 'do-html-foo2]))
> '(root do-atom-foo2 "\n")