Many functions in libraries and APIs have the notion of optional parameters, which can be mapped onto optional properties of an object representing those parameters. The fact that properties are optional opens up the possibility for APIs and libraries to design a complex "dependency logic" between properties: for example, some properties may be mutually exclusive, some properties may depend on others, etc. Existing type systems are not strong enough to express such dependency logic, which can lead to the creation of invalid objects and accidental usage of absent properties. In this paper we propose TypeScriptIPC: a variant of TypeScript with a novel type system that enables programmers to express complex presence constraints on properties. We prove that it is sound with respect to enforcing complex dependency logic defined by the programmer when an object is created, modified or accessed.
@InProceedings{oostvogels_et_al:LIPIcs.ECOOP.2018.14, author = {Oostvogels, Nathalie and De Koster, Joeri and De Meuter, Wolfgang}, title = {{Static Typing of Complex Presence Constraints in Interfaces}}, booktitle = {32nd European Conference on Object-Oriented Programming (ECOOP 2018)}, pages = {14:1--14:27}, series = {Leibniz International Proceedings in Informatics (LIPIcs)}, ISBN = {978-3-95977-079-8}, ISSN = {1868-8969}, year = {2018}, volume = {109}, editor = {Millstein, Todd}, publisher = {Schloss Dagstuhl -- Leibniz-Zentrum f{\"u}r Informatik}, address = {Dagstuhl, Germany}, URL = {https://drops.dagstuhl.de/entities/document/10.4230/LIPIcs.ECOOP.2018.14}, URN = {urn:nbn:de:0030-drops-92196}, doi = {10.4230/LIPIcs.ECOOP.2018.14}, annote = {Keywords: type checking, interfaces, dependency logic} }
Feedback for Dagstuhl Publishing