[vector] RFR (M): Ensure intrinsics are parameterized with non-capturing lambdas

Brian Goetz brian.goetz at oracle.com
Sat Feb 23 16:40:33 UTC 2019


> That would be nice.  In the end I'd like to be able to say
> things like, "this apply method requires a state-free
> crackable lambda", and have it checked by javac.

Stateless and crackable are slightly different from each other.  

Crackable (like Serializable) is asking to bake in _extra_ goop when converting a block of code to a lambda. We handle serializability via target typing; if the target type includes Serializable, we ask the metafactory to generate extra runtime goop.  Crackability would be in the same category, and could similarly be handled by a marker interface which could be mixed into the target type.  (This is how you ask for expression trees in C#, too.)  

Statelessness is kind of the opposite, because you’re asking for a _restricted_ subset of lambda behavior.  A This seems more of a tooling request (like @Override), where you’re including an assertion in the code, and you’re asking the tools to help you spot violations of the assertion.  

But, neither is all that hard.  


More information about the panama-dev mailing list