Abstract. The paper adds a mechanism of closure to Java. We apply to closures the same technique we exploited in extending Java with methods as parameters [BO08c,BO08a] and we obtain a formal denition and a prototype of Java with closures. The formal denition consists of a set of source to source translation rules that state the meaning of the new construct in terms of compositions of well known ordinary Java structures. Two variants of the transformation are discussed to allow recursively dened closures and other useful mechanisms. The notion of shared variable as a local variable that is allocated in the heap is also discussed. Eventually, since the resulting transformation is a one pass, source to source, process, it can be implemented through a Java preprocessor [BO07,BO08b], easy to write using standard development tools [LMB95,CS06a].
JavaOmega: A Translation Semantics for Closures in Java
BELLIA, MARCO;OCCHIUTO, MARIA EUGENIA
2009-01-01
Abstract
Abstract. The paper adds a mechanism of closure to Java. We apply to closures the same technique we exploited in extending Java with methods as parameters [BO08c,BO08a] and we obtain a formal denition and a prototype of Java with closures. The formal denition consists of a set of source to source translation rules that state the meaning of the new construct in terms of compositions of well known ordinary Java structures. Two variants of the transformation are discussed to allow recursively dened closures and other useful mechanisms. The notion of shared variable as a local variable that is allocated in the heap is also discussed. Eventually, since the resulting transformation is a one pass, source to source, process, it can be implemented through a Java preprocessor [BO07,BO08b], easy to write using standard development tools [LMB95,CS06a].I documenti in IRIS sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.