News for hackers. Stuff that matters.
Re:Scala.js no longer experimental by drapper on Thursday February 05, 2015 @07:10AM (#9002799)
More and more languages have that now (F#, Ceylon, Haxe,...), I wonder how well it works in practice, especially in terms of:

- libraries availability

- code size and speed

- debugging capabilities

- ...and interoperability with JS (I recall that F# uses TypeScript definition files, that's a nice approach)

Anyone has more experience with it?

Re:Scala.js no longer experimental by sjrd on Thursday February 05, 2015 @07:54AM (#9002942)
- library availability: in Scala.js you have quite a number of core libraries available (see www.scala-js.org), but you also have direct access to JavaScript libraries

- interoperability with JS: Scala.js has its own TypeScript-like definition classes. But you can also interop in a dynamically typed way with the js.Dynamic type. In any case, the interop is very natural. Even the Scala syntax is close to JS syntax so method calls and property access just look the same.

- Code size: not exactly great, but manageable.

- Code speed: Scala.js has a very good optimizer that brings down typical macro benchmarks between 0.7x and 2x the time of the JS version (yes, 0.7x means it's actually faster!)

- Debugging capabilities: because of Source Maps, you basically step through your Scala.js code and step break points right inside your browser. All modern compile-to-JS languages have that.

Re:Scala.js no longer experimental by john2x on Thursday February 05, 2015 @07:40AM (#9002896)
Link to F#-to-JS compiler?
Re:Scala.js no longer experimental by quarterto on Thursday February 05, 2015 @07:58AM (#9002956)
Re:Scala.js no longer experimental by desdiv on Thursday February 05, 2015 @08:04AM (#9002983)
Re:Scala.js no longer experimental by amelius on Thursday February 05, 2015 @08:06AM (#9002990)
How about running Scala in multiple threads? And how about dealing with structurally-shared data?
Re:Scala.js no longer experimental by bad_user on Thursday February 05, 2015 @08:10AM (#9003008)
You don't run code in multiple threads, but Scala's ExecutionContext is not about threads, but about asynchronous execution and JS is fine with that.

Also, all of Scala's collections, including the persistent ones are supported.

Re:Scala.js no longer experimental by amelius on Thursday February 05, 2015 @08:32AM (#9003109)
This (asynchronous execution) means we are forced to use cooperative multitasking, which is probably not good for reduced latency, and therefore bad for responsiveness (compare to the Windows 3.11 days where we were forced to use cooperative multitasking).

Yes, I know most JS programs today use asynchronous execution successfully in practice, but to use it as the basis of a language platform is not a good idea IMHO. Especially when it comes to UIs, which need the responsiveness.

EDIT: web-workers are not a solution, because you can't share large data-structures efficiently between web-workers.

Re:Scala.js no longer experimental by fedesilva on Thursday February 05, 2015 @02:51PM (#9005517)
But this applies to any javascript program (or compiled to javascript). If you have specific requirements then scala.js is not the tool. Scala is.
Re:Scala.js no longer experimental by icebraining on Thursday February 05, 2015 @08:41AM (#9003159)
You can actually have multithreading by running Scala actors in web workers: https://github.com/sjrd/scala-js-actors
Re:Scala.js no longer experimental by amelius on Thursday February 05, 2015 @09:29AM (#9003359)
But you still can't use structurally shared data, which you need when you want to share large data-structures between threads.
Re:Scala.js no longer experimental by sixbrx on Thursday February 05, 2015 @12:29PM (#9004517)
If I understand you, I think it's a bit much to expect ScalaJS to somehow change the platform it is targeting, which is the browsers as accessed via Javascript (ie. without requiring plugins which would have made it DOA for most use cases). If browsers don't want threads that share data via Javascript control, and it appears they don't, and by design, then what is the alternative for ScalaJS? Same situation as with Javascript.
Re:Scala.js no longer experimental by amelius on Friday February 06, 2015 @05:38AM (#9008409)
Mozilla is working on a type of array that can be shared.
Re:Scala.js no longer experimental by warkdarrior on Thursday February 05, 2015 @03:17PM (#9005714)
The DOM is your structurally shared data. You just need to find a way to represent your data as (hidden) DOM nodes.
Re:Scala.js no longer experimental by icebraining on Thursday February 05, 2015 @04:31PM (#9006261)
That actually doesn't work in this case, because Web Workers can't access the DOM.