Com S 641 meeting -*- Outline -*- * other standard abstractions (2.7) ------------------------------------------ OTHER STANDARD ABSTRACTIONS (2.7) syntax domain define invoke ================================== E fun I = E I C N L Example: ------------------------------------------ ... proc I = C call C const I = N I alias I = L I ... (const c = 541, alias a = loc 1); fun f = (@a = c); proc p = while not f do a := @a + 1 od in call p Q: What's an alias abstraction like in C++? reference declaration Q: Is alias abstraction the same as a variable declaration? Why not? doesn't allocate storage, merely names it. Q: Does this handle all the syntactic categories? can still do declarations, abstractions are modules (see section 2.13) ------------------------------------------ TYPING RULES Pattern: ________________________________ pi |- define I = U:{I:theta} dec pi |- invoke I:theta, if FOR YOU TO DO Give the rules for proc, const, and alias ------------------------------------------ ... pi |- U:theta ... (I:theta) \in pi After the students do this, try using one of their rules in an example: proc s = skip in call s ------------------------------------------ LAZY EVALUATION SEMANTICS [[pi |- proc I = C: {I:comm}dec]]e s = {I = p}, where p(s') = [[pi |- C:comm]]e s' [[pi |- call I:comm]]e s = p(s), where (I = p) \in e [[pi |- const I = N: {I:int}dec]]e s = {I = n}, where n = [[pi |- N:int]]e [[pi |- I:int]]e s = ------------------------------------------ ... n, where (I = n) \in e Q: Does it make a difference if we evaluate const abstracts eagerly or lazily? no, store isn't involved Q: If we have numeral abstracts, do we need eagerly-evaluated function abstracts? no..., supposing we treated bools the same way Q: Could you do location abstracts?