Summary of Changes

For those moving from the first edition of Modern Programming Languages to the second, this page gives a summary of the changes.

There are minor changes in every chapter: errata from the first edition have been repaired, minor language developments since the first edition are mentioned, and current versions of the language systems are used in all examples, exercises, and (for instructors) sample solutions. The pagination has also changed. Except for minor clarifications and corrections, there are relatively few changes to the exercises; these are noted below, chapter by chapter.

Chapter 2

There is additional explanation with examples to clarify the difference between metasymbols and single-quoted tokens in EBNF.

Chapter 3

There is a new example grammar, G7, to demonstrate the use of EBNF to remove explicit recursion from a BNF grammar.

Chapter 5

The garbage collection messages that used to be standard no longer occur in most installations of ML, and the text clarifies this.

Chapter 6

Java now supports enumerations; the second edition introduces these, where the first edition says Java doesn't support them.

Chapter 7

ML's error messages for nonexhaustive match failure have changed; the second edition has examples that match what students will actually see.

ML's warning message "Warning: calling polyEqual" is introduced at the start of the exercises, with a note that this is the only warning message students should ignore. In particular, they are warned not to ignore "match nonexhaustive" warnings in their solutions.

Chapter 8

The long quotation from the Java language specification has been updated to refer to the current standard.

Java's new parametric polymorphism is mentioned in the appropriate section.

Chapter 9

ML's error message for improperly typed conditional expressions has changed; the first edition has an example that doesn't match what students will actually see.

Exercise 26 is clarified, and the name of the function to be written is different.

Chapter 11

As in chapter 7, there are changes that follow ML's new behavior for nonexhaustive matches.

Chapter 12

The illustrations of function values in ML are slightly different -- and more clear, it is hoped -- and they are explained with an additional example.

The example function test in section 12.8 was not legal ML in the first edition. Now it is, and an additional footnote introduces the construct it uses: ML's unit value and type.

Exercise 8 has additional clarifying instructions.

Chapter 13

Section 13.3 now introduces the new boxing and unboxing coercions in Java.

The ConsCell class in section 13.4 now includes a mutator method, setTail. This is useful in some of the exercises; previously, students had to realize the need for it and add it themselves, and this was causing confusion.

Chapter 15

Section 15.6, which used to be called "Generics and How to Live Without Them" is now called "A Peek at Generics". This section was completely rewritten to reflect Java's new generic classes, interfaces, methods and constructors.

Exercise 2 has changed to use type parameters with java.util.Hashtable.

Exercise 3 has changed; the class being written is now called ObjectAList.

A new Exercise 4 repeats Exercise 3, but this time using generics. (The old Exercise 4 is now Exercise 5.)

Chapter 16

ML's error messages for nonexhaustive match failure have changed; the first edition describes error messages for the example with "The cut worm forgives the plow" that students will not actually see.

The summary at the end of 16.2 was updated to reflect Java's new support for enumerations.

Chapter 17

The definition and diagram of checked exceptions were corrected.

The description of the parts of Java that were skipped now includes new language features, particularly the assert statement and inner classes.

Chapter 19

SWI-Prolog's output format has changed noticeably. For example, where it used to respond to queries with Yes or No, it now always responds with a term, which might be true or false. All the Prolog examples in the book (and slides) have been updated to match.

The way SWI-Prolog responds to queries using reverse when the first parameter is not fully instantiated has changed subtly, and the second edition reflects this.

What SWI-Prolog prints for cyclic terms has changed, and the second edition reflects this where the occurs check is discussed.

Chapter 20

What SWI-Prolog prints from the read predicate for a prompt has changed, and this is reflected in section 20.6.

A subsection introducing the cut was added to section 20.6. It is only presented in the special case where it is the last condition in a rule. The cut is used in subsequent examples, including the adventure game example, and (for instructors) in the sample solutions.

Chapter 21

Exercises 3 and 4 have been replaced with new exercises. (The old Exercises 3 and 4 required arithmetic, which isn't covered until Chapter 22.)

Chapter 22

SWI-Prolog no longer converts real results to integers automatically when the fractional part is zero; the text is changed to reflect this.

An example was added to show the use of the cut in eliminating unnecessary backtracking in the gcd predicate.

In 23.4, control predicates are now included among the "parts that were skipped."

A new Exercise 7 (involving the cut) was added. The old Exercises 7 and 8 are now the new Exercises 8 and 9.

Chapter 23

SWI-Prolog currently implements unbounded integers, and the examples in 23.2 were changed to reflect this.