News for hackers. Stuff that matters.
Re:Node.js Foundation and JavaScript Foundation Announce Int... by nebulous1 on Thursday October 04, 2018 @02:19PM (#18142254)
node.js came into existence because it turned out that it was particularly apt for server side programming, not because it was force fitted into it.
Re:Node.js Foundation and JavaScript Foundation Announce Int... by pjmlp on Thursday October 04, 2018 @02:28PM (#18142312)
Actually it was more because it allowed JavaScript developers to do server side programming.

I still don't see what it offers against .NET, Java, C++, OCaml, Haskell stacks, and their concurrency options.

Re:Node.js Foundation and JavaScript Foundation Announce Int... by hajile on Thursday October 04, 2018 @03:37PM (#18142988)
Ocaml has no concurrency options worth mentioning (need to look to PolyML/SML or F# for that). Finding and teaching Haskell devs simply isn't feasible. C++ is way too low-level for most of the work that someone choosing node would be doing.

It turns out that most of the reasons a server needs threads is IO. With node, any IO is moved to a new thread, so you get most of the threading benefits, but are completely safe (provided libuv is safe).

Another consideration is JS being dynamic. It's very easy to create extremely flexible APIs and you can move very fast adding features without breaking things. While That SML or F# app will provide much better type guarantees (and somewhat better performance), those benefits simply don't pay off for a lot of projects.

There's also something to be said for functional vs OOP styles. You will never see a JS dev writing enterprise fizzbuzz. Even in very large projects, those layers of boilerplate abstraction simply won't exist. Part of that is being dynamic and part is being functional.

Re:Node.js Foundation and JavaScript Foundation Announce Int... by pjmlp on Thursday October 04, 2018 @05:01PM (#18143620)
> Ocaml has no concurrency options worth mentioning

LWT is a thing.

As for being dynamic, my experience has shown that beyond prototyping, most dynamic languages don't scale with the teams.

You apparently never seen enterprise JavaScript, specially in projects with multiple consultancy companies being part of the mix.

Re:Node.js Foundation and JavaScript Foundation Announce Int... by frutiger on Thursday October 04, 2018 @10:01PM (#18145173)
> With node, any IO is moved to a new thread

Not quite (or somewhat): the IO is done asynchronously. You tell the kernel to notify you when any of a set of FDs are ready for reading/writing, and it resumes you when that is so.

Re:Node.js Foundation and JavaScript Foundation Announce Int... by hajile on Thursday October 04, 2018 @10:55PM (#18145400)
My understanding is that libuv creates a threadpool that it uses for IO operations and these inform the main thread when an IO event is ready. Is there something wrong with my understanding?
Re:Node.js Foundation and JavaScript Foundation Announce Int... by spiralx on Monday October 08, 2018 @10:52AM (#18167978)
You're both right, although you more than the other guy being a dick. libuv uses a thread pool for asynchronous I/O for everything but network requests, which are handled on the main thread - presumably because they're already asynchronous by nature.

http://docs.libuv.org/en/v1.x/design.html

Re:Node.js Foundation and JavaScript Foundation Announce Int... by frutiger on Saturday October 06, 2018 @12:58AM (#18153611)
Yes there is something wrong with your understanding.

I recommend reading epoll(1) or kqueue(1).

Re:Node.js Foundation and JavaScript Foundation Announce Int... by EB66 on Thursday October 04, 2018 @02:42PM (#18142424)
It's a combination of both.

The event loop and non-blocking I/O are inherent in JavaScript. The language lends itself very well to scalable server-side programming.

Re:Node.js Foundation and JavaScript Foundation Announce Int... by forgotpwd16 on Friday October 05, 2018 @06:51AM (#18147102)
How are event loop and non-blocking I/O inherent in JavaScript?
Re:Node.js Foundation and JavaScript Foundation Announce Int... by pjmlp on Thursday October 04, 2018 @02:45PM (#18142451)
There are plenty of event loop and non-blocking I/O libraries for the languages I have mentioned.
Re:Node.js Foundation and JavaScript Foundation Announce Int... by EB66 on Thursday October 04, 2018 @02:55PM (#18142555)
Yep, that's true. However, JavaScript does it right out of the box and the JavaScript ecosystem is very well-aligned for async.

One of the most significant reasons to use a language like Node for server-side async programming is that for any random library you choose to use there's a very high probability the library also supports async and won't block on you. For better or for worse, async is pervasive in the JavaScript ecosystem. Even languages that have good async frameworks, like Python, most libraries will block as it's the normal I/O mode for the language.

Re:Node.js Foundation and JavaScript Foundation Announce Int... by aaronblohowiak on Thursday October 04, 2018 @02:26PM (#18142299)
A belief that it’s creater later discovered was in err.
Re:Node.js Foundation and JavaScript Foundation Announce Int... by Nadya on Thursday October 04, 2018 @02:33PM (#18142341)
Ryan Dahl has only spoken about implementation details and poor decisions made at the start that are too far along to correct now. He says Go is better than Node, not Javascript. If Javascript-as-a-server was a mistake then Ryan would not be working on Deno [0]. I just hope that the use of Py2 and having to stick with it doesn't bite them in the ass past 2020 [1].

With the caveat of my argument assuming "Typescript is a superset of Javascript."

[0] https://github.com/denoland/deno

[1] https://github.com/denoland/deno/issues/464#issuecomment-411...

Re:Node.js Foundation and JavaScript Foundation Announce Int... by aaronblohowiak on Thursday October 04, 2018 @02:50PM (#18142498)
https://mappingthejourney.com/single-post/2017/08/31/episode...

>That said, I think Node is not the best system to build a massive server web. I would definitely use Go for that. And honestly, that's basically the reason why I left Node. It was the realization that: oh, actually, this is not the best server side system ever.

Re:Node.js Foundation and JavaScript Foundation Announce Int... by Nadya on Thursday October 04, 2018 @04:14PM (#18143273)
Node is not JavaScript.

E: To clarify on this a little since I'm not posting from a phone. Which means he's still using Javascript-as-a-server (Deno), so he obviously still has some faith in using Javascript-as-a-server.

Go > Node, in his opinion, but that says nothing about Go > Javascript.

Re:Node.js Foundation and JavaScript Foundation Announce Int... by nebulous1 on Thursday October 04, 2018 @02:42PM (#18142419)
I don't see (from that issue, this is the first I've heard of it) that they "have to stick with it". They're saying they won't try to move to python 3 until the V8 build does. Seems pretty reasonable to me.
Re:Node.js Foundation and JavaScript Foundation Announce Int... by nebulous1 on Thursday October 04, 2018 @02:36PM (#18142366)
Oh? Is that why he's still at it to this very day? https://github.com/denoland/deno
Re:Node.js Foundation and JavaScript Foundation Announce Int... by aaronblohowiak on Thursday October 04, 2018 @02:48PM (#18142473)
Iiuc, his goal for this is to create a better experience for one off exploratory stuff, not for evented servers.

http://tinyclouds.org/jsconf2018.pdf

Re:Node.js Foundation and JavaScript Foundation Announce Int... by nebulous1 on Thursday October 04, 2018 @03:02PM (#18142625)
well, from that document:

> My problems with Node are almost entirely around

> how it manages user code.

> In contrast to the focus on evented I/O early on,

> the module system was essentially an afterthought

> With this in mind, I have long thought about how it

> could be done better....

Re:Node.js Foundation and JavaScript Foundation Announce Int... by cremp on Thursday October 04, 2018 @03:05PM (#18142660)
> apt for server side programming

Except what part is that? Having to download 4 or 5 projects to build, compile, and run 'basic' pages is too much bloat; not to mention the dependency hell.

It more and more seems to me like node was made 'because we can' instead of providing something. This can be seen with all of the cruft required; a lot made as an after-thought.

Package manager, npm; which itself has proven that... it wasn't designed too well. The reliance of it creates the cruft. Add in the fact that a web server shouldn't be event driven. I (personally) haven't seen any other language do an event-driven web; and I'd say, for good reason (callback hell.)

Javascript itself is okay because it's a requirement today for web pages to the average joe. However, if the Javascript foundation is merging; it'll their motto to use it (Node.)

Re:Node.js Foundation and JavaScript Foundation Announce Int... by hajile on Thursday October 04, 2018 @03:53PM (#18143120)
I've used ruby, java, python, etc and all of them require a decent amount of dependencies to get a server up and running.

Likewise, dependency hell is an issue in lots of languages. The company I'm with has legacy dependency issues with their Java. They have pip dependency issues with Python. The front-end testers learned JS and left ruby simply because they couldn't get their tooling installed on another machine without a couple days work (turned out JS was easier to maintain and faster too). Yarn exists and solves the major issues NPM had (though they seem to be improving as well).

EventMachine or twisted are two event-based servers (ruby and python) with some level of popularity. The big issue with them is every library you reach for has blocking code everywhere, so actually making it work is painful. Promises eliminated callback hell years ago for most of us. Koa/generators eliminate most of the rest as well.

On the flip side, JS as a language is rapidly evolving and node is a serious consideration when adding new features. Node as an implementation is extremely fast and I doubt that there's another scripting language that comes anywhere close to its combination of performance, size, memory usage, startup time, etc.