add some doc#114
Conversation
| @@ -0,0 +1,16 @@ | |||
| This doc explains how structs are modelled in pal. Whenever you define a struct `foo`, PAL generates a file `Struct_foo.fst`. This file contains the following: | |||
|
|
|||
| 1. `noeq type struct_foo`: This is the F* record that is the lightweight representation of the struct. | |||
There was a problem hiding this comment.
What is "lightweight"? Maybe a running example through the file would help too!
There was a problem hiding this comment.
Yeah. I am hesitant to use the word "refinement" since it is very overloaded in this context
| This doc explains how structs are modelled in pal. Whenever you define a struct `foo`, PAL generates a file `Struct_foo.fst`. This file contains the following: | ||
|
|
||
| 1. `noeq type struct_foo`: This is the F* record that is the lightweight representation of the struct. | ||
| 2. `noeq type struct_foo__spec`: A collection of all the data that pointers in the struct point to. Marked `[@@erasable]` (ghost-only). If the struct has no pointer fields, this type — together with its `pred_unfold`/`pred_fold` ghost fns — is omitted and `struct_foo__pred` collapses to `emp`. |
There was a problem hiding this comment.
If the struct has no pointer fields, this type — together with its
pred_unfold/pred_foldghost fns — is omitted andstruct_foo__predcollapses toemp.
Is this true? I thought that for a struct like struct foo { int x; int y; } the __spec type would be something like type foo__spec = { x : Int32.t; y : Int32.t }. I.e., it still exists even if there are no pointers.
There was a problem hiding this comment.
This is true. I double checked.
There was a problem hiding this comment.
ok! I'm probably just confused. Perhaps a running example of a struct with fields of type int/int*/int** would help.
| ## See also | ||
|
|
||
| - `structs.md` / `unions.md` — what gets generated per struct / union. | ||
| - `arrays.md` — the array representation, points-to flavors, and the `_array` / `_arrayptr` distinction. |
There was a problem hiding this comment.
missing arrays.md and unions.md?
500a982 to
dce6bf0
Compare
No description provided.