A B C D
0
10
20
30
40
50
60
Runtime (secs)
Figure 3: Execution times of the test script A) on
the Linux reference implementation, B) on the .NET
implementation, C) on the .NET implementation with
string.join
replaced, and D) on the .NET implementa-
tion with
uri.encode
replaced.
periments where we removed the A+ implementation
of these functions from the test script (lines 5–8 in
the first experiment, lines 1–20 in the second) and
added their .NET counterparts to the scope of the
engine before execution. The result of these exper-
iments is shown on the last two columns (C, D) of
Figure 3. The replacement of
string.join
by its
.NET equivalent resulted in a nearly 30% speedup,
even though this version is still slower than the ref-
erence implementation. However, the replacement of
url.encode
yielded a huge performance gain. The
execution time in this experiment dropped to 20% of
the time measured for the reference implementation,
which is equivalent to a 5-fold speedup. This latter
result shows one of the possible exploitations of the
interoperability, i.e., performance improvement of ex-
isting A+ applications by adding .NET implementa-
tions for critical code parts.
Speeding up the execution of A+ scripts by call-
ing .NET routines is not the only interesting ap-
plication of the runtime. Because of the math-
ematical expressive power of A+, it can be used
in .NET code as an embedded domain-specific lan-
guage. Since A+ is mostly used in financial com-
putations, we illustrate the usefulness of the embed-
ding with the mixed-language implementation of the
oft-cited Black-Scholes formula (Black and Scholes,
1973) used to calculate the price of European put and
call options. Listing 3 shows a code fragment where
mathematical formulas are written in A+ but control
structures are in the host C# language.
5 RELATED WORK
Efforts on the integration of script languages into
modern object-oriented frameworks did not begin
with DLR. One of the first attempts was the imple-
mentation of the Python language in/on Java, called
JPython (now Jython) (Hugunin, 1997). That ap-
proach featured a Python to Java byte code compiler
to achive its goals. The developer of the port reported
a slowdown by a factor of 1.7 compared to the C im-
plementation.
For the .NET framework, Python was again
among the languages to be ported first. However, in
the pre-DLR era that was a hard task and the project
has been abandoned (Hammond, 2000). This negative
result has led some interpreter developers not to reim-
plement their execution engines in .NET but to pro-
vide a bridge between the framework and the existing
interpreter (Mascarenhas and Ierusalimschy, 2004).
Then, however,the idea of porting Python to .NET
was raised again, which resulted in the successful
IronPython project (Hugunin, 2004). In the first pub-
licly announced version (0.2), it was considerably
(100-fold) slower on some benchmarks than the C
implementation (while faster on some others). The
project is still under active development and its per-
formance is regularly compared to the reference im-
plementation (Fugate, 2010). Most importantly, the
DLR also grew out from this project (Hugunin, 2007).
The Java community is also putting effort on sup-
porting the execution of script languages on the Java
platform. Several related JSRs (Sun Microsystems,
2006; Sun Microsystems, 2011) reached final status
and got incorporated into public releases of the plat-
form.
Besides A+, APL has several other derivatives as
well. Two of these are even designed to work with
the .NET framework. The first version of VisualAPL,
an APL-based development platform for .NET, be-
came available in 2003, and it was released as a
consumer-ready product in 2009 (Blaze, 2009). How-
ever, VisualAPL has departed from the conventional
APL and adopted object-orientation, and C# syn-
tax and semantics into the language. More recently,
APL# (Kromberg et al., 2010) was introduced based
on Dyalog APL. In this case, the language designers
have taken careful steps not to introduce language-
breaking features. The APL# language is still under
active development, with an interpreter in a pre-beta
phase.
ICSOFT2012-7thInternationalConferenceonSoftwareParadigmTrends
300