interface Priced { fn current_price() -> Int } @table(name: "products", index: [sku]) class Product { id: Id sku: Text @unique name: Text prices: multi Price owner: ref Customer fn current_price() -> Int { return latest(self.prices).amount; } fn rename(name: Text) { self.name = name; } fn set_price(mut amount: Int) { self.prices = amount; } fn adopt(take other: Product) -> Product { return other; } } @gc class PriceCache { entries: map } type Note { id: Id body: Text created: Timestamp = now() } fn discount(mut amount: Int, take pct: Int) -> Int { return amount; }