diff options
| author | Cliff Click <cliffc@acm.org> | 2026-10-03 14:03:48 -0700 |
|---|---|---|
| committer | Cliff Click <cliffc@acm.org> | 2026-10-03 14:03:48 -0700 |
| commit | 22df891893d30e9906d0b14fc3ae5d8e67d500b2 (patch) | |
| tree | 2bda142f92febc8b26f1cabd4bb0c46d1864f34b /chapter23/README.md | |
| parent | c3958e34c0de21df52e57e47e4f47ffe6464f138 (diff) | |
| download | Simple-22df891893d30e9906d0b14fc3ae5d8e67d500b2.tar.gz Simple-22df891893d30e9906d0b14fc3ae5d8e67d500b2.zip | |
Chapter renumber, and split ch 17
Renumber chapters 10a, 10b, 11, 12, 13, 14 -> 10, 11, 13, 12, [11,14].
Split ch 17 into a 17a and 17b; shuffle around im/mutable syntax to be consistent, and present it more slowly.
THe new immutable syntax is pushed through all later chapters
Diffstat (limited to 'chapter23/README.md')
| -rw-r--r-- | chapter23/README.md | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/chapter23/README.md b/chapter23/README.md index debbf6dc..ee17f9f2 100644 --- a/chapter23/README.md +++ b/chapter23/README.md @@ -46,7 +46,7 @@ Also in this chapter we revisit our Types and make some major changes: etc; only the implementation details change. -The lazy memory model from Chapter 10b continues through the new type system. +The lazy memory model from Chapter 11 continues through the new type system. BulkMemPhi/MemPhi discover aliases during optimization. Each New covers only instance fields; class-wide (`_one`) fields are excluded from its partial memory. Field offsets stay symbolic until layout, and Loads retain cyclic field types @@ -69,10 +69,10 @@ Let's look at our `String.indexOf` example above. Here we define a `String` with an `indexOf` method; a hidden argument string `self` is passed in and searched. What is the type of `struct String`? -`struct String { u8[~] buf; { String self, u8 c -> int } indexOf; }` +`struct String { u8[~] buf; { !String !self, u8 c -> int } indexOf; }` It is the type named `String` with a field `u8[~] buf` and a final assigned -constant field `indexOf`, itself with type `{ String self, u8 c -> int }`. +constant field `indexOf`, itself with type `{ !String !self, u8 c -> int }`. i.e., the type of `String` has a reference to itself, nested inside the type of `indexOf`.... i.e. `String`'s type is *cyclic*. @@ -100,7 +100,7 @@ Here's an example, a Linked List with a Java `Object` or a C `void*` payload: ```java struct List { - List next; + !List !next; Object payload; // equivalently for C: void* } // Then walk a collection of ints and build a List: @@ -180,7 +180,7 @@ alternatives) but it is a great tutorial data structure. ```java struct List { - List? !next; // Next pointer or null + !List? !next; // Next pointer or null str !name; // Payload }; ``` @@ -322,7 +322,7 @@ of simplicity we choose to approximate our types to only a single instance of In this example on first visit of `List` we will miss in `VISIT`. The next call to `ts = recurPre(_name,_open)` does common shared pre-recursive work: we make a new `TypeStruct` and **set** it in the `VISIT` table. The new `TypeStruct` -is a blank version of `List` with all fields attached; we force these fields to +is a blank version of `List` with all !fields !attached; we force these fields to be final right away but they are missing their types: ``` |
