Lifting for XML and RPC

.

Eternal systems last a long time but newer versions are different.

  • We need to gracefully interoperate old with new.
  • Most programing language type systems don't support this.

    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 'a
    
    but we must actually write
    
      U:  'a array_of_bytes -> I of int | C of char |  ADT of 'a
    
    and so our network would become strongly-typed and its no use:
    
      datagram_t = packet of hdr_t * 'a payload_t
    

    Enter XML

    
      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

  • Un-recognised attributes and subtree's can be ignored or give a runtime error. "That was supposed to be the point of type systems"
  • Use of plain ASCII allows English-speakers to intervene.

    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.