Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
sav08:semantics_of_array_manipulations [2008/04/08 17:25] vkuncak created |
sav08:semantics_of_array_manipulations [2008/04/08 23:45] vkuncak |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Semantics of Array Manipulations ====== | ====== Semantics of Array Manipulations ====== | ||
- | Array semantics. | + | Suggest an attempt to model Java arrays. |
+ | |||
+ | Example: | ||
+ | |||
+ | a = new T[10]; | ||
+ | b = new T[10]; | ||
+ | ++++| | ||
+ | a = b; | ||
+ | i = j; | ||
+ | ++++ | ||
+ | a[i] = 1; | ||
+ | b[j] = 2; | ||
+ | assert a[i]==1; | ||
+ | |||
+ | One possible model: ++| arrays :: $Obj \times Int \to Obj$ ++ | ||
+ | |||
+ | What is desugaring of a[i]=x ? | ||
+ | ++++| | ||
+ | array = array((a,i) := x); | ||
+ | ++++ |