If you have a valid reified type parameter T then you can use:
obj is T
obj !is T
obj as T
Obj as? T
and reflection.
The way that it works is that the type parameter is replaced by the actual type when the inline code is generated.
So at the calling site:
IS <Int>(23)
becomes:
obj is Int
which is perfectly valid and works.
Type reification is a small step in the right direction but you have to admit that Kotlin is boxed in by what Java and the JVM allows it to do. However, Java compatibility is well worth the trade off.
Summary
You can store a reference to an anonymous function in a variable or pass the function as an argument to another function.
You can store a reference to a named function in a variable or parameter using the reflection reference operator ::
A reference to a lambda function can also be stored in a variable or passed as a parameter.
A lambda is defined as { parameter list -> code }
A lambda, anonymous or named function can be used as extension functions.
The shortened forms that you can use to define and call functions make them very suitable to implement DSLs and metaprogramming.
You cannot have a return in a lambda but you can use a qualified return.
Lambdas can be simplified to the point where they are difficult to understand. You can use it as a default parameter of a single parameter lambda, leave out parameters using underscore, and execute a lambda immediately.
All Kotlin functions support closure where variables that were in scope at the time the function was created remain accessible to the function even after they have gone out of scope.
Inline functions can be used to improve performance and add features such as non-local returns and reification
Google is making a new differential privacy library available as open source. PipelineDP4J is a Java-based library that can be used to analyse data sets while preserving privacy.
The Wasmer team has released Wasmer 5.0. The WebAssembly runtime adds experimental support for more back ends including V8, Wasmi and WAMR. It also now has iOS support, and upgraded compilers includin [ ... ]
You can store a reference to an anonymous function in a variable or pass the function as an argument to another function.
You can store a reference to a named function in a variable or parameter using the reflection reference operator ::
A reference to a lambda function can also be stored in a variable or passed as a parameter.
A lambda is defined as { parameter list -> code }
A lambda, anonymous or named function can be used as extension functions.
The shortened forms that you can use to define and call functions make them very suitable to implement DSLs and metaprogramming.
You cannot have a return in a lambda but you can use a qualified return.
Lambdas can be simplified to the point where they are difficult to understand. You can use it as a default parameter of a single parameter lambda, leave out parameters using underscore, and execute a lambda immediately.
All Kotlin functions support closure where variables that were in scope at the time the function was created remain accessible to the function even after they have gone out of scope.
Inline functions can be used to improve performance and add features such as non-local returns and reification