Skip to content

main.aug ​

Generic types and functions · Source and specification

Files in this project

Code ​

aug
// aug-spec: "main.aug.md" explains this file. Read it before changes; refresh with aug spec.
import Formatter from types
import TextFormatter from types
import Box from types
implement Formatter with TextFormatter
resolve Formatter to formatter
print(value=formatter.title())
print(value=formatter.format<int>(value=42))
box = Box<string>(value="inside a generic box")
print(value=box.get())
aug
// aug-spec: "main.aug.md" explains this file. Read it before changes; refresh with aug spec.
import Formatter from types
import TextFormatter from types
import Box from types
implement Formatter with TextFormatter
resolve Formatter to formatter
print(value=formatter.title())
print(value=formatter.format<int>(value=42))
box = Box<string>(value="inside a generic box")
print(value=box.get())

Compiled specification ​

Interactions and sequences

Providers ​

Formatter is provided by TextFormatter. The same instance is shared.

Startup ​

It sets formatter to the instance provided for Formatter. It prints formatter.title. It prints formatter.format for int with value 42. It sets box to a Box for string with value "inside a generic box". source

It prints box.get. source

Dependencies ​

It uses Box (get), Formatter (format and title), and TextFormatter from types.

Built-in operations follow the language reference.

Last updated:

The world runs on language