-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
The Nim JS backend is very useful for targetting node-based code (e.g. Electron). However one still needs to do a lot of system stuff there: IO, path handling etc.
In my projects I have implemented parts of Nim's system stdlib modules for the nodejs backend and I want to include those (and kickstart an effort to map even more stuff if somebody else works with this backend) upstream.
This is my plan (however it has a lot of ?, so please help me improve it):
1 Resolve the jsffi vs system problem:
In my implementations of some primitives, I reuse some node importc functions which often deal with JsObject and other stuff from jsffi. However I can't depend on jsffi in system:
I can make jsffi implicitly part of system for nodejs (which probably would've made sense in the beginning, but now it might be breaking code), or I can make those functions require jsffi for the nodejs backend (which might be not compatible with other code, still you can use when defined(nodejs): import jsffi and write cli tools that work with both backends)
2 Include most functions in when defined(nodejs) in their original modules
3 Add some tests (I am not sure I found tests for IO etc, where are they)
4 Add async versions for some functions: they might be unique for the nodejs backend, but they are very useful and having the same signature will be convenient (or maybe we will have async readFile for C one day?)
5 Expose some node types/functions in something similar to jscore