@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
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.
ah, that’s easy enough
Possibly remembering more, but possibly misremembering: I think another option is ++knot read -
, which causes anything from read
to be treated as a primitive
@mflatt aha, that works! thanks!
well, almost — it works when printing the extracted linklet, but compiling to bytecode complains about 1/string->number
being undefined
@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)
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
.