https://kotlinlang.org logo
#language-proposals
Title
# language-proposals
r

raulraja

01/11/2018, 6:57 PM
@orangy it's not really the same because with delegation you have to carry over the params in the declarations of the partially applied function. Not arguing the example above it's worth a lang feature just displaying an example where it's frequently used which is function arguments decomposition.
Copy code
val getPremiumWithTotal = CreditCard.getPremium(creditCards.length) _ 
fun getPremuimWithTotal(creditCard: CreditCard) = CreditCard.getPremium(creditCards.length, creditCard)
@Ruckus It's an improvement because depends on how they are implemented in the lang the value
creditCards.length
can be memoized vs recomputed.
r

Ruckus

01/11/2018, 7:03 PM
I don't view language level implicit memoization as an improvement, but that's another matter.
r

raulraja

01/11/2018, 7:03 PM
I think it's explicit because you are passing an argument to a function and the function is taking it's value and setting it in its context
so it's expected that you'd get a consistent result back each time you invoke the returned function
r

Ruckus

01/11/2018, 7:06 PM
Yes, but I've seen this bite people in the but when they forget to take mutability into account. Again, this is a personal opinion, so not really valid as an argument for or against the language feature, I just don't like it.
I prefer to explicitly tell the function whether or not I want it to memoize, as it tends to be less surprising.
👍 5
3 Views