DocumentCode
748272
Title
Translating Smalltalk blocks to Java
Author
Engelbrecht, R.L. ; Kourie, D.G.
Author_Institution
Dept. of Comput. Sci., Univ. of Pretoria, South Africa
Volume
150
Issue
3
fYear
2003
fDate
6/24/2003 12:00:00 AM
Firstpage
203
Lastpage
211
Abstract
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.
Keywords
Java; Smalltalk; program interpreters; programming language semantics; Java; Smalltalk to Java commercial translators; anonymous inner classes; array parameter; block semantics; conformance tests; nested Smalltalk blocks; performance tests; static scoping references; translational semantics;
fLanguage
English
Journal_Title
Software, IEE Proceedings -
Publisher
iet
ISSN
1462-5970
Type
jour
DOI
10.1049/ip-sen:20030582
Filename
1214743
Link To Document