






















































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The concept of types in modern programming languages, their uses, and various implementations such as enumerations, tuples, arrays, strings, lists, unions, subtypes, and function types. It also covers type annotations, type inference, type checking, and type equivalence issues.
Typology: Slides
1 / 62
This page cannot be seen from the preview
Don't miss anything!























































Chapter Six Modern Programming Languages, 2nd ed. (^) Docsity.com 1
Chapter Six Modern Programming Languages, 2nd ed. 2
int n;
Docsity.com
Chapter Six Modern Programming Languages, 2nd ed. (^) Docsity.com 4
Chapter Six Modern Programming Languages, 2nd ed. (^) Docsity.com 5
Chapter Six Modern Programming Languages, 2nd ed. 7
char unsigned char short int unsigned short int int unsigned int long int unsigned long int No standard implementation, but longer sizes must provide at least as much range as shorter sizes.
Java: byte (1-byte signed) char (2-byte unsigned) short (2-byte signed) int (4-byte signed) long (8-byte signed)
Scheme: integer Integers of unbounded range
Docsity.com
Chapter Six Modern Programming Languages, 2nd ed. (^) Docsity.com 8
Chapter Six Modern Programming Languages, 2nd ed. (^) Docsity.com 10
Chapter Six Modern Programming Languages, 2nd ed. 11
S = { a , b , c }
Docsity.com
Chapter Six Modern Programming Languages, 2nd ed. 13
enum coin { penny = 1, nickel = 5, dime = 10, quarter = 25 };
enum escapes { BELL = '\a', BACKSPACE = '\b', TAB = '\t', NEWLINE = '\n', VTAB = '\v', RETURN = '\r' };
Docsity.com
Chapter Six Modern Programming Languages, 2nd ed. 14
fun isWeekend x = (x = Sa orelse x = Su);
Pascal: for C := red to blue do P(C) C: int x = penny + nickel + dime;
Docsity.com
Chapter Six Modern Programming Languages, 2nd ed. 16
fun get1 (x : real * real) = #1 x;
struct complex { double rp; double ip; };
type complex = { rp:real, ip:real }; fun getip (x : complex) = #ip x;
Docsity.com
Chapter Six Modern Programming Languages, 2nd ed. (^) Docsity.com 17
Chapter Six Modern Programming Languages, 2nd ed. 19
C: x.ip ML: #ip x
C: **double y = *((double *) &x); struct person { char firstname; char lastname; } p1 = {"marcia","brady"};
Docsity.com
Chapter Six Modern Programming Languages, 2nd ed. 20
{ ( (^) x x ) i x X }
S X
n i
n
= ∀ ∈
=
1 ,, |^.
i
i X
S X
=
=
∗
Docsity.com