@@ -749,14 +749,25 @@ end
749
749
serialize(stream::IO, value)
750
750
751
751
Write an arbitrary value to a stream in an opaque format, such that it can be read back by
752
- [`deserialize`](@ref). The read-back value will be as identical as possible to the original.
753
- In general, this process will not work if the reading and writing are done by different
754
- versions of Julia, or an instance of Julia with a different system image. `Ptr` values are
755
- serialized as all-zero bit patterns (`NULL`).
752
+ [`deserialize`](@ref). The read-back value will be as identical as possible to the original,
753
+ but note that `Ptr` values are serialized as all-zero bit patterns (`NULL`).
756
754
757
755
An 8-byte identifying header is written to the stream first. To avoid writing the header,
758
756
construct a `Serializer` and use it as the first argument to `serialize` instead.
759
757
See also [`Serialization.writeheader`](@ref).
758
+
759
+ The data format can change in minor (1.x) Julia releases, but files written by prior 1.x
760
+ versions will remain readable. The main exception to this is when the definition of a
761
+ type in an external package changes. If that occurs, it may be necessary to specify
762
+ an explicit compatible version of the affected package in your environment.
763
+ Renaming functions, even private functions, inside packages can also put existing files
764
+ out of sync. Anonymous functions require special care: because their names are automatically
765
+ generated, minor code changes can cause them to be renamed.
766
+ Serializing anonymous functions should be avoided in files intended for long-term storage.
767
+
768
+ In some cases, the word size (32- or 64-bit) of the reading and writing machines must match.
769
+ In rarer cases the OS or architecture must also match, for example when using packages
770
+ that contain platform-dependent code.
760
771
"""
761
772
function serialize (s:: IO , x)
762
773
ss = Serializer (s)
@@ -781,8 +792,8 @@ serialize(filename::AbstractString, x) = open(io->serialize(io, x), filename, "w
781
792
782
793
Read a value written by [`serialize`](@ref). `deserialize` assumes the binary data read from
783
794
`stream` is correct and has been serialized by a compatible implementation of [`serialize`](@ref).
784
- It has been designed with simplicity and performance as a goal and does not validate
785
- the data read. Malformed data can result in process termination. The caller has to ensure
795
+ `deserialize` is designed for simplicity and performance, and so does not validate
796
+ the data read. Malformed data can result in process termination. The caller must ensure
786
797
the integrity and correctness of data read from `stream`.
787
798
"""
788
799
deserialize (s:: IO ) = deserialize (Serializer (s))
0 commit comments