Lambda evaluation - postfix or prefix?

Joshua Bloch jjb at google.com
Thu Jan 28 13:44:03 PST 2010


Neal,

On Wed, Jan 27, 2010 at 7:09 PM, Neal Gafter <neal at gafter.com> wrote:

> On Wed, Jan 27, 2010 at 5:19 PM, Doug Lea <dl at cs.oswego.edu> wrote:
> > Joshua Bloch wrote:
> >> Along these lines I suggested * as a prefix operator, which is familiar
> from
> >> function pointers in C and C++.  Doug Lea likes this.
> >
> > I admit that I do like this. The correspondence
> > to function pointers is close enough that inventing a new
> > syntactic form requires a good argument for
> > ignoring historical precedent. Which I haven't seen.
> > (although I have not had enough time to read these
> > recent discussions so maybe I missed it.)
>
> There isn't enough information in this thread to guess what syntax is
> proposed.  Can you please rewrite the following example using the
> proposed syntax?
>
> #int(String)(throws IOException) foo = #(String filename)(3);
> int result = foo!("bar);
>

Presumably a close-quote after the bar?

The proposed syntax is something along the lines of:

   int result = *foo("bar");

        Josh

P.S.  I think that what we've been calling a postfix operator is more of an
infix operator in that it separates the lambda from its argument list.


More information about the lambda-dev mailing list