parameter type inference for anonymous functions in assignments
Here is one possible use case
shared Object bar(Request req, Response res) => "Hello";
shared Object baz(Request req, Response res) => "World ";
// ...
//vs
shared alias Route => Object(Request, Response);
shared Route bar = (req, res) => "Hello";
shared Route baz = (req, res) => "World";
// ...
Given that I'm doing work in this area now, as a consequence of #6615, time is probably ripe to make a start on this issue.
This is now basically done, on the 6615 branch.
I just tried it, and it doesn't appear to be working:
error: parameter is not declared explicitly, and its type cannot be inferred:
@fwgreen I just tried it with this code:
shared interface Request {}
shared interface Response {}
shared alias Route => Object(Request, Response);
shared Route bar = (req, res) => "Hello";
shared Route baz = (req, res) => "World";
and it worked.
Are you sure you're on the right branch?
@gavinking I cloned it again and this time it works! Thanks!
I've merged this work to master. Still need to define it in the spec.