News for hackers. Stuff that matters.
Re:Shift.js: Swift to JavaScript Transpiler by andrewshatnyy on Friday November 06, 2015 @07:42PM (#10523010)
Concept of compiling things is awesome. But I refuse to understand how making compiled language -> interpreted language is a thing... It should be other way around. I'd love to see something solid like js -> c compiler so my js code runs quick and efficient.
Re:Shift.js: Swift to JavaScript Transpiler by TazeTSchnitzel on Friday November 06, 2015 @07:47PM (#10523024)
It's easier to chuck away type information than mystically conjure it out of thin air.

An ahead-of-time compiler can't make JS fast because it lacks the type information needed to do so. That's why you need just-in-time compilation for JS: you can only discover what types go where by running the code.

Re:Shift.js: Swift to JavaScript Transpiler by spion on Friday November 06, 2015 @07:46PM (#10523022)
A js -> c compiler would actually be much, much slower than current JITs because of the lack of type information.
Re:Shift.js: Swift to JavaScript Transpiler by randyrand on Saturday November 07, 2015 @05:31AM (#10524385)
Just declare a C union of an int, float, string, etc. All functions take these unions as function parameters.

Have one field be an enum of its actual type. Or something along these lines.

I don't see why this is any more difficult than a normal jit that also doesnt have type information.

Re:Shift.js: Swift to JavaScript Transpiler by comex on Saturday November 07, 2015 @06:56AM (#10524527)
Because JITs are able to generate code that optimistically assumes variables have certain types (with appropriate deoptimization checks), which is much less expensive than performing full dynamic lookups on every single operation.
Re:Shift.js: Swift to JavaScript Transpiler by tlrobinson on Saturday November 07, 2015 @02:43AM (#10524087)
With modern languages the line between compiled and interpreted is blurred, and can almost be thought of as an implementation detail.

Most modern JavaScript engines incorporate a JIT compiler, for example.

Re:Shift.js: Swift to JavaScript Transpiler by andrewshatnyy on Saturday November 07, 2015 @12:14AM (#10523832)
Meant to say JS -> binary so you can have a node/express server compiled and running. Browser JS is another story of cource