1Builtins.marshal(3kaya) Kaya module reference Builtins.marshal(3kaya)
2
3
4
6 Builtins::marshal - Marshal any value to a string
7
9 String marshal( any x, Int id )
10
12 x The value to marshal
13
14 id The unmarshalling ID
15
17 Return a machine readable String representation of a variable of any
18 type.
19
20 The id given must be identical when unmarshalling to provide some pro‐
21 tection against accidentally unmarshalling the wrong value.
22
23 Marshalling is intended for passing complex data between two separate
24 instances of the same program. The format is not guaranteed to be the
25 same between versions of the standard library. Also note that if you
26 are marshalling closures, the representation may change when you recom‐
27 pile (as the marshalled form of a closure is based on its function id,
28 generated at compile time). Therefore, Kaya will not unmarshal a repre‐
29 sentation generated by a program with a different function table.
30
31 To pass data other than closures between two programs, in a way that
32 will continue to work in different library versions, consider the
33 Pickle(3kaya) module.
34
35 Note that a==b does not necessarily imply marshal(a,i)==marshal(b,i) as
36 the marshalling format includes some internal representation details
37 for the virtual machine that do not affect equality. This is unlikely
38 to be a problem in most cases (and unmarshal(marshal(a,i),i)==unmar‐
39 shal(marshal(b,i),i) is always true if a==b !).
40
42 Kaya standard library by Edwin Brady, Chris Morris and others
43 (kaya@kayalang.org). For further information see http://kayalang.org/
44
46 The Kaya standard library is free software; you can redistribute it
47 and/or modify it under the terms of the GNU Lesser General Public
48 License (version 2.1 or any later version) as published by the Free
49 Software Foundation.
50
52 Pickle.pickle (3kaya)
53 Builtins.unmarshal (3kaya)
54
55
56
57Kaya December 2010 Builtins.marshal(3kaya)