
@cadr I’m not clear on what you’re doing or whether you still need advice. But compile-file
is going to write
the result of compile-linklet
, so the result of compile-linklet
[from the linklet layer] is the value whose output you want to configure. As long as you configure it to print with a #~
prefix, the read-compiled-linklet
function [from the linklet layer] will be called (after the #~
is consumed) to read it back in. See “cs/linklet/write.ss” for an example, where write-linklet-bundle
and write-linklet-directory
are installed as the writer functions for the respective structures.

The Racket-on-Chez implementation of bundle and directory writing uses Chez Scheme’s fasl printer and reader. The traditional Racket implementation uses a fasl printer and reader that are built into the C layer. Maybe you already have a suitable fasl printer and reader, or maybe racket/fasl
will be useful.

Thanks @mflatt! I think I got it for now. The issue was, Pycket didn’t have a write
before, so I implemented write
and read-compiled-linklet
simultaneously (still going), to generate and use .zo
files (mainly for the Racket libs) in Pycket. The goal is to load Racket libs faster. It’s at the point where we can compile Racket libs and load the .zo
files. I started with stx.rkt
and it works fine, but qq-and-or.rkt
threw me off with the path objects (in srcloc structs), since (write (build-path "h"))
for example is supposed to write #<path:h>
(Racket writes it like that) but the read
I’m using in read-compiled-linklet
couldn’t read it.

Is there a way to get a list of exported identifiers for a given module? In my use case, I’m building a simple configuration system where I configure parameters using values given in a config file. I’d like to keep all of my parameters in one module and require
that module in another module that handles the job of reading the config file and binding each parameter. I want to keep this as fuss-free as possible so I’d like the configuring module to automatically discover all parameters in an imported module.

My idea is to simply find all imported identifiers, iterate over them to identify which ones are parameters and proceed to configuring them

So far the nearest thing I can find which may do what I need is namespace-mapped-symbols
but not sure if that’s the best way to accomplish my goal

@abmclin I think module->exports
is what you probably want?

yes it seems to do the job, thank you @lexi.lambda

@stamourv Just in case you missed it: https://github.com/racket/racket/pull/2178

(Mostly because I miss a lot of github PRs. :confused: )

I’ll make a variant that applies to the release branch (which doesn’t have “private/relative-path.rkt”). I think it will be the length check plus the test cases.

Good point @mflatt


Is there a way to apply the transformation that open-input-file
with a #:mode
of 'text
does for file-stream ports to pipes (in the sense of make-pipe
)? It looks like reencode-input-port
does almost the same thing, but not quite.

@leif: Yes, I’m aware. I’ll cherry-pick it.