Marc Knaup
04/09/2022, 8:16 PMfun main()
in modules compiled with -Xir-per-module
are no longer executed automatically when the module is loaded.
How can I make that work again?turansky
04/09/2022, 9:48 PMMarc Knaup
04/09/2022, 10:23 PM@EagerInitialization
private val init = main()
Big Chungus
04/10/2022, 11:56 AMturansky
04/10/2022, 12:24 PMMarc Knaup
04/10/2022, 12:25 PMMarc Knaup
04/10/2022, 12:25 PMMarc Knaup
04/10/2022, 12:26 PMMarc Knaup
04/10/2022, 12:26 PMturansky
04/10/2022, 12:49 PMMarc Knaup
04/10/2022, 12:50 PMturansky
04/10/2022, 1:07 PMWe esp. need dynamic module loading.
Nobody wants a 5 MB landing page.File to file compilation will solve this problem
turansky
04/10/2022, 1:11 PMYup. In a patch update. Break a lot of stuff.Regular breaking changes will be required for Kotlin/JS evolution đ For me itâs more important, that annotation doesnât look like final solution, because it doesnât cover existed use cases
Marc Knaup
04/10/2022, 2:37 PMRobert Jaros
04/10/2022, 3:31 PMTrying to write pure K/JS production apps at the moment is just shooting yourself in the footMy foot feels a bit hurt with each new application I deploy đ
Ayfri
04/10/2022, 7:42 PMhfhbd
04/11/2022, 4:05 AMSebastian Aigner
04/11/2022, 9:08 PM-Xir-per-module
option, it was something that was only intended for experimentation in the team building JetBrains Space. We had plans to bring per module splitting to the JS IR backend for a while, but always considered the flag internal and experimental. (Thatâs also why you wonât find references to this flag in our documentation.)
To be honest, we didnât exactly expect that people would already be using this internal flag for their production applications â we probably shouldâve seen it coming, given with how much excitement the community jumps on new features in the K/JS space. Weâre going to expand the âWhatâs New in 1.6.20â with a paragraph on the change in behavior so that any other developers on the cutting edge donât experience the same issues.
Weâve tried our best to communicate the change to lazy initialization by default in the changenotes â but maybe there are better places to communicate this. If you feel this information is missing somewhere else in our documentation, just let me know, and weâll get it sorted.
As for breaking things in a patch update, I can only speak on the specifics or the Xir-per-module
situation (Other regressions happen, and trust me, nobody is more frustrated when a regression slips through the release process than our team and QAs). We had to make a trade-off: We decided to change the behavior of the main
functions with Xir-per-module enabled, because otherwise, we would have impacted all users who donât use the Xir-per-module flag. Iâm sure you can see how from our perspective â break an internal, experimental flag, or break all Kotlin/JS IR users â this was an easy decision.
The IR compiler is still in Beta precisely because we still need to make changes like that. As Victor has said; to continue the evolution of Kotlin/JS, we need to unfortunately break things sometimes, but we never intend for it to be a frustrating experience. We really want to move towards a stable IR backend as fast as possible â and to do so, we need to use the âwiggle roomâ that pre-stable parts of Kotlin get per the Kotlin Evolution. That includes making changes to features in incremental releases (though these are obviously trade-offs and decisions we make with the Kotlin/JS user base in mind).
The whole team really appreciates the dozens of issues that youâve reported around Kotlin/JS, and the hours youâve invested in triaging problems â youâve certainly done more than anyone could ask to help make the Kotlin/JS ecosystem better.
Thanks for being a trailblazer for the Kotlin/JS ecosystem over the last few years. Iâm sure youâll have great success with TypeScript and React!