Information Technology Reference
In-Depth Information
Γ ` SE c :
Γ ` SE x : Γ ( x )& ;
b c & ;
Γ [ x7! b x ] ` SE e 0 :
b 0 & ' 0
Γ ` SE fn x => e 0 :
' 0
b x
! b 0 & ;
Γ ` SE e 1 :
' 0
Γ ` SE e 2 :
b 2
! b 0 & ' 1
b 2 & ' 2
Γ ` SE e 1 e 2 :
b 0 & ' 1 [ ' 2 [ ' 0
Γ ` SE ! x :
& f ! 1 ; ; ! n g if Γ ( x )=
b
b ref f 1 ; ; n g
Γ ` SE e :
b
& '
if Γ ( x )=
b ref f 1 ; ; n g
Γ ` SE x := e :
b
& ' [f 1 := ; ; n := g
Γ ` SE e 1 :
Γ [ x 7! b 1 ref ( % [fg )] ` SE e 2 :
b 1 & ' 1
b 2 & ' 2
Γ ` SE new x := e 1 in e 2 :
b 2 &( ' 1 [' 2 [f new g )
Γ ` SE e :
b
& '
if ' ' 0
Γ ` SE e :
b
& ' 0
Table 3. Side Eect Analysis: Γ ` SE e
:
b
&
'
(Examples 5, 6 and 7).
the rules we make sure to record that a location at the relevant program point
might have been created, referenced or assigned.
The purpose of
in the rule for new in Table 3, and the purpose of the last rule in
Table 3, is to ensure that we obtain a conservative extension of the underlying
type system. The last rule is called a subeecting rule and is essential in the
presence of conditionals. The notation
%
' ' 0
' 0
means that
'
is \a subset" of
(modulo UCAI ).
t
Example 6. Subtyping for Side Eect Analysis.
The last rule in Table 3 can be augmented with a rule for subtyping :
Γ ` SE e
:
&
'
b
0
if
b b
Γ ` SE e
:
0 &
'
b
0 on annotated types is derived from the ordering on annota-
The ordering
b b
tionsasfollows:
1 b
2
'' 0
0
0 b % 0
b
1
b
2 b
b b
b
b b
' 0
ref % b
0 ref % 0
'
b
1
! b
2 b
1
! b
2
b
' ' 0
' 0
Here
means that
'
is \a subset" of
(modulo UCAI ) and similarly
'
! b
% % 0 means that
% 0 (modulo UCAI ); as before
%
is \a subset" of
1
2 is
b
 
Search WWH ::




Custom Search