7 ms·
I was very sceptical of Scala.js, but decided to use it in a low risk project (http://github.com/underscoreio/doodle http://github.com/underscoreio/doodle) to r
by noelwelsh 12y ago
I was very sceptical of Scala.js, but decided to use it in a low risk project (http://github.com/underscoreio/doodle http://github.com/underscoreio/doodle) to render to the HTML canvas and I am shocked at how well it works. The community is moving very quickly as well, and many advanced Scala projects have had the necessary tweaks applied to run in Scala.js.
Looking at broader trends, there is a clear movement towards static typing on the Javascript VM, as in-browser programs become more complicated. Google is developing SoundScript, there has been talk about gradual typing in ES7, Facebook has their type checker etc. To some extent I think adding static types to (the mess that is) Javascript is more work than may be worthwhile. I see the most practical developments in the alternative JS languages, such as Elm and Purescript, and now Scala.js, that start from a cleaner slate. The Javascript committee have done a shockingly good job making Javascript a compilation target with tail calls and so on in ES6.
- desdiv 12y agoGoogle is developing SoundScript Aren't they doing Dart as well? That has optional typing. Plus they have GWT, which is Java to JS. Don't get me wrong, I'm super grateful to receive their fruits of labor for free, but this looks like a case of the left hand not knowing what the right hand is doing.
- DomBlack 12y agoDon't forget the Google Closure compiler in advance mode.
- SanderMak 12y agoAlso AtScript, for the upcoming Angular 2.0: https://docs.google.com/document/d/11YUzC-1d0V1-Q3V0fQ7KSit97HnZoKVygDxpWzEYW0U/ https://docs.google.com/document/d/11YUzC-1d0V1-Q3V0fQ7KSit9...
- noelwelsh 12y agoI think this is fairly typical of large companies. For example, Facebook also has a framework called Javelin that predates React by a few years and had it's own take on functional reactive programming. It's best to think of a large company as several small companies pursuing their own agendas.
- txu 12y ago"Google’s product strategy: Make two of everything" http://arstechnica.com/business/2014/10/googles-product-strategy-make-two-of-everything/2/ http://arstechnica.com/business/2014/10/googles-product-stra... Not a bad thing to let two or more projects compete to encourage innovation, than granting each team exclusive privilege to represent the whole company in the area.
- dragonwriter 12y ago> Don't get me wrong, I'm super grateful to receive their fruits of labor for free, but this looks like a case of the left hand not knowing what the right hand is doing. Its more a case of not all the eggs being put in one basket. Google exploring many avenues to the same broad goal in parallel has been a widely observed phenomenon for a long time.
- fapjacks 12y agoYou've hit the nail on the head with left-hand-right-handedness at Google. Every interaction I've had with that company reveals behavior reflective of this condition. You've gotta scratch the surface to find it, but lately it's not very deep. When I interview places, and the interviewer gives me a single question, I hit them with something almost no one expects ("If you could change one thing without veto, what would it be?"). When I interviewed there at Google some time ago (I turned down their offer because of the answers I got to this question), six out of the seven interviewers I asked replied with some variation on "All the low-hanging fruit has been picked, and most people aren't in a position to solve the gnarly problems, so I wish I could do work that challenges me." This immediately sent up red flags with me, along with the weird sense of hivemind I got at the Googleplex. It wasn't exactly like wandering around a Borg cube, but it was close. Then recently the company I work for has had visitors from Google, and while I'm not involved in the interactions personally, there's a huge sense of this left-hand-right-hand problem even among teams working on the same product, just different groups. This is probably the case with all large corporations after a certain critical mass, but I'm personally experiencing a selection bias for Google in particular.
- ma2rten 12y agoWhen I interview places, and the interviewer gives me a single question, I hit them with something almost no one expects ("If you could change one thing without veto, what would it be?") I will remember this one. That's a great question for interviews.
- wc- 12y agoEven from the POV of the interviewer it's a great question. I'd give my answer then brainstorm with the interviewee about how they would propose solving that problem. Would you feel comfortable asking an interviewee the same question about their last job? It could give a sense of how they think / why they are looking for a new spot but might be a little invasive.
- BurningFrog 12y agoIt's more that the left hand doesn't need permission from the right hand's boss to develop a competing tool.
- sakri 12y agoThat's funny, I'm currently writing a Canvas visualization, the code base is getting bigger than anticipated, hence messier than I'd like. When I saw this article I thought "damn, I bet this would be way easier managed in Scala, if I only knew Scala".
- noelwelsh 12y agoIf you want to learn Scala allow me to make a shameless plug: - We are using Doodle as the tool for exploring Scala in free events running in San Francisco and Edinburgh in March. More will be scheduled later. - We are using the design of Doodle as a case study in our online Essential Scala course. This is a paid course, with the first iteration starting in late Feb at a crazy 50% discount (75% off for diversity applicants). All our events are listed on http://underscore.io/events/ http://underscore.io/events/
- jbooth 12y agoSo here's my question, how come no browser has a way for a java applet to manipulate the DOM? We've got GWT compiling java to JS, we've got this compiling scala to JS.. and the JVM was originally built to run inside of a browser. Why can't we just close the circle? I guess people don't want their website visitors to see a "you must upgrade java" popup first thing?
- deleted 12y ago[deleted]
- switchbak 12y agoThere was - it was called LiveConnect - but like most things to do with Java and the browser(s), it languished in a half-supported state, and really isn't worth thinking about any more. As are applets - a great idea, implemented poorly, and now essentially lost to the annals of history.
- stingraycharles 12y agoDon't forget about websites from academia that implement certain proof-of-concepts; for some reason that commumity still keeps using applets.
- exprE 12y agoThere are quite a few applets demonstrating chemical reactions/bonds or physical equations etc., and as such applets are relatively common in teaching materials for high school (/secondary education) physics and chemistry, at least with teachers (I had or) I have substituted. They are obviously years old and rarely signed, which is a shame because quite often there are plenty of demos, none of which I can run with modern default settings of a PC (and sometimes I wouldn't have enough credentials to do anything about it, anyway).
- wbillingsley 12y agoWe used to do it because dealing with cross-browser compatibility was a pain. For instance, I used to use a 1-pixel applet instead of XMLHttpRequest for AJAX (slightly before they coined the term "AJAX") and applets for rendering live-updated XML-based diagrams (instead of SVG) in both cases because it simply made things less buggy and less of a pain to support at the time. But that was in 2004 to 2007. But once we've written something, and it works, we're often a little slow updating it to newer tech, because we can't write a paper out of "the same thing I published earlier, but now using SVG and XHR instead of applets". If it still just-about works, there's less impetus to rewrite it.
- CCs 12y agoI'm skeptical of any x-to-JS compiler as usually I end up debugging 2 different codes, where the second one is machine generated. After that you try to work around on the first to make the generated one do what you want. On the other hand the Scala people know how to write compilers. We're live, in production, with Scala since 2011 and it's a joy: it actually delivers what's promised. Heard the same thing from Twitter, LinkedIn and Netflix too. So maybe it worth a try; especially if it will integrate with ReactJs / React Native. Sounds like a match made in heaven.
- wtetzner 12y agoYeah, you could maybe even get the JSX-style syntax with React by using Scala's XML support. I'm not sure if it would actually work, but it's a cool idea.
- danellis 12y agoIf you mean XML literals, they're deprecated now. I don't know whether the macroized XML interpolator has landed yet.
- codygman 12y ago> debugging 2 different codes, where the second one is machine generated. After that you try to work around on the first to make the generated one do what you want. Please forgive me for the accusation, but I've heard many people say this same statement to later found out they just meant "Well it's never happened to me... but it could... but it happened to this person I know...". I personally can't think of many situations where you'd debug the machine generated javascript instead of using a sourcemap, can you give more detail on your experience?
- reverius42 12y agoTo me this sounds like the same argument against C compilers: "You'll just end up debugging the generated asm anyway!". Turns out (mature) compilers are generally better at writing code than humans, and most of the time you don't have to debug their code, only your own. Almost every time I've heard someone say "I found a bug in the compiler!", they didn't.
- facepalm 12y agoThere just are programmers who feel static typing is the only correct way to program. Google has always been in that camp (company wide directive, I suppose). Meanwhile, most of the internet runs on PHP. I hope it will play out so that the statical types people can use something with statical types, and the dynamic types people can happily continue with their static types.
- rtpg 12y ago(disclaimer: super ultra pro-static-types person) I really wonder whether we won't get more conversion to static types. I think the popularity of dynamic typing languages is more due to the fact that static typing used to be a major pain. But with type inference being where it is, I think most languages can start moving to static typing without any costs to the users The biggest representation of this is all the Pythonistas moving to Go. Well there's not that many, but the fact that Go "feels" like Python shows that maybe "fast and easy to use" is not as tightly coupled to "lack of typechecks" as we once thought
- Koholint 12y agoWhat makes you say "with type inference being where it is"? Have there been recent advancements?
- rtpg 12y agoThis is personal impression, but there haven't really been any advances in research per se, but there's been a lot of advances in tooling. Now having type inference is an "expected" feature of most languages, now that there's a good amount of institutional knowledge. Along with first-class functions and the like. These are old things but it takes a while to propagate
- facepalm 12y agoI've learned Go by doing a MOOC on discrete optimization. Mostly, it was fine and fun. But eventually I switched back to JavaScript out of frustration because some things were simply too complicated. Just look at the sorting library of Go. I don't think they have solved the problem of static types in a satisfactory way.