Function types versus arrays
Zdenek Tronicek
tronicek at fit.cvut.cz
Thu Feb 18 12:49:48 PST 2010
Could you have arrays allowed in JVM and disallowed in the language?
On the JVM level, function types are implemented as interfaces. So,
#int(int)... fns
would have been compiled as array but you were not allowed to write
#int(int)[] fns.
Z.
--
Zdenek Tronicek
FIT CTU in Prague
Joshua Bloch napsal(a):
> Neal,
>
> Perhaps I'm being naive, but it appears to me that allowing:
>
> #int(int) compose(#int(int)... fns) { <implementation> }
>
> implies the existence of arrays of (erased) function types. I thought you
> were arguing against the very existence of types representing arrays of
> function types. Alex's suggestion that these types be treated analogously
> to
> arrays of other nonreifiable types (i.e., most generic and parameterized
> types) makes good sense to me.
>
> Josh
>
> On Thu, Feb 18, 2010 at 9:45 AM, Neal Gafter <neal at gafter.com> wrote:
>
>> On Wed, Feb 17, 2010 at 2:59 PM, Joshua Bloch <jjb at google.com> wrote:
>> > consider a method that takes a bunch of #int(int) functions and
>> > returns their composition:
>> > #int(int) compose(#int(int)... fns) { <implementation> }
>> > This should definitely be legal, and shouldn't generate a warning
>> > (especially given that we're providing a means to eliminate this sort
>> of
>> > warning on generic varargs parameters in Java 7).
>>
>> This doesn't conflict with any of the restrictions I proposed.
>>
>
>
More information about the lambda-dev
mailing list