:wave: working on porting some of my existing libs over to RacketScript to see what primitives are missing. Looks like open-input-bytes
is one of them. Is there a general strategy on handling port
s?
Looking at /compiler/runtime/core/ports.js
Looks like it needs to be implemented in kernel.rkt
Looks like we need to implement all the open-input-*
procs?
FWIW there is an implementation of open-input-string in urlang/rjs
: Don’t know whether you can get some ideas. (Note: The syntax in that file looks like Racket, but it’s just JavaScript in S-expression form)
https://github.com/soegaard/urlang/blob/master/compiler-rjs/runtime.rkt
The representation of string ports are explained here: https://github.com/soegaard/urlang/blob/master/compiler-rjs/runtime.rkt#L2564
Nice thanks for that.
(RacketScript) Looks like write
is implemented but not read
?
Yes. At the time the Racket reader was implemented in C so I couldn’t just use that. However, I knew Flatt was working on moving to ChezScheme, which meant that with a little patience a reader in Racket would available.
In hindsight I ought to have implemented a simple reader.
Is there a JS equivalent of <eof>
that we return?
Just using null
?