State of the Lambda
cr.openjdk.java.net
State of the Lambda
1–10 of 44 posts
Re: State of the Lambda
#2State of the Lambda
December 2011
4th edition
Re: State of the Lambda
#3Fortunately for us, the programming language world isn't as litigious as the smartphone world.
Re: State of the Lambda
#4Fortunately for us, the programming language world isn't as litigious as the smartphone world.
I cannot see how to apply the lambda-calculus to smartphones…
Re: State of the Lambda
#5> Default methods provide a more object-oriented solution for this problem: people.sort(comparing(Person::getLastName));
Yay function pointers.
Re: State of the Lambda
#6Re: State of the Lambda
#7Fortunately for us, the programming language world isn't as litigious as the smartphone world.
Considering every other very high level language(gc'd) language has them(and even c++/obj-c to some extent) there is plenty of prior art.
Re: State of the Lambda
#8> An alternative (or complementary) approach to function types, suggested by some early proposals, would have been to introduce a new, structural function type. A type like "function from a String and an Object to an int" might be expressed as (String,Object)->int. This idea was considered and rejected, at least for now, due to several disadvantages:
Too bad they didn't, C# originally had delegates that you had to declare, but with the addition of generics and lambdas, that system got prettier and easier. The generic delegate types Func and Action are just that, so I can have a method that looks like this:
private Foo MyMethod(string str, Func func) {
//...
}
...which means that MyMethod is a method that takes two arguments, the first is a string, and the second is a method that takes two arguments, a string and an int, and returns a Bar object. But when I call it, I can use a lambda expression, like this: var result = MyMethod("hey hey", (s, i) => new Bar(s, i));
...which is far from unwieldy. But I can see how checked exceptions would make it horrible, and I'm glad C# doesn't have those.Re: State of the Lambda
#9> Default methods provide a more object-oriented solution for this problem: people.sort(comparing(Person::getLastName)); Yay function pointers.
and default methods are traits but it's a secret.
Re: State of the Lambda
#10If this helps replace functors I'm all for it.