samth
2018-7-25 20:45:52

@mflatt I’m trying to extract racket/fasl to a stand-alone linklet, and failing. I have the following file: #lang racket/base (require (prefix-in r: racket/fasl)) (define fasl->s-exp r:fasl->s-exp) (define s-exp->fasl r:s-exp->fasl) (provide (all-defined-out)) when I run the following command: racket bootstrap-run.rkt -c compiled/cache-src ++knot read read/api.rkt ++knot read read/primitive-parameter.rkt ++knot read read/readtable-parameter.rkt ++knot read read/readtable.rkt ++knot read read/number.rkt -s -x -t fasl.rkt -o compiled/fasl.rkt it fails with an error about hash-ref: no value found for key key: '#s(link #<path:/home/samth/sw/plt/racket/src/expander/read/number.rkt> 0) Various other uses of ++knot fail as well, although in different ways. Am I doing something wrong (that command is copied from the existing Makefile decompile target)? cc @cadr


mflatt
2018-7-25 20:53:58

The ++knot argument works for the expander because the expander includes the reader’s implementation. I’ll think about it more, but maybe the right approach is to flatten a module that combines the expander and racket/fasl and use that in place of the expander.


samth
2018-7-25 21:00:44

ah, that’s easy enough


mflatt
2018-7-25 21:04:17

Possibly remembering more, but possibly misremembering: I think another option is ++knot read -, which causes anything from read to be treated as a primitive


samth
2018-7-25 21:08:51

@mflatt aha, that works! thanks!


samth
2018-7-25 21:18:37

well, almost — it works when printing the extracted linklet, but compiling to bytecode complains about 1/string->number being undefined


mflatt
2018-7-26 03:35:00

@samth I’ve adjust ++knot read - to do what you want (and also improved the error message for your original attempt to hopefully explain better)


mflatt
2018-7-26 03:36:50

Beware that the former 1/string->number renaming reflects the existence of a more primitive string->number than the one implemented by the expander. The more primitive one is meant to handle only fixnum, bignum, and flonum forms, but that happens to be enough for racket/fasl.