Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: we should implament http and net stack a bit #57

Open
frank-dspeed opened this issue Oct 4, 2019 · 4 comments
Open

Feature: we should implament http and net stack a bit #57

frank-dspeed opened this issue Oct 4, 2019 · 4 comments

Comments

@frank-dspeed
Copy link

this would be really usefull if it would be able to implament some standard stuff like a basic http request and response handling or a net socket.

@pitust
Copy link

pitust commented Dec 1, 2019

I agree, however it could also be useful to just write C FFI/C declarations.

@andrei-markeev
Copy link
Owner

http and sockets are target specific.

how I see it:

  1. there's TS2C transpiler (this project) which is a generic transpiler that doesn't know anything about target platform
  2. there are also TS2C target projects that handle platform-specific stuff, for example there's currently one example target - ESP32: https://github.com/andrei-markeev/ts2c-target-esp-idf (WIP)
  3. then in addition to this, there might be some helper wrappers that simplify access to target platform features. for example it might be implementation of fetch for ESP32 with same syntax as the fetch we have in browser

so what you are suggesting is rather p.3

I mean, not against it at all, but for now I'm concentrating on the transpiler part, and it is a gigantic effort to implement even just the ES3 spec...

@pitust
Copy link

pitust commented Dec 31, 2019

Well, After implementing ES3, you can run babel and typescript to turn ESnext to ES3.
Also, I think I found some issues and have fixes for them but I patched my local ts2c implementation so IDK. Also, I have came up with a series of tricks to get 64-bit intagers and C FFI for use in an OS, see js-os. It also patches the input JS and the ouput C quite a bit.

@andrei-markeev
Copy link
Owner

andrei-markeev commented Dec 31, 2019

interesting project! 👍

yes, basically this patching as in cpatch.js is more or less what a TSC target would do.

C FFI is also done in TSC target, already possible via type definitions, example here: https://github.com/andrei-markeev/ts2c-target-esp-idf/tree/master/headers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants