i dismissed a notice of `A.(B)->C` when i came ...
# stdlib
j
i dismissed a notice of
A.(B)->C
when i came upon a random refactoring intent having reverted it after testing it and seeing it worked all the same. https://kotlinlang.org/docs/reference/lambdas.html#function-literals-with-receiver as it turns out is a real thing. so there are a few quirks about stdlib, gaps between say list and array which appeear to be interchangable but are not(unless i write them). and likewise for the primitive arrays and the object arrays. is there an undercurrent of some java-generics like algebra that spoils it for writing a suite of generic extensions for the existing base kotlin libs?
could
fun<X,T,R> X<T>.iterator(Unit)->(R)
exist for instance for filling the gap between iterable and sequence?
i
You mean, abstracting/generalizing over convention, e.g. writing a function that takes anything that implements "iterable" convention? No, it can be achieved neither with generics nor the other language constructions.
j
Copy code
No, it can be achieved neither with generics nor the other language constructions.
is that a double or triple negative? does this mean "cannot" be achieved?
r
@jimn It was perfectly correct. Both the following constructs are equivalent: • cannot x by a or b • can x by neither a nor b
1
j
@Ruckus thank you for helping with the clarification of his intent. while that may be a logical and proper English construct found in the likes of Noam Chomsky dissertations or Tolkien literature, it's not even a rarely used construction in common online communication. it looks like a cut and paste error tbh worthy of double checking
apparently ad-hoc polymoprphism is mostly addressed in this KEEP https://github.com/Kotlin/KEEP/pull/87 which seems like a pretty relevant bit of info to add to this thread