News for hackers. Stuff that matters.
Re:Voxel.css by vanderZwan on Wednesday January 27, 2016 @08:09AM (#10979807)
What about compiles-to-JavaScript languages like TypeScript?
Re:Voxel.css by yoklov on Wednesday January 27, 2016 @11:23AM (#10980887)
These are totally fine most of the time. Typescript in particular looks like a good choice for game development.

Sometimes the language is less of a good choice. E.g. i did a small toy project in coffeescript about two years ago, and found to my horror, that if your function ended in a loop, it would return an array. Always. This isn't possible to accidentally do in the host language, so I'd say it is a bad fit (for game development, where you care about such things).

Re:Voxel.css by tdy721 on Wednesday January 27, 2016 @12:29PM (#10981401)
Coffeescript returns the last line always, all you needed to do was add a 'return null' (or just 'return') as the last line in the function.

You have to be explicit in Vanilla JS to return things or it just return null. Coffeescript explicitly returns the last line every time.

Re:Voxel.css by tdy721 on Wednesday January 27, 2016 @12:33PM (#10981426)
I believe that point is that JS always returns something for every object. Many users of JS just don't realize it. (I know I didn't till I started drinking the coffee flavored kool-aid)
Re:Voxel.css by gsnedders on Wednesday January 27, 2016 @02:47PM (#10982557)
JavaScript functions always return something, yes—but unless you have a return statement, that something is `undefined`.
Re:Voxel.css by odbol_ on Wednesday January 27, 2016 @12:29PM (#10981398)
wtf coffeescript. What is the point of that?
Re:Voxel.css by matthewmacleod on Wednesday January 27, 2016 @04:50PM (#10983766)
This is a deliberate design decision in CoffeeScript – "everything is an expression" (see http://coffeescript.org/#expressions).

This is probably as a result of CoffeeScript's Ruby-esque syntax and semantics. It does mean you can write some very clear and succinct code at times, but the tradeoff is that it can have unforeseen performance implications.

Re:Voxel.css by goldbrick on Wednesday January 27, 2016 @03:59PM (#10983297)
It's what ruby does and coffeescript is basically an exercise in making js more like ruby.
Re:Voxel.css by spoiler on Wednesday January 27, 2016 @08:55AM (#10979992)
They don't add much overhead during runtime; most of the time there is zero overhead, or sometimes they can (theoretically, not sure if it's done in practice) produce more optimal code than a "literal translation".
Re:Voxel.css by klodolph on Wednesday January 27, 2016 @07:59PM (#10985098)
It depends on the language. TypeScript is basically JavaScript with added bits. Unity compiles to JavaScript, but it does so through a crazy chain of C# -> CIL (via Mono) -> C++ (via il2cpp) -> JavaScript (via Emscripten). And then remember that your browser then converts that JavaScript to assembly. Holy convoluted toolchain, batman.