`raco exe ++lang pollen`?

Let’s say I have a source file like this:

#lang racket
(require racket/runtime-path pollen/core)
(define-runtime-path html-pm "index.html.pm")
(displayln (get-core html-pm))

If I compile this using raco exe, with ++lang pollen or ++lang pollen/markup supplied, an exception will be raised.

raco exe: cannot extract module language
  language: pollen
  info field not available: 'module-language

I’ve read part of source codes of the pollen project. It seems to me that the pollen language implements a reader submodule initialized with racket/base. But I wonder if the language’s reader implements a get-info function that supports the 'module-language key, which is used by raco exe according to the documentation, and how I can make this work properly.

I haven’t used raco exe at all but I pushed an update with a 'module-language key with value pollen, and your example seems to work now.

1 Like

I’ve successfully built the executable now. But I get another exception when I try running the executable.

$ ./test
.../private/reader-base.rkt:57:20: collection not found
  for module path: pollen/private/runtime-config
  collection: "pollen/private"
  in collection directories:
  compilation context...:
   .../private/cm-minimal.rkt:696:0: compile-zo*
   .../private/cm-minimal.rkt:441:12: build
   .../private/cm-minimal.rkt:412:0: maybe-compile-zo
   .../private/cm-minimal.rkt:210:0: compile-root
   .../private/cache-utils.rkt:67:0: path->hash
   .../private/cache-utils.rkt:124:2: generate-dest-file
   .../file/cache.rkt:63:2: fetch-and-continue
   .../private/cache-utils.rkt:114:0: cache-ref!
   .../private/more-scheme.rkt:377:2: hash-ref!
   .../pollen/cache.rkt:39:4: cached-require-base
   body of '#%mzc:test

I’m afraid I have no idea. I’ve never used raco exe.

I read again the documentation of raco exe ++lang and I think we can simply do the same thing as syntax/module-reader.

The language-module identifier is bound to the module-path that is used for the read module’s language as written directly or as determined through #:language.

The default-filtering function passed to the #:info function is intended to provide support for information that syntax/module-reader can provide automatically. Currently, it recognizes only the 'module-language key, for which it returns language-module; it returns the given default value for any other key.

As I understand it, pollen is not used as the read module’s language (namely, the expander handling the syntax object produced by the reader), according to the result of raco expand and the code in reader-base.rkt. But I’m not sure whether there is such a module path. Nevertheless, I sincerely hope these pieces of information can help.

Well, I’ve tried it again and fixed it with ++lib pollen/top ++lib pollen/private/runtime-config. There still leaves a question of safety and stability, though.