Hi everyone! in the videos people say composable f...
# compose
a
Hi everyone! in the videos people say composable functions are very similar to suspend functions. why is Composable a annotation rather than a kotlin keyword?
a
I believe it's because adding a keyword is a huge language design change and can't be done by a compiler plugin.
👍 1
a
I have just realized, another possible reason is that they didn’t reserve it: if a developer has a variable called “composable” in their code, they will potentially need to rewrite lot’s of code
a
nah, to use another analogy with suspend, you can name variables
suspend
in your code too and there's no issue. Kotlin has a lot of "soft keywords" like this that are only keywords in particular contexts, not at a super low level of lexical analysis. It's the first reason that @Albert Chang mentioned above; language keywords are a big deal and it wasn't our place to add one.
e
It might be a great idea to have this kind of keyword in the language in the future, but it will take a huge amount of work. And this work is not about adding support for a new context-sensitive keyword (that's trivial). It is the work of unbundling and abstracting of language support from the runtime library (just like it was done for coroutines).
đź’Ż 1
âž• 4
o
Oh, are we talking about incremental computations? :) @elizarov