-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Usage of scalac option -Xcheckinit
#106
Comments
I'd say remove the flag. It doesn't feel right to have onerous runtime checks like this, at least not in production. I guess you could only enable it in fastOptJS and/or in tests. Although I personally try to keep the difference between prod and dev to a minimum. Here more info on the problem this flag solves: https://docs.scala-lang.org/tutorials/FAQ/initialization-order.html |
Hm. As a dependency on someone's project, Outwatch gets compiled into intermediate scala.js representation files, not into JVM bytecode. I wonder if this compiler option even affects those sjsir files, or if it is the consuming project's flag that matters instead. |
I think you are right and quoting from the link you provided: "It is inadvisable to use this flag outside of testing. It adds significantly to the code size by putting a wrapper around all potentially uninitialized field accesses". So we should remove it, but I am also not sure how it works in dependent applications. |
The option
-Xcheckinit
introduces runtime checks for uninitialized values in a trait and throws a exception with a meaningful message if the value is used before initialization.Compiling to javascript, the minified code contains these checks and furthermore introduces a function that is called when accessing this value. Should we remove this because of performance and bundle size or should we keep it?
The text was updated successfully, but these errors were encountered: