Skip to content

main.aug ​

Generic dependency injection · 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 Console and SystemConsole from august.io
implement Console with SystemConsole
import Repository from types
import NumberRepository from types
import Program from types
implement Repository<int> with NumberRepository
implement app with Program
resolve app to program
program.start()
aug
// aug-spec: "main.aug.md" explains this file. Read it before changes; refresh with aug spec.
import Console and SystemConsole from august.io
implement Console with SystemConsole
import Repository from types
import NumberRepository from types
import Program from types
implement Repository<int> with NumberRepository
implement app with Program
resolve app to program
program.start()

Compiled specification ​

Interactions and sequences

Providers ​

Console is provided by SystemConsole. The same instance is shared. Repository<int> is provided by NumberRepository. The same instance is shared.

app is provided by Program. The same instance is shared. It requires bindings for Repository<int>.

Startup ​

It sets program to the instance provided for app. It calls program.start using injected Console for console. source

Dependencies ​

It uses SystemConsole from august.io. It uses NumberRepository and Program (start) from types.

Last updated:

The world runs on language