How to create a SerializedLambda

Hi all,
So I was wondering if it was possible to create a SerializedLambda from a Kotlin lambda?
The SerializedLambda constructor looks quite off-putting!
Any advice on this?
Thanks!

Ok, so going a bit deeper… do Kotlin lambdas serialize into the same format as a Java lambda?

So, even if the class name is different, would the serial byte data be the same as / or compatible with Java?

Currently Kotlin lambda functions are converted to Java anonymous classes, so they have nothing to do with Java 8 lambda functions. Kotlin also does not use invokedynamica at the moment.

Ok, sounds like this is a no go then.
Is this a slight shortcoming in kotlin I wonder?
JINQ uses an interpretation of the serialised lambda bytecode to generate dynamic SQL queries (like MS LINQ, although I suspect a different mechanism). There doesn’t seem to be any way to do this (interrogate the structure of an expression) in Kotlin.
I wonder if there is anything planned…?

I don’t think that basing something on serialized form of lambda is a good solution. It is very unreliable. Kotlin provides much more powerful mechanism called type safe builders, which is very good for things like SQL requests.

As for expression serialization, my group is actually working on a polyglot expression serialization (only for mathematics for now), but the task seems to be very complicated, so we are on the discussion stage.

By the way, here is relevant StackOverflow question. If you want to use the framework, the simplest way is to write parts of code in Java. It is not hard, really.

Sorry for the slow reply, but yes I agree - type-safe builders are the way to go.