mflatt
2018-7-20 13:51:50

@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.


mflatt
2018-7-20 13:55:11

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.


cadr
2018-7-20 16:05:12

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.


abmclin
2018-7-20 17:15:14

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.


abmclin
2018-7-20 17:16:00

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


abmclin
2018-7-20 17:18:56

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


lexi.lambda
2018-7-20 17:25:17

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


abmclin
2018-7-20 17:27:14

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


leif
2018-7-20 21:00:09

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


leif
2018-7-20 21:01:22

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


mflatt
2018-7-20 21:09:04

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.


leif
2018-7-20 21:12:20

Good point @mflatt


mflatt
2018-7-20 21:17:38

philip.mcgrath
2018-7-20 21:53:14

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.


stamourv
2018-7-20 22:03:05

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