TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Scala.js - Write in Scala for the browser

75 pointsby bertzziealmost 12 years ago

13 comments

benjaminjackmanalmost 12 years ago
First of all, if you watched the slides, you just ran the first `hello world` Scala-js app in your browser. The slides use the scala-js runtime. Developer tools have scalajs-runtime.js at 1.7MB compressed and about 4s to download&#x2F;execute, then about 1.5s on subsequent refreshes.<p>Now, having seen the talk at Scala days here are a few notes&#x2F;thoughts:<p>This is currently the result of 4 months worth of work, and Sébastien Doeraene, the author of the slides and the code there-in, is going to be working on it at EPFL for the next 4 years or so for his doctorate.<p>This is being done by replacing the backend portions of the Scala compiler that emit java bytecode with ones that emit javascript.<p>When the slide showing that it is 16MB came up everyone laughed and the author acknowledged how large a number this is. It is the result of having to bring in the entire the Scala standard lib. He is planning to work on ways of cutting this number down.<p>At the end of talk Martin Odersky commented from the audience that this is an attempt by the EPFL at making Scala useable for large webapp development. If it proves successful more resources will put towards supporting it.<p>I plan to try this out for internal sites used by my company. Currently we split and then have to duplicate a lot of our code between Scala &#x2F; Javascript. Scala for the server software, Javascript for frontends which are webapps. I haven&#x27;t had time since I got back to do much more than clone the git repo.
beefmanalmost 12 years ago
16MB minified. Ok; for what?<p>&quot;How to scale to Rich Internet Applications?&quot;<p>Good question. They didn&#x27;t answer it. Is the Scala code going to be much more compact? And what problems scaling JS to rich applications were they thinking of, exactly? They don&#x27;t say.
评论 #5889052 未加载
评论 #5884507 未加载
评论 #5885036 未加载
octo_talmost 12 years ago
16MB runtime is really painful. Having to pack a huge amount of the standard library (List is backed by a lot of other traits for example) into the js is going to be very difficult to reduce.
评论 #5883671 未加载
评论 #5884732 未加载
rubyn00biealmost 12 years ago
While in principal, I love this... Because JS is not my favorite language... I just don&#x27;t see the real world benefit. It&#x27;s going to:<p>1.) increase difficulty debugging (compiled js -&gt; scala) 2.) decrease productivity, see #1<p>Why not just write javascript? Though that&#x27;s my argument against any of these compile to js kits (coffee script being the big one). So maybe I&#x27;m just trolling (sorry).<p>Again, super cool. The author is waaay smarter than I for implementing this, but... The real world.
评论 #5883712 未加载
评论 #5885290 未加载
评论 #5883757 未加载
评论 #5883672 未加载
lostnetalmost 12 years ago
I enjoy both javascript and scala.<p>For work and anything I would want to put on a web site it is more practical to write javascript and when I&#x27;ve had time for my own projects I&#x27;ve enjoyed scala.<p>For me this is a great direction. The idea that I&#x27;d suddenly replace my javascript is silly. But being able to pull in things I&#x27;m familiar with from both into the same prototype (and at the same layer) of something and debug it all in the debugger I&#x27;m most familiar with (and with correct code line references!) is awesome.<p>Similarly, for someone who is learning scala and doesn&#x27;t have&#x2F;want java+IDE experience, this could lead to learning scala as a language with much less overhead and&#x2F;or while learning a more useful combination of debugger and editor.<p>I think the overly negative comments come from those who view javascript as the &quot;problem&quot; that every new way to integrate languages with it must have been designed to tackle. Since every language has trade-offs, there is always ample criticism available from that vantage point...
srameshcalmost 12 years ago
I hoped for something like clojurescript with Scala. Its finally happening which is great step. But for now , I am happy with Dart.
wiradikusumaalmost 12 years ago
Interesting! Maybe it can learn from Scala on Android:<p>For Android development, install Scala runtime into rooted phone, so you don&#x27;t need to &quot;minify&quot; your code (faster roundtrip). For Scala.js, maybe use Chrome Extension?<p>For production, ProGuard (removes unused code in Scala) and Closure Compiler (optimizes JS).
altrego99almost 12 years ago
I have not used Scala before. What&#x27;s the motivation for this? I can think of two reasons - a) to make native Scala programmers feel home with Javascript and b) Scala is a superior language than Javascript, will therefor make many things easier.<p>How much of this is (b)?
评论 #5884010 未加载
评论 #5893239 未加载
auggierosealmost 12 years ago
I think that this is a great project, and would be exactly what I need for ProofPeer (<a href="http:&#x2F;&#x2F;www.proofpeer.net" rel="nofollow">http:&#x2F;&#x2F;www.proofpeer.net</a>) because I have lot&#x27;s of code that needs to run both on the server and in the browser. I am using Clojure&#x2F;Clojurescript currently and am pretty happy with it. But I am missing the possibility of defining abstract datatypes in Clojure, so my first choice would have been Scala if Scala.js would already be mature and reasonably production ready.
chiialmost 12 years ago
It&#x27;d be interesting to integrate this into the GWT toolchain, so you can write both java and scala for the browser!
评论 #5884661 未加载
_progger_almost 12 years ago
I hope it covers &quot;Debug with breakpoints in Scala for the browser&quot;.
评论 #5884780 未加载
sjrdalmost 12 years ago
The video recording is now available! <a href="http://www.parleys.com/play/51c380bfe4b0ed8770356866" rel="nofollow">http:&#x2F;&#x2F;www.parleys.com&#x2F;play&#x2F;51c380bfe4b0ed8770356866</a>
umrenalmost 12 years ago
good job on making this, but.. it&#x27;s useless