Skip to content

types.aug ​

Generic types and functions · Source and specification

Files in this project

Code ​

aug
// aug-spec: "types.aug.md" explains this file. Read it before changes; refresh with aug spec.
interface Formatter:
    format<T>(T value) returns string
    title():
        return "formatted"
TextFormatter() implements Formatter:
    format<T>(T value):
        return "generic method called"
Box<T>(T value) implements IBox<T>:
    get():
        return value
interface IBox<T>:
    get() returns T
aug
// aug-spec: "types.aug.md" explains this file. Read it before changes; refresh with aug spec.
interface Formatter {
    format<T>(T value) returns string
    title() {
        return "formatted"
    }
}
TextFormatter() implements Formatter {
    format<T>(T value) {
        return "generic method called"
    }
}
Box<T>(T value) implements IBox<T> {
    get() {
        return value
    }
}
interface IBox<T> {
    get() returns T
}

Compiled specification ​

Interactions and sequences

Formatter · interface · source ​

Formatter.format · source ​

The type parameters are T. It takes value as T. It returns string.

Formatter.title · source ​

It returns "formatted". source

Checked interface
text
title() returns string

TextFormatter · class · source ​

It implements Formatter. It inherits the default implementations of Formatter.title.

TextFormatter.format · source ​

It takes value as T. It returns "generic method called". source

Checked interface
text
format<T>(T value) returns string

The type parameters are T. It takes value as T.

Box · class · source ​

It implements IBox<T>. The type parameters are T. It takes value as T, kept read-only.

Box.get · source ​

It returns value. source

Checked interface
text
get() returns T

IBox · interface · source ​

The type parameters are T.

IBox.get · source ​

It returns T.

Last updated:

The world runs on language