if `reified` can "ONLY" be used with `inline` why ...
# getting-started
l
if
reified
can "ONLY" be used with
inline
why not program it into the algorithm (kotlin decides when to
reified
and when not to) ?
c
Which „program it into the algorithm“?
y
Because
inline
is a pretty important signal for code readers. For libraries,
inline
means the code inside will be inlined to users, which has important implications for binary compatibility.
l
to @Chrimaeon, I don't think my question didn't have just enough information.. if you think a little bit carefully and with an open mind.. I mean to say, if
reified
can only and only be used with
inline
then kotlin should smartly decide when to make use of the
reified
technology/keyword and when not to. programmer need not to. I really do not find kotlin concise at all. it has its own boilerplate and to be very honest I probably never had problem with java boilerplate because c'mon it was 1995. it might be stupid for 2026 but very very cool for 1995 or even 2005.
again, that's just my thoughts until now, based on how much I have observed and used the language as a learner.
please don't dis/mock me. I do personal not enjoy kotlin until now TBH. I wanna let it change my opinion that's why I'm still continuing to learn it.
l
A lot of the weird things in Kotlin comes from it trying to be as Java compatible as possible.
reified
with inline functions is a trick that allowed inlined functions behave kinda-sorta like a macro (but much less powerful).
In principle,
reified
could work with non-inline functions, but it would completely change the calling convention and the way classes are represented (you might need something like C++ templates which generates classes based on the types they are used with). This would make the resulting code not really compatible with Java, so the number one goal of having seamless integration with Java would be lost. In my opinion, they should just do that, because Java integration doesn't have to be perfect. The language could be so much better if they did this. But then again, other people have different priorities.