Concepts of Programming Languages

(Sean Pound) #1
functional programming with extensibility as one of its primary goals. Among
the languages that influenced its design are Scheme, Icon, and Python.
Lua is similar to JavaScript in that it does not support object-oriented
programming but it was clearly influenced by it. Both have objects that play
the role of both classes and objects and both have prototype inheritance rather
than class inheritance. However, in Lua, the language can be extended to sup-
port object-oriented programming.
As in Scheme, Lua’s functions are first-class values. Also, Lua supports
closures. These capabilities allow it to be used for functional programming.
Also like Scheme, Lua has only a single data structure, although in Lua’s case,
it is the table. Lua’s tables extend PHP’s associate arrays, which subsume the
arrays of traditional imperative languages. References to table elements can
take the form of references to traditional arrays, associative arrays, or records.
Because functions are first-class values, they can be stored in tables, and such
tables can serve as namespaces.
Lua uses garbage collection for its objects, which are all heap allocated. It
uses dynamic typing, as do most of the other scripting languages.
Lua is a relatively small and simple language, having only 21 reserved
words. The design philosophy of the language was to provide the bare essentials
and relatively simple ways to extend the language to allow it to fit a variety of
application areas. Much of its extensibility derives from its table data structure,
which can be customized using Lua’s metatable concept.
Lua can conveniently be used as a scripting language extension to other
languages. Like early implementations of Java, Lua is translated to an interme-
diate code and interpreted. It easily can be embedded simply in other systems,
in part because of the small size of its interpreter, which is only about 150K
bytes.
During 2006 and 2007, the popularity of Lua grew rapidly, in part due to
its use in the gaming industry. The sequence of scripting languages that have
appeared over the past 20 years has already produced several widely used lan-
guages. Lua, the latest arrival among them, is quickly becoming one.

2.19 The Flagship .NET Language: C


C#, along with the new development platform .NET,^16 was announced by
Microsoft in 2000. In January 2002, production versions of both were released.

2.19.1 Design Process


C# is based on C++ and Java but includes some ideas from Delphi and Visual
BASIC. Its lead designer, Anders Hejlsberg, also designed Turbo Pascal and
Delphi, which explains the Delphi parts of the heritage of C#.


  1. The .NET development system is briefly discussed in Chapter 1.


2.19 The Flagship .NET Language: C# 101
Free download pdf