Boxing function types

Kochurov Alexander ipris at inbox.ru
Sat Nov 21 22:49:25 PST 2009


Gentlemens,

what about introducing boxing/unboxing for functional types?

As Java generics don't allow us to use primitive types as type parameters, all java implementations of collection algorithms (such as map, fold, filter, etc.) would possibly use wrapper types such as Integer, Float and function types with wrapper arguments.

So it would be great if every function type with argument types A[1], A[2],.. A[n] and result type Ra may be implicitly boxed into any other function type with argument types B[1], B[2], .. B[n] and result type Rb if either A[i] = B[i] or A[i] can be converted into B[i] using implicit convertion for any i = 1..n and if it's result type Ra either matches Rb or may be converted implicitly.
(So I mean not only boxing/unboxing but also widening convertions for primitive types, e.g. function with result of short may be converted implicitly into function which returns int, long, float, double, Short, Integer, Long, Float, Double but not byte, Byte, etc.)

Alex



More information about the closures-dev mailing list