-
-
Notifications
You must be signed in to change notification settings - Fork 654
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
Add node.js implementation to std #2784
Comments
How much base Node.js API is stable ? At first it was changing quite often, sometime breaking things so we felt it was more in place into an haxelib. I agree however that having it standard would be nice. We could actually add Node-Webkit API as well if they are stable enough. |
For Travis, we do actually run the unit test on nodejs (see this line). |
The API itself seems very stable. But maybe someone with more experience with Node.js could tell us more precisely about this. |
BTW how does NodeBuffer relates to typed arrays ? We want to change haxe.io.Bytes to use typed arrays in JS. |
It seems like node buffers are modelled after the typed array specs. From the docs, however, it says that node.js buffers are more efficient but introduce some subtle incompatibilities with typed arrays. Also converting a node buffer into an ArrayBuffer will require some data copying. |
Maybe we could have this togglable ? If you want to use Node Webkit for instance, you want to keep haxe.io.Bytes as native JS |
(because it's used to upload to WebGL) |
@ncannasse The API is very stable these days. A big problem is that all of Node's IO methods are async and don't map well to Haxe's std lib. (there are sync versions, but they're a bad idea to use in server code) Pinging @dionjwa who is the maintainer of https://github.com/dionjwa/nodejs-std Personally I think we should go ahead and include basic Node externs now, and consider more features later. It would be good to be seen as "officially" supporting Node in the eyes of backend developers evaluating Haxe. |
I think @clemos might be interested too |
+1 for this idea. |
Nicolas Cannasse: +1 Node-webkit works with haxe javascript ( canvas and dom ) browser code https://github.com/rogerwang/node-webkit It would certainly be simpler if hxjavascript or similar haxelib had |
Maybe we should consider adding async counterparts to the sync apis for filesystem etc. |
It's a complicated question :) It might be a good idea to add nodejs-std to Haxe's std lib. I tend to believe that most parts of the std lib, being very rarely used by most Haxe users, should exist in a separate project, probably separate haxelibs.
To me, it would make much more sense. But maybe I'm going too far :D |
The model for these different "per-platform" "per-usage" modules being, obviously, my https://github.com/clemos/haxe-js-kit project :D |
Well i strongly disagree with Clem, the std lib is well maintained and very
|
I don't like things like SPOD and Dispatch very much. Every time a bug is reported for these I hide under my bed and hope that it goes away. |
Reading these codes tickles my brain. It feels like invoquing an eldritch Let ftgn=tl in l with x ? Gn:fb let chtgn' chl... Don t read this aloud. Never. Just like hxods code. Never ever. Also if you want to summon Nyarlatoteps Brood...there is a macro for that.
|
I think haxelib becomes mature enough to handle different "official" modules, and Haxe should rely more on it. There are so much examples of "broken" things in the std lib :
Also, I've been thinking for a long time that Haxe for "single platform" things should be promoted. That's what I try to do for node.js. |
Forgot to mention SWFObject.... god |
Haxe remoting should totally go to a different package as well... |
Last time I used swfobject I forked Mockey's one because it was out of https://github.com/mockey/swfobject-haxe Maybe we can remove the one from Haxe foundation and Mockey can upload Clément Charmet:
|
@clemos I think that's going quite OT there. We have no plans to split Haxe std into submodules. The only reason for doing so would be that there have different release cycles and for instance disk access haven't been changed since the 70s Regarding your other comments:
Back to the topic: If the base NodeJS API is stable enough, we can add it to std. You're welcome to contribute. |
The NodeJS API stability is pretty completely documented : For all the reasons stated before, I will just continue to contribute via my haxe-js-kit project, because I believe it makes much more sense to keep it separate / desynchronized. |
I would like to implement this feature. But for now I don't have any information about how it should be implemented to get accepted by the Haxe Core Developers. In general the sys package should first implement the Synchronous API's of Nodejs. In addition to this we should have an Asynchronous implementation in an other package (e.g. haxe.async.sys.io). This should be an wrapper for the Synchronous method calls to be usable even on platforms that don't allow Asynchronous programming (like php). But this is an other issue to be discussed in #2863 I see several options:
The Problem about the last option is that we have an dependency on node externs. I dont think that this is a good idea to have the next externs for a third party software in the haxe core. But on the other side it would be more user friendly to have the nodejs implementation directly shipped with haxe. In my opinion the Haxe core should get split up into several packages as mentioned by @clemos already. But this is an issue that could get target in an major release. For now the best would be to add those nodejs externs to the Haxe core and implement the Sys package for nodejs with them. But before I start doing this things (and waste my Time if it gets not accepted by the Haxe Core Developers) I want an clear decision by the Haxe Core Team which solution should get implemented. |
Started implementing this in https://github.com/Deltachaos/haxe/tree/nodejs-sys |
Awesome! On Sat, Apr 12, 2014 at 6:43 AM, Maximilian Ruta
|
Isn't it easier to just create the repository and copy his current state? |
just create a repo, add remote and push there |
Yes, that's basically what I mean. |
Whatever works for you guys! How haxe will handle them?
|
i don't think we should have these in std lib |
https://github.com/HaxeFoundation/hxnodejs Team invitations sent to @eduardo-costa and @clemos. |
Agreed!
|
nice, let's get it started |
If you don't mind I'll go ahead and close this issue. We can keep track of everything in the new repository. |
Cool! I'll start to dump the nodejs modules! 2014-10-05 16:18 GMT-03:00 Simon Krajewski [email protected]:
[image: Imagem inline 1] |
Please push only externs there, without any compiled js, hello worlds and node-modules. |
Got it! 2014-10-05 16:46 GMT-03:00 Dan Korostelev [email protected]:
[image: Imagem inline 1] |
My 2 cents:
|
We talked about it.
After the first push we will review all classes to make it standard. 2014-10-05 16:50 GMT-03:00 Franco Ponticelli [email protected]:
[image: Imagem inline 1] |
HaxeFoundation/hxnodejs@7f6cb00 this looks great structure-wise. One thing I'm not sure of is the package we want to use for this. If we're going to integrate this into haxe stdlib, maybe it should be |
|
@eduardo-costa perfect, thanks! I'll try to contribute as I can. |
I like js.node! 2014-10-05 16:58 GMT-03:00 Franco Ponticelli [email protected]:
[image: Imagem inline 1] |
js.node is good. |
I'd say go for it and we will change it if someone raises some good points against it ;) |
Fair enough! 2014-10-05 17:10 GMT-03:00 Franco Ponticelli [email protected]:
[image: Imagem inline 1] |
Done! 2014-10-05 17:11 GMT-03:00 Eduardo Dias da Costa [email protected]:
[image: Imagem inline 1] |
I've created a couple of issues on the new |
Thanks! 2014-10-05 20:16 GMT-03:00 Dan Korostelev [email protected]:
[image: Imagem inline 1] |
apart from the usual server application, poeple are also writing normal command line utilities too in nodejs So IMHO the "sync" part like - "complete" implementation of Sys.hx consisting of println(),command() etc should also be done for nodejs. The "complete implementation" of haxe Standard API (even if it is sync ) will facilitate nodejs shell scripting/commandline utility users too |
That's for sure, but with basic node.js API it's not possible to implement e.g. But first we should prepare a quality set of externs anyway, so let's think about implementing |
Locking this issue because it's annoying in my mail reader with thread view. :P |
This issue report is to start a discussion about whether it would be a good idea to implement the node.js library as part of haxe std.
Node.js can be considered a very useful technology, and I see that its use has been growing a lot in the Haxe community. We have some problems with the current state of affairs now, however:
Thoughts?
The text was updated successfully, but these errors were encountered: