[4575] in java-interest
language level support for serialization
daemon@ATHENA.MIT.EDU (Jonathan Locke)
Sun Jan 7 17:06:51 1996
Date: Sun, 7 Jan 1996 10:52:06 -0800 (PST)
From: Jonathan Locke <jonl@sealevelsoftware.com>
To: java <java-interest@java.sun.com>
one thing i was really hoping java might do is provide built-in support for
serialization. C++ could never hope to do such a thing because of the whole
pointers-are-out-of-control issue... but JAVA could conceivably do it! a
native method written by Sun (not sure what class it belongs in) could
take an Object, a generic Stream interface and a direction (stream in or out)
and that method should be able to traverse the graph of objects that are
sub-objects of the Object you want to serialize (taking care to avoid
cycles) and it should be able to turn the pointers into a persistent
representation (zero-based file offsets perhaps) and back into pointers
again when streaming back in (the pointer *values* have to change,
obviously, but the *meaning* of the pointers can be reconstructed from
the information in the stream). one small issue: if someone messes with
the pointers in the file, the serialize method should be able to catch
on (or there might be some security issues) and say "File corrupted". i
realize this is a non-trivial problem, but the benefits could be tremendous
because all Java applications would be able to serialize *anything* by just
stuffing things into classes and saying "serialize yourself" to the object
of that class. imagine being able to take an arbitrarily complex object and
push it through a socket connection to another application! what power and
elegance! and it would only be possible in a safe language like Java. it
would be yet another point on the scoreboard of C++ versus Java. oh... and
let's not forget that Sun already has a good chunk of the code required to
implement the feature (the garbage collector's mark phase has to do exactly
the traversal mentioned above).
J
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com