Академический Документы
Профессиональный Документы
Культура Документы
: Benjamin C. Pierce
University of Pennsylvania
1
5/26/08
2
5/26/08
3
5/26/08
4
5/26/08
Any questions?
10
5
5/26/08
The talk:
◦ Arguments for and against static type systems, especially
very precise ones
◦ The Boomerang language as a case study in the pros
and cons of precise types
◦ Contracts as a way of balancing concerns
11
12
6
5/26/08
13
Attempting
to prove any nontrivial theorem
about your program will expose lots of bugs
Theparticular choice of theorem makes little
difference!
Typechecking is good because it proves lots and
lots of little theorems about your program
14
7
5/26/08
15
16
8
5/26/08
Does he?
17
18
9
5/26/08
19
20
10
5/26/08
21
22
11
5/26/08
23
24
12
5/26/08
25
Types
– especially very precise ones – are a
mixed blessing in practice
26
13
5/26/08
27
28
14
5/26/08
29
30
15
5/26/08
31
32
16
5/26/08
33
34
17
5/26/08
35
36
18
5/26/08
37
38
19
5/26/08
39
test escape_xml.get
<<
<hello"world>
>>
unit test
=
<<
<hello"world>
>>
40
20
5/26/08
test escape_quotes_string.get
<<
<hello"world>
>>
=
<<
<hello\"world>
>>
41
test quotes_to_xml.get
<<
<hello\"world>
>>
the composite lens maps from quote-escaped
strings to XML-escaped strings
=
<<
<hello"world>
>>
42
21
5/26/08
43
44
22
5/26/08
45
Lenses + Lambdas
=
Boomerang
46
23
5/26/08
47
48
24
5/26/08
49
50
25
5/26/08
51
26
5/26/08
53
refinement type
54
27
5/26/08
(<Even⇐Int>b 3)
➥ b is blamed!
55
56
28
5/26/08
“latent” contracts
<T⇐S> ∈ S → (S ∪ {blame}) (hidden in type of result)
29
5/26/08
f)
(Part o
Boomerang
60
(Ongoing work!)
61
30
5/26/08
62
63
31
5/26/08
64
65
32
5/26/08
Mechanical
checks of simple properties
enormously improve software quality
◦ Types ~ General but weak theorems (usually checked
statically)
◦ Contracts ~ General and strong theorems, checked
dynamically for particular instances that occur during
regular program operation
◦ Unit tests ~ Specific and strong theorems, checked
quasi-statically on particular “interesting instances”
Needed: Better ways of integrating these different
sorts of checks
66
Collaborators:
Nate Foster and Michael Greenberg
Acknowledgments:
James McKinna, Greg Morrisett, Conor McBride, Andrew
Myers, Alexandre Pilkiewicz, Stephanie Weirich, Penn PL
Club
:
67
33