TY - GEN
T1 - A Calculus with partially dynamic records for typeful manipulation of json objects
AU - Ohori, Atsushi
AU - Ueno, Katsuhiro
AU - Sasaki, Tomohiro
AU - Kikuchi, Daisuke
N1 - Publisher Copyright:
© Atsushi Ohori, Katsuhiro Ueno, Tomohiro Sasaki, and Daisuke Kikuchi; licensed under Creative Commons License CC-BY.
PY - 2016/7/1
Y1 - 2016/7/1
N2 - This paper investigates language constructs for high-level and type-safe manipulation of JSON objects in a typed functional language. A major obstacle in representing JSON in a static type system is their heterogeneous nature: in most practical JSON APIs, a JSON array is a heterogeneous list consisting of, for example, objects having common fields and possibly some optional fields. This paper presents a typed calculus that reconciles static typing constraints and heterogeneous JSON arrays based on the idea of partially dynamic records originally proposed and sketched by Buneman and Ohori for complex database object manipulation. Partially dynamic records are dynamically typed records, but some parts of their structures are statically known. This feature enables us to represent JSON objects as typed data structures. The proposed calculus smoothly extends with ML-style pattern matching and record polymorphism. These results yield a typed functional language where the programmer can directly import JSON data as terms having static types, and can manipulate them with the full benefits of static polymorphic type-checking. The proposed calculus has been embodied in SML#, an extension of Standard ML with record polymorphism and other practically useful features. This paper also reports on the details of the implementation and demonstrates its feasibility through examples using actual Web APIs. The SML# version 3.1.0 compiler includes JSON support presented in this paper and is available from Tohoku University as open-source software under a BSD-style license.
AB - This paper investigates language constructs for high-level and type-safe manipulation of JSON objects in a typed functional language. A major obstacle in representing JSON in a static type system is their heterogeneous nature: in most practical JSON APIs, a JSON array is a heterogeneous list consisting of, for example, objects having common fields and possibly some optional fields. This paper presents a typed calculus that reconciles static typing constraints and heterogeneous JSON arrays based on the idea of partially dynamic records originally proposed and sketched by Buneman and Ohori for complex database object manipulation. Partially dynamic records are dynamically typed records, but some parts of their structures are statically known. This feature enables us to represent JSON objects as typed data structures. The proposed calculus smoothly extends with ML-style pattern matching and record polymorphism. These results yield a typed functional language where the programmer can directly import JSON data as terms having static types, and can manipulate them with the full benefits of static polymorphic type-checking. The proposed calculus has been embodied in SML#, an extension of Standard ML with record polymorphism and other practically useful features. This paper also reports on the details of the implementation and demonstrates its feasibility through examples using actual Web APIs. The SML# version 3.1.0 compiler includes JSON support presented in this paper and is available from Tohoku University as open-source software under a BSD-style license.
KW - JSON
KW - Polymorphic record calculus SML#
KW - Type system
UR - http://www.scopus.com/inward/record.url?scp=84982798174&partnerID=8YFLogxK
UR - http://www.scopus.com/inward/citedby.url?scp=84982798174&partnerID=8YFLogxK
U2 - 10.4230/LIPIcs.ECOOP.2016.18
DO - 10.4230/LIPIcs.ECOOP.2016.18
M3 - Conference contribution
AN - SCOPUS:84982798174
T3 - Leibniz International Proceedings in Informatics, LIPIcs
SP - 181
EP - 1825
BT - 30th European Conference on Object-Oriented Programming, ECOOP 2016
A2 - Lerner, Benjamin S.
A2 - Krishnamurthi, Shriram
PB - Schloss Dagstuhl- Leibniz-Zentrum fur Informatik GmbH, Dagstuhl Publishing
T2 - 30th European Conference on Object-Oriented Programming, ECOOP 2016
Y2 - 18 July 2016 through 22 July 2016
ER -