{"title":"承诺之前的自由","authors":"Alexander J. Summers, Peter Müller","doi":"10.3929/ETHZ-A-006904372","DOIUrl":null,"url":null,"abstract":"Null pointer dereferences are the most common runtime error in languages such as Java and C#. To alleviate this problem, Fahndrich and Leino proposed a non-null type system, in which reference types can be annotated with non-nullity expectations that are statically enforced. The main challenge for the static checking of non-nullity is object initialisation; since fields of new objects get first initialised with null, a non-null type system needs to determine when an object is fully initialised and, thus, its non-null fields actually contain non-null values. Several proposed solutions exist for tackling this problem, but each fail on one of the three criteria of soundness, flexibility and simplicity. In this paper we present a solution which satisfies all three criteria, making it suitable for mainstream use. We provide a formalisation of the core type system and prove soundness for a small language. We also show informally how the core type system can be extended to support a realistic language.","PeriodicalId":10841,"journal":{"name":"CTIT technical reports series","volume":"1 1","pages":""},"PeriodicalIF":0.0000,"publicationDate":"2010-01-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"5","resultStr":"{\"title\":\"Freedom before commitment\",\"authors\":\"Alexander J. Summers, Peter Müller\",\"doi\":\"10.3929/ETHZ-A-006904372\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"Null pointer dereferences are the most common runtime error in languages such as Java and C#. To alleviate this problem, Fahndrich and Leino proposed a non-null type system, in which reference types can be annotated with non-nullity expectations that are statically enforced. The main challenge for the static checking of non-nullity is object initialisation; since fields of new objects get first initialised with null, a non-null type system needs to determine when an object is fully initialised and, thus, its non-null fields actually contain non-null values. Several proposed solutions exist for tackling this problem, but each fail on one of the three criteria of soundness, flexibility and simplicity. In this paper we present a solution which satisfies all three criteria, making it suitable for mainstream use. We provide a formalisation of the core type system and prove soundness for a small language. We also show informally how the core type system can be extended to support a realistic language.\",\"PeriodicalId\":10841,\"journal\":{\"name\":\"CTIT technical reports series\",\"volume\":\"1 1\",\"pages\":\"\"},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2010-01-01\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"5\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"CTIT technical reports series\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/10.3929/ETHZ-A-006904372\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"CTIT technical reports series","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.3929/ETHZ-A-006904372","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
Null pointer dereferences are the most common runtime error in languages such as Java and C#. To alleviate this problem, Fahndrich and Leino proposed a non-null type system, in which reference types can be annotated with non-nullity expectations that are statically enforced. The main challenge for the static checking of non-nullity is object initialisation; since fields of new objects get first initialised with null, a non-null type system needs to determine when an object is fully initialised and, thus, its non-null fields actually contain non-null values. Several proposed solutions exist for tackling this problem, but each fail on one of the three criteria of soundness, flexibility and simplicity. In this paper we present a solution which satisfies all three criteria, making it suitable for mainstream use. We provide a formalisation of the core type system and prove soundness for a small language. We also show informally how the core type system can be extended to support a realistic language.