Ben Edwards
08/13/2022, 1:40 PMChris Lee
08/13/2022, 5:54 PMconst val. These are for values that are known at compile time, and are inlined into where they are used. This differs from val that assigns values at runtime.Stephan Schroeder
08/14/2022, 9:18 AMconst 🤔 It's not like you could have a const var , so composability isn't a thing here and the chosen solution is longer which unfortunately reminds me of Java's final var .ephemient
08/14/2022, 7:36 PMconst should be left as a modifier to keep future uses openBen Edwards
08/14/2022, 10:02 PMephemient
08/14/2022, 10:03 PMconst fun might have a future meaningephemient
08/14/2022, 10:07 PMStephan Schroeder
08/21/2022, 10:48 AMconst x = 5 and ``const val x = 5`` in the language. My uneducated impression is that you could always reinterprete a runtime const x = 5 (with the current const val semantics) to also have a comptime semantic without breaking any existing code because comptime doesn't exist yet.Chris Lee
08/21/2022, 2:31 PMconst val) are only evaluated at compile time and do not exist at runtime.Stephan Schroeder
08/25/2022, 2:51 PMconst in other languages?ephemient
08/25/2022, 11:24 PMephemient
08/25/2022, 11:28 PMconst
Java - no `const`; final qualifier is overloaded
C/C++/Objective-C/D - const is qualifier, but means something different
Go/JS - const is declaration, but means something different
Rust - the only one where const has a meaning like const val in KotlinStephan Schroeder
08/28/2022, 7:09 AMcomptime values/functions in Zig are available at compile-time and runtime.
I just got an idea, that might explain why const val = 5 might be better idea than simply the keyword const x = 5 . const is probably composable after all, not with var but with fun (possibly in the future)!?!
I do prefer the idea of using const val and const fun over const and const fun.