Live data from Hacker News

Scala.js no longer experimental

scala-lang.org

121–130 of 135 posts

Re: Scala.js no longer experimental

#121

Earlier quoted context omitted.

You'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…

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?") I will remember this one. That's a great question for interviews.

Even 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.

Re: Scala.js no longer experimental

#122

Earlier quoted context omitted.

> 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 situ…

To 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.

Depends if you're trying to debug optimized code or not... sometimes I try to do that since I'm too impatient to recompile something at -O0. Sometimes it works, sometimes I end up wasting more time than the recompilation would have taken.

Re: Scala.js no longer experimental

#123
post #73

Earlier quoted context omitted.

Why can't Python? Why can't Ruby? Why can't Perl? Fundamentally, the languages able to run in the browser are only limited by what the browsers want to implement. It would be great if browsers could render QML, or could use or or whatever but that requires browsers to either depend on an external JVM or include on in the browser. Or you need to put the QML runtime in the browser or as a dependency. Or you have to put…

None of those languages have a secure sandbox and writing one is incredibly difficult, even for a language designed to run in such an environment (Java). Native Client might be interesting here to build sandboxes for other languages.

Lua was made with embedding in mind. You can start a VM with an empty global environment (no standard libraries etc..) but there is not a big benefit in jumping from js to lua because they are so similar.

Re: Scala.js no longer experimental

#124

Earlier quoted context omitted.

> 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 situ…

To 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.

I've found 3 compiler bugs during my 15 years as professional developer.

One was a optimizer bug sprintf in a for loop reset the ecx register so the loop became infinite and the last two where valid code that crashed the compiler (how do I know that, because the crashes dissappeared with small modifications of the code, like newlines). But yeah they are pretty rare.

Re: Scala.js no longer experimental

#125
post #72
post #55

I understand why these types of compilers lack reflection support, but it still bothers me (and general makes me want to avoid them). JavaScript is naturally a very dynamic environment, and both Java and Scala have some pretty strong dynamic capabilities of their own. But somehow when they are combined (GWT or Scala.js) you end up with something that is more static than Java or JavaScript. I know the reasons have to…

I don't understand why compilers can't simply emit global variables containing structural descriptions of types. It seems like such a trivial thing to do. It would increase the size of the binary, but it would be possible to disable in projects that aren't using reflection, even automatically if the code never imports the reflection package. Maybe someone can explain this.

Ceylon does this when compiling to JS because it has to support reified generics both on the jvm and in the browser. I don't like the size of the model though. It's huge.

Re: Scala.js no longer experimental

#126
post #102
post #93

Earlier quoted context omitted.

My experience with Scala IDE: - Yes, it's very slow. - Refactoring is limited, will sometimes refuse to happen, and will sometimes randomly move 1 character into the wrong place in the file. So yes it does "break", but not in a way that's hard to fix. - Variable inspection when debugging has always worked fine for me. - Scala-IDE never gives a "full" spurious compilation error (one that shows up in the problems tab a…

Thanks for the info. A couple of questions: > - Variable inspection when debugging has always worked fine for me. Are you using version 3 or 4? In version 3 this definitely didn't work, as stated in the changelog for version 4 ( http://scala-ide.org/docs/changelog.html , look for M3 "Show variable values in hovers when in suspended debug mode". It should be noted that for me, in version 3 selecting and watching a var…

> Are you using version 3 or 4? In version 3 this definitely didn't work, as stated in the changelog for version 4 ( http://scala-ide.org/docs/changelog.html, look for M3 "Show variable values in hovers when in suspended debug mode"

Oh, I didn't realize you meant hovers; I never use that (even in Java), I always use the pane with the variables in.

> In my experience, autocomplete sometimes stops working completely.

I sometimes get the "autocompletions took longer than 2 seconds to complete" warning, but after I dismiss it they are there.

Re: Scala.js no longer experimental

#127

Looks like I'm gonna have to ditch React and IO now. I think those are getting outdated. Will be rewriting all apps in Scala.js.

With the JVM of the near future [0] running JavaScript natively, that could change again. Long before you know it, you'd be running java-scala-clojure-javascript code inside of the same jvm on the server, and on the client... [0] http://www.oracle.com/technetwork/articles/java/jf14-nashorn...

It's already out in Java 8 but the parser can choke on large js files. I tried loading some Ceylon code compiled to js into the webview but it froze. I think it will have the same problem with Scala.js

Re: Scala.js no longer experimental

#128
post #34

I'm curious to know the size of a scala.js hello world program.

Traceur (ES6 compiler) itself has a runtime of several hundreds kb. Nothing you can't avoid at some point. There is an overhead for sure. But in most cases, execution time is spent in native calls (Dom rendering especially).

6to5 compiler don't have this disadvantage.

Re: Scala.js no longer experimental

#129
> It’s mostly about the strong typing for me. Nothing revolutionary about that idea, but it’s just as true on the client as on the server: having the compiler type-check your code makes it much quicker to get complex, sophisticated systems up and running.

I used to believe that this was obviously true. Then I went from doing a lot of programming in JS where even with a large codebase, I could see the code fail in seconds to programming in Scala where type errors would not always appear in the editor, but you'd have to do a compile step that takes ages to actually see them.

Now I'm much less sure about the benefits of typing. What is actually useful is fast failure and short iteration cycles. Seeing the errors as you write is the fastest failure there is, but if I have to run a 30 second build to see a type error, that is much worse than dynamic types but seeing the error in less than a second.

Its true that carefully thought about types can catch errors you might not see immediately, but you can fix this to some extent with putting effort into making sure your code fails fast, and adding unit tests and while this doesn't give you proof-level guarantees, for most practical work, with discipline, it's good enough (even if emotionally unsatisfying).

Maybe one day I'll find a system that lets me encode constraints into the type system and have it actually tell me about violations quickly, and I'll happily leave dynamic land behind (for most things), but I've come to the conclusion that arguing about type systems misses the point, and the point is that failing fast is better than failing late. Within a single environment, failing at application startup is better than failing at an arbitrary point in the future. Failing at compile time is better than failing at startup. Failing at edit time is better than failing at compile time. But if your compile time is slower than my runtime, you're losing.

Re: Scala.js no longer experimental

#130
post #79
post #44

Earlier quoted context omitted.

But you still can't use structurally shared data, which you need when you want to share large data-structures between threads.

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 J…

Mozilla is working on a type of array that can be shared.
Post reply on HN