Demo Linear Types

Run Settings
LanguageATS
Language Version
Run Command
absvtype cake = ptr // declare cake as a linear resource extern fun produce_cake (): cake // produce a cake, linear extern fun take_picture (!cake): void // take a picture of the cake, does not consume it, denoted as ! extern fun eat (cake): void // eat a cake, consume it implement main0 () = let val cake = produce_cake () val _ = take_picture (cake) // ok val _ = take_picture (cake) // ok val _ = eat (cake) // ok val _ = eat (cake) // WRONG: the cake is consumed in the last line. // it is no longer available in the typing environment at this line. in end
Editor Settings
Theme
Key bindings
Full width
Lines