Concepts of Programming Languages
280 Chapter 6 Data Types 6.8 Tuple Types A tuple is a data type that is similar to a record, except that the elements are not na ...
6.9 List Types 281 Python, an ML tuple can include elements of mixed types. The following state- ment creates a tuple: val myTup ...
282 Chapter 6 Data Types In this list, (B C) is a list nested inside the outer list. Data and code have the same syntactic form ...
6.9 List Types 283 returns the following new list: [3, 5, 7, 9]. The elements of a list must be of the same type, so the followi ...
284 Chapter 6 Data Types [expression for iterate_var in array if condition] Consider the following example: [x * x for x in rang ...
6.10 Union Types 285 6.10.1 Design Issues The problem of type checking union types, which is discussed in Section 6.12, leads to ...
286 Chapter 6 Data Types The tag of a constrained variant variable is treated like a named constant. Unconstrained variant recor ...
6.10 Union Types 287 The right side of this assignment is a data aggregate. The variable Figure_2 is declared constrained to be ...
288 Chapter 6 Data Types Accessing the value of a union is done with a pattern-matching structure. Pattern matching in F# is spe ...
6.11 Pointer and Reference Types 289 6.10.6 Implementation of Union Types Unions are implemented by simply using the same addres ...
290 Chapter 6 Data Types Variables that are dynamically allocated from the heap are called heap- dynamic variables. They often d ...
6.11 Pointer and Reference Types 291 of the memory cell to which it is bound, which in the case of a pointer is an address. This ...
292 Chapter 6 Data Types 6.11.3 Pointer Problems The first high-level programming language to include pointer variables was PL/I ...
6.11 Pointer and Reference Types 293 In C++, both arrayPtr1 and arrayPtr2 are now dangling pointers, because the C++ delete oper ...
294 Chapter 6 Data Types 6.11.5 Pointers in C and C++ In C and C++, pointers can be used in the same ways as addresses are used ...
6.11 Pointer and Reference Types 295 In C and C++, all arrays use zero as the lower bound of their subscript ranges, and array n ...
296 Chapter 6 Data Types variable in its definition, and after initialization a reference type variable can never be set to refe ...
6.11 Pointer and Reference Types 297 All variables in the object-oriented languages Smalltalk, Python, Ruby, and Lua are referen ...
298 Chapter 6 Data Types and never to heap-dynamic variables. When a heap-dynamic variable is deallo- cated, the tombstone remai ...
6.11 Pointer and Reference Types 299 Single-Size Cells The simplest situation is when all allocation and dealloca- tion is of si ...
«
11
12
13
14
15
16
17
18
19
20
»
Free download pdf