This commit is contained in:
Kartik Agaram 2020-09-29 03:41:05 -07:00
parent 9aea89ba73
commit f334aa73e9
1 changed files with 7 additions and 0 deletions

7
mu.md
View File

@ -470,6 +470,13 @@ type point {
Mu programs are currently sequences of `fn` and `type` definitions.
Compound types can't include `addr` types for safety (use `handle` instead).
They also can't currently include `array`, `stream` or `byte` types. Since
arrays and streams carry their size with them, supporting them in compound
types complicates variable initialization. Instead of defining them inline in
a type definition, define a `handle` to them. Bytes shouldn't be used for
anything but arrays of bytes (utf-8 strings).
To access within a compound type, use the `get` instruction. There are two
forms. You need either a variable of the type itself (say `T`) in memory, or a
variable of type `(addr T)` in a register.