New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kotlin lambda support? #77

Closed
linux-china opened this Issue Jul 6, 2017 · 1 comment

Comments

Projects
None yet
3 participants
@linux-china

linux-china commented Jul 6, 2017

Now spring cloud function supports Function, Consumer, and Supplier in java.util.function package. Any idea to support Kotlin lambda?

Function == (T) -> R
Consumer == (T) -> Unit
Supplier == ()-> T

Kotlin Code with java function

 @Bean
    fun uppercase(): Function<String, String> {
        return Function { it.toUpperCase() }
    }

Kotlin Code with Lambda

    @Bean
    fun uppercase2(): (String) -> String {
        return { it.toUpperCase() }
    }
@sdeleuze

This comment has been minimized.

Show comment
Hide comment
@sdeleuze

sdeleuze Jul 6, 2017

Obviously 👍 from me on that one @markfisher ;-)

With Spring ongoing builtin Kotlin support (in Framework, Boot, Data, Reactor) and Kotlin first class support for functional programming, such support would make sense.

Even from a Java perspective, I tend to think supporting any kind of functional interface with the required signature would make sense.

On a related note, as part for Spring Framework 5 we have also put a focus on supporting immutable data classes which are a key building block in functional programming. See SPR-15199 and SPR-15673 for more details. It would be nice to make sure that Spring Cloud function leverage these capabilities.

sdeleuze commented Jul 6, 2017

Obviously 👍 from me on that one @markfisher ;-)

With Spring ongoing builtin Kotlin support (in Framework, Boot, Data, Reactor) and Kotlin first class support for functional programming, such support would make sense.

Even from a Java perspective, I tend to think supporting any kind of functional interface with the required signature would make sense.

On a related note, as part for Spring Framework 5 we have also put a focus on supporting immutable data classes which are a key building block in functional programming. See SPR-15199 and SPR-15673 for more details. It would be nice to make sure that Spring Cloud function leverage these capabilities.

@olegz olegz added this to the 2.0.0.M2 milestone Aug 30, 2018

@olegz olegz self-assigned this Aug 30, 2018

@olegz olegz added the feature label Aug 30, 2018

olegz added a commit to olegz/spring-cloud-function that referenced this issue Sep 10, 2018

GH-77 added initial Kotlin support
Added mixed java/kotlin POM configuration

added tests, javadocs

Resolves #77

olegz added a commit to olegz/spring-cloud-function that referenced this issue Sep 10, 2018

GH-77 added initial Kotlin support
Added mixed java/kotlin POM configuration

added tests, javadocs

Resolves #77

@olegz olegz closed this in 87c6742 Sep 11, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment