Implementing recursive lambda with MethodHandle
John Nilsson
john at milsson.nu
Tue Feb 23 13:55:33 PST 2010
On Tue, Feb 23, 2010 at 8:23 PM, Neal Gafter <neal at gafter.com> wrote:
> On Tue, Feb 23, 2010 at 11:19 AM, Joshua Bloch <jjb at google.com> wrote:
> > On Tue, Feb 23, 2010 at 11:06 AM, John Nilsson <john at milsson.nu> wrote:
> >> Has it been decided that lambdas will be instances of Object? To me it
> >> seems
> >> that a lambda is fundamentally different from an object
> >
> >
> > I respectfully disagree. Java already has a bipartite type system (with
> > object rerference types and primitive types). The *last* thing we should
> do
> > is to make it tripartite. People already complain about the
> > primitive/object distinction. We must avoid adding significant new
> > complexity to an already complex language. Java's type system is among
> the
> > most delicate and complex parts of the language. Anything we add has to
> > interoperate seamlessly and predictably with what's already there/
>
> I think John was saying that lambdas are fundamentally different from
> object creation expressions (e.g. anonymous inner classes), which I
> agree with. I also agree with you that function types must be
> reference types.
>
I realize that it would be hairy to sort out how to do this cleanly. I just
wanted to air the question.
What I was thinking is that "Object" imply the existence of equals,
hashCode, toString, getClass or any other stuff associated with "normal"
objects. I don't expect any of this to exist for lambdas so why force them
to? I think of lambdas as closer to methods than objects, or rather, I think
of methods as lambdas attached to objects.
As some would say, it is a has-a, not an is-a, relationship ;-)
BR,
John
More information about the lambda-dev
mailing list