msink / kotlin-libui

Kotlin/Native interop to libui: a portable GUI library
MIT License
650 stars 50 forks source link

Use contracts for block initializers #39

Closed Creeperface01 closed 2 years ago

Creeperface01 commented 3 years ago

Since everything here is experimental so far I think it's ok to add another useful experimental feature. However it's not something which could break overall functionality

Creeperface01 commented 2 years ago

@msink can you merge this?

msink commented 2 years ago

Well, I can - but I'm not very familiar with that stuff, sorry.

Seems that compilation by Kotlin 1.6.0 passed successfully, by 1.6.20-RC-25 - successfully too, but with a warning:

w: '-Xopt-in' is deprecated and will be removed in a future release, please use -opt-in instead

Are you sure that there isn't breaking changes? And - should it be mentioned in CHANGELOG.md?

Creeperface01 commented 2 years ago

It basically allows me to use val instead of var when building the UI. For instance https://github.com/Creeperface01/zds-calculator/blob/converter/src/libuiMain/kotlin/page/Calculator.kt#L9

Even though it's experimental atm it's quite an essential feature imo

msink commented 2 years ago

Ok, merged, thanks.