r/java • • Jun 10 '24

[deleted by user]

[removed]

616 Upvotes

594 comments sorted by

View all comments

Show parent comment

2

u/leemic Jun 11 '24

I do not think Kotlin is a pure functional language. We overlay the object-oriented with streaming + functions. In the OO paradigm, this is an implicit input parameter with additional permission, etc. Lamda with the receiver is a dynamic runtime extension function. They could have used a better name that was not confused with the functional paradigm.

As for the use case, I created a cucumber-like testing framework with a single abstract class. I handed it off to a test engineer as an automated test tool. The specific use case is an electronic trading engine where it receives an order and sends out multiple orders to exchanges. I orchestrated various clients and numerous exchanges, which only took a few days. The engineer can easily extend it because it is code/Kotlin.

1

u/thecodeboost Jun 21 '24

I don't either. I just think receiver lambdas hurt code quality (you can make a close to objective argument for it since it's literally a semi-documented side effect). To each their own of course.