Changes between Version 11 and Version 12 of IR2


Ignore:
Timestamp:
04/19/21 15:42:08 (5 years ago)
Author:
siegel
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • IR2

    v11 v12  
    1919* `$mem` : set of memory locations
    2020* `enum tag` : enumerated type
    21 * `struct tag` : structured type
     21* `struct tag` : structured type, can also be used for "tuples"
    2222* `union tag` : union type
    2323* `T[]` : array of T
    2424* `void *` : pointer to anything
    2525* `T *` : pointer to T
    26 * `T(T1, ..., Tn)` : function consuming T1, ..., Tn and returning T
     26* `T(T1, ..., Tn)` : function (aka procedure) consuming T1, ..., Tn and returning T
    2727* `$seq<T>` : sequence of T
    2828* `$set<T>` : set of T
     
    3131
    3232Notes
    33 * Sequences, sets, maps, and relations are mutable.  Is assignment by reference?
    34 * the difference between the array type and the sequence type is that elements of an array are addressable, i.e., one can form a pointer such as `&a[i]`.  This is not possible with sequences, sets, maps, or relations.
    35 * the difference between the function type and map type: a function is really a procedure in the language, so it can modify the state as well as return a value.   A map is a logical partial function: it is defined on some subset of the domain type, it will always "return" the save value on a given input, it cannot modify the state.
     33* Sequences, sets, maps, and relations are immutable.   An assignment using objects of this type creates a new copy of the object, just as with primitive types like `int`.
     34* The main difference between the array type and the sequence type is that elements of an array are addressable, i.e., one can form a pointer such as `&a[i]`.  This is not possible with sequences, sets, maps, or relations---there is no way to have a pointer to any component of such a type.
     35* The difference between the function type and map type: a function is really a procedure in the language, so it can modify the state as well as return a value.    This is like the C notion of "function".   A map is a logical partial function: it is defined on some subset of the domain type, it will always "return" the same value on a given input, and reading it cannot modify the state.
    3636
    3737Questions