Concepts of Programming Languages

(Sean Pound) #1

2.16.6 A Loosely Related Language: Go


The Go programming language is not directly related to C++, although it is
C-based. It is in this section in part because it does not deserve its own section
and it does not fit elsewhere.
Go was designed by Rob Pike, Ken Thompson, and Robert Griesemer at
Google. Thompson is the designer of the predecessor of C, B, as well as the
codesigner with Dennis Ritchie of UNIX. He and Pike were both formerly
employed at Bell Labs. The initial design was begun in 2007 and the first
implementation was released in late 2009. One of the initial motivations for
Go was the slowness of compilation of large C++ programs at Google. One of
the characteristics of the initial compiler for Go is that is it extremely fast. The
Go language borrows some of its syntax and constructs from C. Some of the
new features of Go include the following: (1) Data declarations are syntactically
reversed from the other C-based languages; (2) the variables precede the type
name; (3) variable declarations can be given a type by inference if the variable is
given an initial value; and (4) functions can return multiple values. Go does not
support traditional object-oriented programming, as it has no form of inheri-
tance. However, methods can be defined for any type. It also does not have
generics. The control statements of Go are similar to those of other C-based
languages, although the switch does not include the implicit fall through to
the next segment. Go includes a goto statement, pointers, associative arrays,
interfaces (though they are different from those of Java and C#), and support
for concurrency using its goroutines.

2.17 An Imperative-Based Object-Oriented Language: Java


Java’s designers started with C++, removed some constructs, changed some, and
added a few others. The resulting language provides much of the power and
flexibility of C++, but in a smaller, simpler, and safer language.

2.17.1 Design Process


Java, like many programming languages, was designed for an application for
which there appeared to be no satisfactory existing language. In 1990, Sun
Microsystems determined there was a need for a programming language for
embedded consumer electronic devices, such as toasters, microwave ovens, and
interactive TV systems. Reliability was one of the primary goals for such a
language. It may not seem that reliability would be an important factor in the
software for a microwave oven. If an oven had malfunctioning software, it prob-
ably would not pose a grave danger to anyone and most likely would not lead
to large legal settlements. However, if the software in a particular model was
found to be erroneous after a million units had been manufactured and sold,
their recall would entail significant cost. Therefore, reliability is an important
characteristic of the software in consumer electronic products.

2.17 An Imperative-Based Object-Oriented Language: Java 91
Free download pdf