Hi Kevin, Sorry, I don't understand the question, could you clarify? Are you asking whether Java checks the type of lambdas given to a method match the definition of the lambda*, or are you making a comment on static vs dynamic typing?
Cheers, Graham * Yes, with structural typing using lambda syntax or method reference, and nominal typing if you pass a reference to a SAM type, IIRC. On 28 February 2014 13:27, Kevin Wright <[email protected]> wrote: > > * Java's lambda approach is unique. It is more concise than scala's (due >> to not needing to mention the types of the variables), and the type system >> does not involve monstrosities such as Function22<A, B, C, ... all the way >> through W>. As far as I know, no language, certainly no popular/mainstream >> one, has gone with the novel concept of requiring the closure to have >> context such that its nominal type can always be strictly determined. All >> other languages either have functional types and will optionally auto-box >> into a nominal type if the context dictates that this is necessary (scala), >> or, don't have any nominal typing in the first place, and treat a function >> just as 'a function', without caring about types in the first place >> (javascript, python, ruby, etc). This alone already shows that calling java >> 'way behind' is misleading. Java is an apple, and scala is a pear. >> >> > I'd love to understand this idea more. If you're using lambdas in Java to > filter a list of strings, then surely you can't just give it a method that > adds a pair of integers? The compiler has to check the number and types of > arguments passed to a lambda, it's far too important to leave until runtime! > > > > -- > You received this message because you are subscribed to the Google Groups > "Java Posse" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/javaposse. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "Java Posse" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/javaposse. For more options, visit https://groups.google.com/groups/opt_out.
