Changes between Version 96 and Version 97 of IR2


Ignore:
Timestamp:
05/13/21 14:34:39 (5 years ago)
Author:
siegel
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • IR2

    v96 v97  
    247247* Comparisons likes `==` and `<` return a `$bool` (not an int, like C).
    248248* Every object holds a value of its declared type, always.   There is no notion of "trap representation", as in C.
    249 * For every operation, there is a way to determine if performing that operation is safe.
     249* Evaluation of an expression always results in a value of the type of that expressions.  There are no "exceptions".
     250* For some operations, the result of applying the operation on certain inputs in unspecified.  We say those applications are "unsafe".   The result of an unsafe operation is unspecified, but will result in some value of the appropriate type.   If an application is not unsafe, it is "safe".
     251* For every operation, there is a way to determine if performing that operation is safe.  Hence an assertion on a certain expression can be checked before performing the operation.   Examples:
     252  * `a+b`, for the $int, $real, or float types: always safe
    250253  * `a/b`: `b!=0`
    251254  * `p+i` (pointer arithmetic): `$summable(p, i)`
     
    253256  * `p-q` (pointer subtraction): `$subtractable(p,q)`
    254257  * `(T)e` (cast): `$castable(e, T)`
    255   * `*p`: `$valid(p)` --- this means it is safe to write to `*p`.  (It may not be safe to read `*p` because the object pointed to by p may not yet have been initialized.)
    256 * The result of an unsafe operation is unspecified, but will result in some value of the appropriate type.
     258  * `*p`: `$valid(p)` --- this means it is safe to write to `*p`.  (It may not be safe to read `*p` because the object pointed to by `p` may not yet have been initialized.)
    257259* Explanation of `$defined`:
    258260  * A bit is associated to each object.  We say an object is "defined" if the bit is true, else it is undefined.
    259261  * An object is initially undefined.  It becomes defined by assignment.   If the right hand side of the assignment involves undefined objects, it is unspecified whether the left hand side will be defined.
    260   * Objects of pointer type are special in that they can change from defined to undefined.  This happens when the object into which they point is deallocated or goes out of scope.
     262  * Objects of pointer type can change from defined to undefined.  This happens when the object into which they point is deallocated or goes out of scope.  Likewise, an object of `$proc` type becomes undefined when a call to `$wait` on the process returns.
    261263  * An object of array type becomes defined when assigned a `$new_array`.  However, its elements are undefined.
    262264  * An object of array type also becomes defined when assigned a `$new` value.  In that case, the elements are also defined.