NAME¶
Builtins::marshal - Marshal any value to a string
SYNOPSIS¶
String marshal( any x, Int id )
ARGUMENTS¶
x The value to marshal
id The unmarshalling ID
DESCRIPTION¶
Return a machine readable
String representation of a variable of any
type.
The
id given must be identical when unmarshalling to provide some
protection against accidentally unmarshalling the wrong value.
Marshalling is intended for passing complex data between two separate instances
of the same program. The format is not guaranteed to be the same between
versions of the standard library. Also note that if you are marshalling
closures, the representation may change when you recompile (as the marshalled
form of a closure is based on its function id, generated at compile time).
Therefore, Kaya will not unmarshal a representation generated by a program
with a different function table.
To pass data other than closures between two programs, in a way that will
continue to work in different library versions, consider the
Pickle(3kaya) module.
Note that
a==b does not necessarily imply
marshal(a,i)==marshal(b,i)
as the marshalling format includes some internal representation details
for the virtual machine that do not affect equality. This is unlikely to be a
problem in most cases (and
unmarshal(marshal(a,i),i)==unmarshal(marshal(b,i),i) is always true if
a==b !).
AUTHORS¶
Kaya standard library by Edwin Brady, Chris Morris and others
(kaya@kayalang.org). For further information see
http://kayalang.org/
LICENSE¶
The Kaya standard library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License (version
2.1 or any later version) as published by the Free Software Foundation.
Pickle.pickle (3kaya)
Builtins.unmarshal (3kaya)