JSR 335 Lambda Specification, 0.6.2

Dan Smith daniel.smith at oracle.com
Tue Mar 5 11:19:56 PST 2013


On Mar 4, 2013, at 12:32 PM, Brian Goetz <brian.goetz at oracle.com> wrote:

>> Some possible combinations of terms the might work:
>> 
>> - "Function type" is the general term for types that can be targeted
>> by lambdas.  Among these are functional interface types,
>> intersections involving function types, and [insert name here]
>> (structural function types).  Separately, "function descriptor" can
>> be renamed however is preferred.
>> 
>> - "Function type" is a structural function type.  A lambda can target
>> a [insert name here], which may be a function type, a functional
>> interface type, or an intersection involving a [insert name again].
>> Separately, "function descriptor" can be renamed however is
>> preferred.
>> 
>> - "Function type" consists of the parameters, return, etc., of a
>> method.  Functional interfaces "have" a function type (other
>> interfaces and classes do not).  Syntax supports expressing certain
>> function types directly.  Lambdas can target any type that "has a"
>> function type, including functional interface types, intersections
>> involving types that have a function type, and function types
>> themselves.
> 
> The last seems the best choice?  It is basically an "abstract superterm" for function types, of which functional interfaces, certain intersections, and in the future, structural function types will be instances.

You're describing the first one:

FunctionType: one of
  Functional interface type
  Intersection
  [Insert name here] = "structural function type"

The second one looks like:

[Insert name here]: one of
  Functional interface type
  Intersection
  Function type

The third one looks like:

A type that "has a" function type: one of
  Functional interface type
  Intersection
  Function type (i.e., the "function type of T" relation is reflexive)

> Then we can leave the current functional interface term intact?

The 0.6.1 presentation was to use "functional interface type" as the top-level thing.  That was an abuse of the convention, and didn't work very well.

All of these alternatives instead use "functional interface type" as it should naturally be interpreted: a functional interface, or parameterized/raw version of one.

Where the knobs are:
- What do we call the top-level thing?
- What do we call a structural function type (anticipating that someday we might want to call it something)?
- We do we call the thing currently referred to as the "function descriptor"?

—Dan


More information about the lambda-spec-experts mailing list