A Calculus with Partially Dynamic Records for Typeful Manipulation of JSON Objects
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.
Thu 21 JulDisplayed time zone: Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna change
10:30 - 11:45 | |||
10:30 25mTalk | A Calculus for Variational Programming Research Track Sheng Chen University of Louisiana at Lafayette, Martin Erwig Oregon State University, Eric Walkingshaw Oregon State University Link to publication DOI Media Attached | ||
10:55 25mTalk | A Calculus with Partially Dynamic Records for Typeful Manipulation of JSON Objects Research Track Atsushi Ohori Tohoku University, Katsuhiro Ueno Tohoku University, Tomohiro Sasaki Tohoku University, Daisuke Kikuchi Tohoku University and Hitachi Solutions East Japan, Ltd. Link to publication DOI Pre-print Media Attached | ||
11:20 25mTalk | Transforming programs between APIs with Many-to-Many Mappings Research Track Chenglong Wang University of Washington, Jiajun Jiang Peking University, Jun Li Peking University, Yingfei Xiong Peking University, Xiangyu Luo Peking University, Lu Zhang Peking University, Zhenjiang Hu National Institute of Informatics Link to publication DOI Pre-print Media Attached |