{"title":"Transplanting of Environments between Closures in the lambda calculus","authors":"S. Nishizaki","doi":"10.1145/3587828.3587847","DOIUrl":null,"url":null,"abstract":"In programming languages, a function closure is a function whose body includes possibly free variables and that is accompanied by association with their values. The association of variables with their values is called an environment. If a programming language uses lexical scope and treats functions as first-class objects, then function closures are mandatory. Function closures are provided in Common Lisp, Emacs Lisp, Scheme and other dialects of LISP, as well as in modern scripting languages such as Python, JavaScript and Ruby, and procedural languages such as C++. In our previous paper, we proposed a mechanism that enables us to extract an environment part from a function closure. However, it brings a situation that environments must be handled as a first-class object, which is a huge extension of the traditional theory to be avoid if possible, since several desirable properties will be lost. This paper presents a method for replacing the environment of a function closure in the lambda calculus with the environment of another function closure. By taking this approach rather than extracting the environment from the function closure and using it, it ise to avoid treating the environment directly as a first-class object. We introduce a new computational system called lambda calculus with environment transplantation to explore the theoretical aspects of this process. Our system is defined by its syntax and reduction rules, and we provide a semantics for it through a transformation to the lambda calculus with records. The soundness of the reduction is demonstrated within this transformation semantics. Additionally, we give a simple type system to our calculus and show its subject reduction system.","PeriodicalId":340917,"journal":{"name":"Proceedings of the 2023 12th International Conference on Software and Computer Applications","volume":"13 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2023-02-23","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Proceedings of the 2023 12th International Conference on Software and Computer Applications","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/3587828.3587847","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0
Abstract
In programming languages, a function closure is a function whose body includes possibly free variables and that is accompanied by association with their values. The association of variables with their values is called an environment. If a programming language uses lexical scope and treats functions as first-class objects, then function closures are mandatory. Function closures are provided in Common Lisp, Emacs Lisp, Scheme and other dialects of LISP, as well as in modern scripting languages such as Python, JavaScript and Ruby, and procedural languages such as C++. In our previous paper, we proposed a mechanism that enables us to extract an environment part from a function closure. However, it brings a situation that environments must be handled as a first-class object, which is a huge extension of the traditional theory to be avoid if possible, since several desirable properties will be lost. This paper presents a method for replacing the environment of a function closure in the lambda calculus with the environment of another function closure. By taking this approach rather than extracting the environment from the function closure and using it, it ise to avoid treating the environment directly as a first-class object. We introduce a new computational system called lambda calculus with environment transplantation to explore the theoretical aspects of this process. Our system is defined by its syntax and reduction rules, and we provide a semantics for it through a transformation to the lambda calculus with records. The soundness of the reduction is demonstrated within this transformation semantics. Additionally, we give a simple type system to our calculus and show its subject reduction system.