Serialization

Peter Levart peter.levart at marand.si
Thu Dec 17 03:13:40 PST 2009


On Wednesday 16 December 2009 17:51:24 you wrote:
> > I wouldn't prevent serializability of non-static closures though. If one
> > should be worried about that, the compiler could issue a special warning
> > that is opt-in type (accompanied with annotation for the same purpose).
> >
> I'm not sure where the compiler would issue the warning: serialization is
> not a language feature; it's accomplished by invoking a method.  The
> compiler may have no indication that the object being serialized is of a
> function type.  I agree that it's inconsistent with our current approach to
> serialization (where we do let people serialize instances of non-static
> nested classes), but it's usually a mistake when people do it.
> 

I was thinking about a warning like: "Lambda expression references outer instance. Serializing lambda expression will serialize outer instance."

Just that. If one is building a distributed execution system (like Google's map-reduce) he wants to be sure he's codebase contains static-only closures so that the serialization footprint is within the resonable bounds. He might then enable this warning to check the code.

Peter


More information about the lambda-dev mailing list