News for hackers. Stuff that matters.
Re:“Node.js is one of the worst things to happen to the soft... by vonmoltke on Tuesday August 23, 2016 @11:50AM (#12344675)
> 1. There are two built-in solutions to this (as well as a slew of other solutions in modules), the cluster module and the child process module: https://nodejs.org/api/cluster.html and https://nodejs.org/api/child_process.html

Process spawning and threading are two different but related mechanisms. The former is much more expensive and hard to use with optimization techniques like pooling. It also forces message passing for IPC rather than shared memory.

> 2. JS's duck typing is thought to be a "feature" to some and a "bug" to others, so if you think it's a bug, use TypeScript or Flow. They'll give you "reasonable type system[s]"

Nothing that transcompiles into JavaScript can fix JavaScript's lack of a native integer.

Re:“Node.js is one of the worst things to happen to the soft... by buu700 on Tuesday August 23, 2016 @12:30PM (#12345011)
Not that this should be necessary, but it'd actually be pretty simple for a compiler to fix #2: transform `const i: int = 3;` into `var i = new Int32Array([3]);` and change future references from `i` to `i[0]`.

No clue what the performance implications would be for really heavy uses of this, but it'd at least be a workable solution if you absolutely required a true integer type at run-time.

Re:“Node.js is one of the worst things to happen to the soft... by geofft on Tuesday August 23, 2016 @01:31PM (#12345555)
asm.js has valid, correctly-behaving integers, and asm.js works correctly on non-asm.js-aware implementations, so the lack of a native integer doesn't seem like a problem.

The emitted code might have lots of "|0"s in it, but I don't see many people complaining about the beauty of their C compiler's generated object code and the lack of native anything-other-than-integers.

Re:“Node.js is one of the worst things to happen to the soft... by vonmoltke on Tuesday August 23, 2016 @03:44PM (#12346858)
> The emitted code might have lots of "|0"s in it, but I don't see many people complaining about the beauty of their C compiler's generated object code

What are the performance implications of that? It's basically adding an extra operation. Also, having been one to dive into intermediate assembly from time to time, there certainly are people who complain about the obtuseness of object code. Particularly since the generated object code is (out-of-order execution notwithstanding) how the CPU is going to actually execute the instructions.

> the lack of native anything-other-than-integers

Um, what? C has native floating-point types on every platform with an IEEE-754-compliant FPU, and probably on some that don't as well. Pointers are also not integers, though bad programmers frequently coerce them into such because most compilers will let them.

Re:“Node.js is one of the worst things to happen to the soft... by spion on Wednesday August 24, 2016 @03:24PM (#12354555)
Regarding "|0", there are absolutely no performance implications. An ASM.js optimising compiler will recognize these code patterns and interpret them completely differently (it will not execute a bit OR operation, and instead will only treat |0 as a type hint)
Re:“Node.js is one of the worst things to happen to the soft... by spion on Wednesday August 24, 2016 @03:21PM (#12354530)
If you assign only 31 bit integer values to a JS variable, it will be treated by V8 as an integer (small int, or SMI)
Re:“Node.js is one of the worst things to happen to the soft... by kowdermeister on Tuesday August 23, 2016 @12:03PM (#12344793)
> Nothing that transcompiles into JavaScript can fix JavaScript's lack of a native integer.

Really, who cares? Types are important for the programmer not for the compiler. If I know what I'm doing then lack of ints doesn't concern me.

Re:“Node.js is one of the worst things to happen to the soft... by dottrap on Tuesday August 23, 2016 @12:54PM (#12345203)
There are certain classes of programming and mathematics that really need integers such as cryptography and fields that would need big number libraries.
Re:“Node.js is one of the worst things to happen to the soft... by kowdermeister on Tuesday August 23, 2016 @01:20PM (#12345437)
That's totally valid, but they shouldn't use Node.js if that's a mission critical part of the project. Nobody is saying that Node.js is the holy grail, but I see that expectations are that high.