Lifting for XML and RPC.
Eternal systems last a long time but newer versions are different.
Today, generics are being added to Java and C++ to enhance their type systems, but even then, like ML, their type systems are unsuitable for unmarshalling.
The unmarshal function
U: array of bytes -> int | char | my_abstract_type | ...in SML something can almost be done with lifting
U: array_of_bytes -> I of int | C of char | ADT of 'abut we must actually write
U: 'a array_of_bytes -> I of int | C of char | ADT of 'aand so our network would become strongly-typed and its no use:
datagram_t = packet of hdr_t * 'a payload_t
xml_t = S of string | L of xml_t list | N of (string * string) list * xml_t list U: array_of_char -> xml_t (* an xml parser *)
XML is designed for extensible abstract datatypes
Clearly the parser gives a shallow embedding.
We can use an 'XML Schema' to provide a deep embedding of the constructs described in the schema. (With one hidden dent to the type-system.)
Un-recognised sections could be parsed and left to the application.
Home. SRG Talk. 12 March 2003. DJ Greaves. www.cl.cam.ac.uk.