Answers are grounded in this paper and cite their sources.
The translational semantics of Smalltalk blocks are provided in Java. The focus is thus on ensuring that the translated Java code has precisely the same functionality as the Smalltalk code. Anonymous inner classes are used. In such a class, a value( ) method is defined that embodies the Java translation of the block's contents. Static scoping references have to be communicated to the inner class by means of an array parameter whose indices are declared as final. Smalltalk block evaluation in the presence of a nonlocal return is mimicked in Java by defining and throwing block exceptions. The proposed approach can translate nested Smalltalk blocks. Minor adjustments have to be made for Smalltalk references to self. Results of performance and conformance tests are provided. The former quantifies the penalty incurred by using block exceptions. The latter were applied to the two most significant Smalltalk to Java commercial translators, and verified the accuracy of block semantics in one case but exposed deficiencies in the other.
No takes yet. Share an insight, caveat, or question.
Engelbrecht et al. (2003) studied this question.
Synapse has enriched 10 related papers. Consider them for comparative context: