@greenpandastudios/aug-cli 0.20.1 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/docs/assets/benchmarks/execution.svg +774 -637
- package/docs/assets/benchmarks/http.svg +278 -249
- package/docs/assets/benchmarks/improvements.svg +66 -66
- package/docs/assets/benchmarks/kernels-mobile.svg +1 -0
- package/docs/assets/benchmarks/kernels.svg +1 -0
- package/docs/assets/benchmarks/memory.svg +153 -153
- package/docs/benchmark-results.json +227089 -90363
- package/docs/compatibility.md +6 -6
- package/docs/contributing-benchmarks.md +36 -6
- package/docs/dev-containers.md +8 -15
- package/docs/dgx-consumers.json +122 -0
- package/docs/dgx-gyms.json +784 -0
- package/docs/dgx-kernels.json +1170 -0
- package/docs/dgx-performance.json +227849 -0
- package/docs/dgx-spark.md +64 -0
- package/docs/diagnostics.md +1 -1
- package/docs/docker.md +16 -17
- package/docs/example-projects.json +32 -0
- package/docs/examples/approved-design/dependencies/august/{0.20.1 → 0.21.0}/io/contracts.md +3 -3
- package/docs/examples/approved-design/domain/app.md +4 -4
- package/docs/examples/approved-design/main.md +2 -2
- package/docs/examples/calls-benchmark/index.md +36 -0
- package/docs/examples/calls-benchmark/main.md +78 -0
- package/docs/examples/calls-benchmark/operations.md +60 -0
- package/docs/examples/developer-workflow/calculator.md +5 -5
- package/docs/examples/developer-workflow/dependencies/august/{0.20.1 → 0.21.0}/io/contracts.md +3 -3
- package/docs/examples/developer-workflow/logging/console.md +2 -2
- package/docs/examples/developer-workflow/logging/logger.md +2 -2
- package/docs/examples/developer-workflow/main.md +2 -2
- package/docs/examples/errors-benchmark/index.md +36 -0
- package/docs/examples/errors-benchmark/main.md +92 -0
- package/docs/examples/errors-benchmark/operations.md +65 -0
- package/docs/examples/float-benchmark/index.md +35 -0
- package/docs/examples/float-benchmark/main.md +75 -0
- package/docs/examples/generic-di/dependencies/august/{0.20.1 → 0.21.0}/io/contracts.md +3 -3
- package/docs/examples/generic-di/main.md +2 -2
- package/docs/examples/generic-di/types.md +3 -3
- package/docs/examples/hello/app/greeter.md +3 -3
- package/docs/examples/hello/dependencies/august/{0.20.1 → 0.21.0}/io/contracts.md +3 -3
- package/docs/examples/hello/logging/console.md +2 -2
- package/docs/examples/hello/logging/logger.md +2 -2
- package/docs/examples/hello/main.md +2 -2
- package/docs/examples/index.md +18 -1
- package/docs/examples/interceptors/app.md +5 -5
- package/docs/examples/interceptors/dependencies/august/{0.20.1 → 0.21.0}/io/contracts.md +3 -3
- package/docs/examples/interceptors/interceptors.md +2 -2
- package/docs/examples/interceptors/logging.md +3 -3
- package/docs/examples/interceptors/main.md +2 -2
- package/docs/examples/list-benchmark/index.md +35 -0
- package/docs/examples/list-benchmark/main.md +78 -0
- package/docs/examples/map-churn-benchmark/index.md +35 -0
- package/docs/examples/map-churn-benchmark/main.md +106 -0
- package/docs/examples/native-blake3/dependencies/packages/@greenpandastudios/aug-blake3/0.1.3/api.md +104 -0
- package/docs/examples/native-blake3/dependencies/packages/@greenpandastudios/aug-blake3/0.1.3/contracts.md +54 -0
- package/docs/examples/native-blake3/dependencies/packages/@greenpandastudios/aug-blake3/0.1.3/native.abi-json.md +48 -0
- package/docs/examples/native-blake3/hashing.md +93 -0
- package/docs/examples/native-blake3/index.md +38 -0
- package/docs/examples/native-blake3/main.md +73 -0
- package/docs/examples/native-pytorch/dependencies/packages/@greenpandastudios/aug-pytorch/0.1.4/api.md +406 -0
- package/docs/examples/native-pytorch/dependencies/packages/@greenpandastudios/aug-pytorch/0.1.4/bindings.md +51 -0
- package/docs/examples/native-pytorch/dependencies/packages/@greenpandastudios/aug-pytorch/0.1.4/contracts.md +63 -0
- package/docs/examples/native-pytorch/dependencies/packages/@greenpandastudios/aug-pytorch/0.1.4/native.abi-json.md +161 -0
- package/docs/examples/native-pytorch/index.md +38 -0
- package/docs/examples/native-pytorch/main.md +73 -0
- package/docs/examples/native-pytorch/tensors.md +123 -0
- package/docs/examples/native-sqlite/database.md +116 -0
- package/docs/examples/native-sqlite/dependencies/packages/@greenpandastudios/aug-sqlite/0.1.3/api.md +284 -0
- package/docs/examples/native-sqlite/dependencies/packages/@greenpandastudios/aug-sqlite/0.1.3/bindings.md +51 -0
- package/docs/examples/native-sqlite/dependencies/packages/@greenpandastudios/aug-sqlite/0.1.3/contracts.md +75 -0
- package/docs/examples/native-sqlite/dependencies/packages/@greenpandastudios/aug-sqlite/0.1.3/native.abi-json.md +119 -0
- package/docs/examples/native-sqlite/index.md +38 -0
- package/docs/examples/native-sqlite/main.md +73 -0
- package/docs/examples/native-zlib/compression.md +99 -0
- package/docs/examples/native-zlib/dependencies/packages/@greenpandastudios/aug-zlib/0.1.3/api.md +153 -0
- package/docs/examples/native-zlib/dependencies/packages/@greenpandastudios/aug-zlib/0.1.3/contracts.md +54 -0
- package/docs/examples/native-zlib/dependencies/packages/@greenpandastudios/aug-zlib/0.1.3/native.abi-json.md +76 -0
- package/docs/examples/native-zlib/index.md +38 -0
- package/docs/examples/native-zlib/main.md +78 -0
- package/docs/examples/new-syntax/console.md +2 -2
- package/docs/examples/new-syntax/dependencies/august/{0.20.1 → 0.21.0}/io/contracts.md +3 -3
- package/docs/examples/new-syntax/greeter.md +3 -3
- package/docs/examples/new-syntax/logger.md +2 -2
- package/docs/examples/new-syntax/main.md +2 -2
- package/docs/examples/ownership-transfer/dependencies/august/{0.20.1 → 0.21.0}/io/contracts.md +3 -3
- package/docs/examples/ownership-transfer/main.md +2 -2
- package/docs/examples/ownership-transfer/resource.md +2 -2
- package/docs/examples/packages-math/aug-package-json.md +1 -1
- package/docs/examples/records-benchmark/data.md +55 -0
- package/docs/examples/records-benchmark/index.md +36 -0
- package/docs/examples/records-benchmark/main.md +85 -0
- package/docs/examples/strings-benchmark/index.md +35 -0
- package/docs/examples/strings-benchmark/main.md +76 -0
- package/docs/examples/tasks-benchmark/index.md +36 -0
- package/docs/examples/tasks-benchmark/main.md +89 -0
- package/docs/examples/tasks-benchmark/operations.md +58 -0
- package/docs/getting-started.md +3 -3
- package/docs/grammar.md +2 -2
- package/docs/gym-results.json +784 -0
- package/docs/implementation-map.md +6 -0
- package/docs/index.md +1 -1
- package/docs/kernel-results.json +1170 -0
- package/docs/language-conformance.md +6 -0
- package/docs/language-constructs.md +9 -1
- package/docs/learn/index.md +1 -1
- package/docs/maintaining-docs.md +1 -1
- package/docs/native-implementation.md +276 -0
- package/docs/native-interop-llvm-plan.md +342 -0
- package/docs/native-package-examples.md +684 -0
- package/docs/native-packages.md +179 -0
- package/docs/packages.md +2 -2
- package/docs/performance.md +50 -29
- package/docs/production-readiness.md +11 -1
- package/docs/public/downloads/approved-design.zip +0 -0
- package/docs/public/downloads/calls-benchmark.zip +0 -0
- package/docs/public/downloads/developer-workflow.zip +0 -0
- package/docs/public/downloads/errors-benchmark.zip +0 -0
- package/docs/public/downloads/float-benchmark.zip +0 -0
- package/docs/public/downloads/generic-di.zip +0 -0
- package/docs/public/downloads/hello.zip +0 -0
- package/docs/public/downloads/interceptors.zip +0 -0
- package/docs/public/downloads/json-benchmark.zip +0 -0
- package/docs/public/downloads/list-benchmark.zip +0 -0
- package/docs/public/downloads/map-churn-benchmark.zip +0 -0
- package/docs/public/downloads/native-blake3.zip +0 -0
- package/docs/public/downloads/native-pytorch.zip +0 -0
- package/docs/public/downloads/native-sqlite.zip +0 -0
- package/docs/public/downloads/native-zlib.zip +0 -0
- package/docs/public/downloads/new-syntax.zip +0 -0
- package/docs/public/downloads/oidc-login.zip +0 -0
- package/docs/public/downloads/ownership-transfer.zip +0 -0
- package/docs/public/downloads/packages-app.zip +0 -0
- package/docs/public/downloads/packages-math.zip +0 -0
- package/docs/public/downloads/records-benchmark.zip +0 -0
- package/docs/public/downloads/strings-benchmark.zip +0 -0
- package/docs/public/downloads/tasks-benchmark.zip +0 -0
- package/docs/qualification-results.md +66 -0
- package/docs/reference.md +24 -0
- package/docs/releasing.md +81 -6
- package/docs/research/libtorch-native-qualification.md +115 -0
- package/docs/research/native-interop-llvm.md +197 -0
- package/docs/research/qualification-methods.md +15 -0
- package/docs/roadmap.md +1 -0
- package/docs/safety-gyms.md +41 -0
- package/docs/tooling.md +16 -15
- package/docs/web-library-gaps.md +1 -1
- package/docs/web.md +4 -0
- package/examples/approved-design/.aug-spec/manifest.json +3 -3
- package/examples/approved-design/domain/app.aug.md +4 -4
- package/examples/approved-design/main.aug.md +2 -2
- package/examples/developer-workflow/.aug-spec/manifest.json +3 -3
- package/examples/developer-workflow/calculator.aug.md +5 -5
- package/examples/developer-workflow/logging/console.aug.md +2 -2
- package/examples/developer-workflow/logging/logger.aug.md +2 -2
- package/examples/developer-workflow/main.aug.md +2 -2
- package/examples/generic-di/.aug-spec/manifest.json +3 -3
- package/examples/generic-di/main.aug.md +2 -2
- package/examples/generic-di/types.aug.md +3 -3
- package/examples/hello/.aug-spec/manifest.json +3 -3
- package/examples/hello/app/greeter.aug.md +3 -3
- package/examples/hello/logging/console.aug.md +2 -2
- package/examples/hello/logging/logger.aug.md +2 -2
- package/examples/hello/main.aug.md +2 -2
- package/examples/interceptors/.aug-spec/manifest.json +3 -3
- package/examples/interceptors/app.aug.md +5 -5
- package/examples/interceptors/interceptors.aug.md +2 -2
- package/examples/interceptors/logging.aug.md +3 -3
- package/examples/interceptors/main.aug.md +2 -2
- package/examples/native-blake3/.aug-spec/manifest.json +16 -0
- package/examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.1/native.abi.json +29 -0
- package/examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.3/api.aug +14 -0
- package/examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.3/api.aug.md +34 -0
- package/examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.3/contracts.aug +4 -0
- package/examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.3/contracts.aug.md +8 -0
- package/examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.3/native.abi.json +29 -0
- package/examples/native-blake3/AGENTS.md +5 -0
- package/examples/native-blake3/aug.lock.json +253 -0
- package/examples/native-blake3/hashing.aug +11 -0
- package/examples/native-blake3/hashing.aug.md +25 -0
- package/examples/native-blake3/main.aug +8 -0
- package/examples/native-blake3/main.aug.md +13 -0
- package/examples/native-pytorch/.aug-spec/manifest.json +18 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.1/native.abi.json +142 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.3/native.abi.json +142 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/api.aug +101 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/api.aug.md +160 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/bindings.aug +3 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/bindings.aug.md +8 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/contracts.aug +6 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/contracts.aug.md +13 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/native.abi.json +142 -0
- package/examples/native-pytorch/AGENTS.md +5 -0
- package/examples/native-pytorch/aug.lock.json +309 -0
- package/examples/native-pytorch/main.aug +8 -0
- package/examples/native-pytorch/main.aug.md +13 -0
- package/examples/native-pytorch/tensors.aug +23 -0
- package/examples/native-pytorch/tensors.aug.md +35 -0
- package/examples/native-sqlite/.aug-spec/manifest.json +18 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.2/native.abi.json +100 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/api.aug +48 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/api.aug.md +91 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/bindings.aug +3 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/bindings.aug.md +8 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/contracts.aug +8 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/contracts.aug.md +22 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/native.abi.json +100 -0
- package/examples/native-sqlite/AGENTS.md +5 -0
- package/examples/native-sqlite/aug.lock.json +236 -0
- package/examples/native-sqlite/database.aug +15 -0
- package/examples/native-sqlite/database.aug.md +27 -0
- package/examples/native-sqlite/main.aug +8 -0
- package/examples/native-sqlite/main.aug.md +13 -0
- package/examples/native-zlib/.aug-spec/manifest.json +16 -0
- package/examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.1/native.abi.json +57 -0
- package/examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.3/api.aug +29 -0
- package/examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.3/api.aug.md +54 -0
- package/examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.3/contracts.aug +4 -0
- package/examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.3/contracts.aug.md +8 -0
- package/examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.3/native.abi.json +57 -0
- package/examples/native-zlib/AGENTS.md +5 -0
- package/examples/native-zlib/aug.lock.json +236 -0
- package/examples/native-zlib/compression.aug +15 -0
- package/examples/native-zlib/compression.aug.md +27 -0
- package/examples/native-zlib/main.aug +10 -0
- package/examples/native-zlib/main.aug.md +13 -0
- package/examples/new-syntax/.aug-spec/manifest.json +3 -3
- package/examples/new-syntax/console.aug.md +2 -2
- package/examples/new-syntax/greeter.aug.md +3 -3
- package/examples/new-syntax/logger.aug.md +2 -2
- package/examples/new-syntax/main.aug.md +2 -2
- package/examples/oidc-login/aug.lock.json +6 -6
- package/examples/ownership-transfer/.aug-spec/manifest.json +3 -3
- package/examples/ownership-transfer/main.aug.md +2 -2
- package/examples/ownership-transfer/resource.aug.md +2 -2
- package/examples/packages/math/aug-package.json +1 -1
- package/native/compiler-packs.json +43 -0
- package/package.json +3 -2
- package/runtime/aug_http.c +48 -21
- package/runtime/aug_http_ir.c +30 -0
- package/runtime/aug_http_ir.h +18 -0
- package/runtime/aug_ir.c +209 -0
- package/runtime/aug_ir.h +89 -0
- package/runtime/aug_json.c +6 -1
- package/runtime/aug_runtime.c +82 -16
- package/runtime/aug_runtime.h +16 -2
- package/runtime/aug_tasks.c +38 -7
- package/runtime/aug_values.c +12 -6
- package/scripts/bootstrap-native.mjs +4 -1
- package/src/ast.js +1 -1
- package/src/checker.js +110 -28
- package/src/cli.js +92 -14
- package/src/codegen.js +31 -6
- package/src/compiler-packs.js +66 -0
- package/src/config.js +2 -2
- package/src/editor.js +15 -6
- package/src/formatter.js +4 -2
- package/src/git-http.js +137 -0
- package/src/git-packages.js +9 -1
- package/src/help.js +10 -2
- package/src/ir-types.js +5 -0
- package/src/ir-verify.js +277 -0
- package/src/ir.js +962 -0
- package/src/llvm-debug.js +101 -0
- package/src/llvm-native.js +152 -0
- package/src/llvm-platform.js +20 -0
- package/src/llvm.js +781 -0
- package/src/native-artifacts.js +207 -0
- package/src/native-bindings.js +189 -0
- package/src/native-contracts.js +295 -0
- package/src/native-declarations.js +68 -0
- package/src/native-facts.js +63 -0
- package/src/package-locking.js +43 -0
- package/src/package-manager.js +23 -8
- package/src/parser.js +20 -2
- package/src/project.js +2 -2
- package/src/runtime-abi.js +23 -0
- package/src/runtime-adapters.js +18 -0
- package/src/schemas.js +24 -17
- package/src/semantic.js +8 -3
- package/src/snippets.js +1 -0
- package/src/spec.js +49 -8
- /package/examples/approved-design/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug +0 -0
- /package/examples/approved-design/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug.md +0 -0
- /package/examples/developer-workflow/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug +0 -0
- /package/examples/developer-workflow/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug.md +0 -0
- /package/examples/generic-di/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug +0 -0
- /package/examples/generic-di/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug.md +0 -0
- /package/examples/hello/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug +0 -0
- /package/examples/hello/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug.md +0 -0
- /package/examples/interceptors/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug +0 -0
- /package/examples/interceptors/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug.md +0 -0
- /package/examples/new-syntax/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug +0 -0
- /package/examples/new-syntax/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug.md +0 -0
- /package/examples/ownership-transfer/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug +0 -0
- /package/examples/ownership-transfer/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug.md +0 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "main.aug · Checked-error benchmark"
|
|
3
|
+
generated: true
|
|
4
|
+
source: "benchmarks/errors/main.aug"
|
|
5
|
+
editLink: false
|
|
6
|
+
prev: false
|
|
7
|
+
next: false
|
|
8
|
+
outline: [2, 3]
|
|
9
|
+
pageClass: aug-example-page
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# `main.aug`
|
|
13
|
+
|
|
14
|
+
[Checked-error benchmark](index.md) · Source and specification
|
|
15
|
+
|
|
16
|
+
::: details Files in this project
|
|
17
|
+
|
|
18
|
+
- [`main.aug`](main.md)
|
|
19
|
+
- [`operations.aug`](operations.md)
|
|
20
|
+
|
|
21
|
+
:::
|
|
22
|
+
|
|
23
|
+
::::: example-compare
|
|
24
|
+
|
|
25
|
+
:::: example-code
|
|
26
|
+
|
|
27
|
+
## Code {#code}
|
|
28
|
+
|
|
29
|
+
::: code-group
|
|
30
|
+
|
|
31
|
+
```aug [Indentation]
|
|
32
|
+
// aug-spec: "main.aug.md" explains this file. Read it before changes; refresh with aug spec.
|
|
33
|
+
import validate from operations
|
|
34
|
+
int iterations = 20000
|
|
35
|
+
int index = 0
|
|
36
|
+
int checksum = 0
|
|
37
|
+
int failures = 0
|
|
38
|
+
while index < iterations:
|
|
39
|
+
try:
|
|
40
|
+
checksum = checksum + validate(value=index)
|
|
41
|
+
catch FileError error:
|
|
42
|
+
failures = failures + 1
|
|
43
|
+
index = index + 1
|
|
44
|
+
print(value=checksum)
|
|
45
|
+
print(value=failures)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
```aug [Braces]
|
|
49
|
+
// aug-spec: "main.aug.md" explains this file. Read it before changes; refresh with aug spec.
|
|
50
|
+
import validate from operations
|
|
51
|
+
int iterations = 20000
|
|
52
|
+
int index = 0
|
|
53
|
+
int checksum = 0
|
|
54
|
+
int failures = 0
|
|
55
|
+
while index < iterations {
|
|
56
|
+
try {
|
|
57
|
+
checksum = checksum + validate(value=index)
|
|
58
|
+
}
|
|
59
|
+
catch FileError error {
|
|
60
|
+
failures = failures + 1
|
|
61
|
+
}
|
|
62
|
+
index = index + 1
|
|
63
|
+
}
|
|
64
|
+
print(value=checksum)
|
|
65
|
+
print(value=failures)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
:::
|
|
69
|
+
|
|
70
|
+
::::
|
|
71
|
+
|
|
72
|
+
:::: example-spec
|
|
73
|
+
|
|
74
|
+
## Compiled specification {#specification}
|
|
75
|
+
|
|
76
|
+
### Startup
|
|
77
|
+
|
|
78
|
+
It sets `iterations` to `20000`. It sets `index`, `checksum`, and `failures` separately, each to `0`.
|
|
79
|
+
|
|
80
|
+
While `index` is less than `iterations`, it tries to increase `checksum` by [`validate`](operations.md#symbol-validate) with `value` from `index`. If this work raises `FileError`, it increases `failures` by `1`. It increases `index` by `1`. After the loop, it prints `checksum`.
|
|
81
|
+
|
|
82
|
+
It prints `failures`.
|
|
83
|
+
|
|
84
|
+
### Dependencies
|
|
85
|
+
|
|
86
|
+
It uses [`validate`](operations.md#symbol-validate) from `operations`.
|
|
87
|
+
|
|
88
|
+
Built-in operations follow the [language reference](https://greenpandastudios.github.io/augscript/language-constructs).
|
|
89
|
+
|
|
90
|
+
::::
|
|
91
|
+
|
|
92
|
+
:::::
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "operations.aug · Checked-error benchmark"
|
|
3
|
+
generated: true
|
|
4
|
+
source: "benchmarks/errors/operations.aug"
|
|
5
|
+
editLink: false
|
|
6
|
+
prev: false
|
|
7
|
+
next: false
|
|
8
|
+
outline: [2, 3]
|
|
9
|
+
pageClass: aug-example-page
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# `operations.aug`
|
|
13
|
+
|
|
14
|
+
[Checked-error benchmark](index.md) · Source and specification
|
|
15
|
+
|
|
16
|
+
::: details Files in this project
|
|
17
|
+
|
|
18
|
+
- [`main.aug`](main.md)
|
|
19
|
+
- [`operations.aug`](operations.md)
|
|
20
|
+
|
|
21
|
+
:::
|
|
22
|
+
|
|
23
|
+
::::: example-compare
|
|
24
|
+
|
|
25
|
+
:::: example-code
|
|
26
|
+
|
|
27
|
+
## Code {#code}
|
|
28
|
+
|
|
29
|
+
::: code-group
|
|
30
|
+
|
|
31
|
+
```aug [Indentation]
|
|
32
|
+
// aug-spec: "operations.aug.md" explains this file. Read it before changes; refresh with aug spec.
|
|
33
|
+
validate(int value) returns int unless FileError:
|
|
34
|
+
if value - value / 16 * 16 == 0:
|
|
35
|
+
throw FileError()
|
|
36
|
+
return value
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
```aug [Braces]
|
|
40
|
+
// aug-spec: "operations.aug.md" explains this file. Read it before changes; refresh with aug spec.
|
|
41
|
+
validate(int value) returns int unless FileError {
|
|
42
|
+
if value - value / 16 * 16 == 0 {
|
|
43
|
+
throw FileError()
|
|
44
|
+
}
|
|
45
|
+
return value
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
:::
|
|
50
|
+
|
|
51
|
+
::::
|
|
52
|
+
|
|
53
|
+
:::: example-spec
|
|
54
|
+
|
|
55
|
+
## Compiled specification {#specification}
|
|
56
|
+
|
|
57
|
+
### `validate` · [source](operations.md#code) {#symbol-validate}
|
|
58
|
+
|
|
59
|
+
It takes `value` as an integer. Failures can raise `FileError`.
|
|
60
|
+
|
|
61
|
+
It checks that (`value` minus ((`value` divided by `16`) times `16`)) does not equal `0`. It raises a `FileError` at the first failed check. It returns `value`.
|
|
62
|
+
|
|
63
|
+
::::
|
|
64
|
+
|
|
65
|
+
:::::
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Floating-point benchmark"
|
|
3
|
+
generated: true
|
|
4
|
+
source: "benchmarks/float"
|
|
5
|
+
editLink: false
|
|
6
|
+
prev: false
|
|
7
|
+
next: false
|
|
8
|
+
outline: [2, 3]
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Floating-point benchmark
|
|
12
|
+
|
|
13
|
+
Accumulate exact binary fractions and check the final value.
|
|
14
|
+
|
|
15
|
+
Open a file to read its source beside the explanation produced by `aug spec`. **Indentation** and **Braces** display the same checked program; your choice carries across file pages.
|
|
16
|
+
|
|
17
|
+
## Project files
|
|
18
|
+
|
|
19
|
+
- [`main.aug`](main.md)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## Try this project
|
|
23
|
+
|
|
24
|
+
[Download this project](/downloads/float-benchmark.zip), then extract the archive in an empty working folder. It contains the checked source, configuration, and generated specs. [Install August](../../getting-started.md) once, then run these commands. Native libraries are prepared automatically when needed:
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
cd float-benchmark
|
|
28
|
+
aug check .
|
|
29
|
+
aug spec .
|
|
30
|
+
aug run .
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
See [the performance page](../../performance.md) for measurements, input sizes, and reproduction steps.
|
|
34
|
+
|
|
35
|
+
[Browse all examples](../index.md)
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "main.aug · Floating-point benchmark"
|
|
3
|
+
generated: true
|
|
4
|
+
source: "benchmarks/float/main.aug"
|
|
5
|
+
editLink: false
|
|
6
|
+
prev: false
|
|
7
|
+
next: false
|
|
8
|
+
outline: [2, 3]
|
|
9
|
+
pageClass: aug-example-page
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# `main.aug`
|
|
13
|
+
|
|
14
|
+
[Floating-point benchmark](index.md) · Source and specification
|
|
15
|
+
|
|
16
|
+
::: details Files in this project
|
|
17
|
+
|
|
18
|
+
- [`main.aug`](main.md)
|
|
19
|
+
|
|
20
|
+
:::
|
|
21
|
+
|
|
22
|
+
::::: example-compare
|
|
23
|
+
|
|
24
|
+
:::: example-code
|
|
25
|
+
|
|
26
|
+
## Code {#code}
|
|
27
|
+
|
|
28
|
+
::: code-group
|
|
29
|
+
|
|
30
|
+
```aug [Indentation]
|
|
31
|
+
// aug-spec: "main.aug.md" explains this file. Read it before changes; refresh with aug spec.
|
|
32
|
+
int iterations = 1000000
|
|
33
|
+
float sum = 0.0
|
|
34
|
+
int index = 0
|
|
35
|
+
while index < iterations:
|
|
36
|
+
int remainder = index - index / 8 * 8
|
|
37
|
+
sum = sum + remainder * 0.125 + 0.5
|
|
38
|
+
index = index + 1
|
|
39
|
+
print(value=sum == 937500.0)
|
|
40
|
+
print(value=iterations)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
```aug [Braces]
|
|
44
|
+
// aug-spec: "main.aug.md" explains this file. Read it before changes; refresh with aug spec.
|
|
45
|
+
int iterations = 1000000
|
|
46
|
+
float sum = 0.0
|
|
47
|
+
int index = 0
|
|
48
|
+
while index < iterations {
|
|
49
|
+
int remainder = index - index / 8 * 8
|
|
50
|
+
sum = sum + remainder * 0.125 + 0.5
|
|
51
|
+
index = index + 1
|
|
52
|
+
}
|
|
53
|
+
print(value=sum == 937500.0)
|
|
54
|
+
print(value=iterations)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
:::
|
|
58
|
+
|
|
59
|
+
::::
|
|
60
|
+
|
|
61
|
+
:::: example-spec
|
|
62
|
+
|
|
63
|
+
## Compiled specification {#specification}
|
|
64
|
+
|
|
65
|
+
### Startup
|
|
66
|
+
|
|
67
|
+
It sets `iterations` to `1000000`. It sets `sum` to `0.0`. It sets `index` to `0`. While `index` is less than `iterations`, it sets `remainder` to `index` minus ((`index` divided by `8`) times `8`); then it sets `sum` to (`sum` plus (`remainder` times `0.125`)) plus `0.5`; then it increases `index` by `1`.
|
|
68
|
+
|
|
69
|
+
After the loop, it prints `sum` equals `937500.0`. It prints `iterations`.
|
|
70
|
+
|
|
71
|
+
Built-in operations follow the [language reference](https://greenpandastudios.github.io/augscript/language-constructs).
|
|
72
|
+
|
|
73
|
+
::::
|
|
74
|
+
|
|
75
|
+
:::::
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "august/0.
|
|
2
|
+
title: "august/0.21.0/io/contracts.aug · Generic dependency injection"
|
|
3
3
|
generated: true
|
|
4
|
-
source: "examples/generic-di/.aug-spec/august/0.
|
|
4
|
+
source: "examples/generic-di/.aug-spec/august/0.21.0/io/contracts.aug"
|
|
5
5
|
editLink: false
|
|
6
6
|
prev: false
|
|
7
7
|
next: false
|
|
@@ -10,7 +10,7 @@ search: false
|
|
|
10
10
|
pageClass: aug-example-page
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
-
# `august/0.
|
|
13
|
+
# `august/0.21.0/io/contracts.aug`
|
|
14
14
|
|
|
15
15
|
[Generic dependency injection](../../../../index.md) · Dependency source and specification
|
|
16
16
|
|
|
@@ -64,7 +64,7 @@ program.start()
|
|
|
64
64
|
|
|
65
65
|
### Providers
|
|
66
66
|
|
|
67
|
-
`Console` is provided by [`SystemConsole`](dependencies/august/0.
|
|
67
|
+
`Console` is provided by [`SystemConsole`](dependencies/august/0.21.0/io/contracts.md#symbol-SystemConsole). The same instance is shared. `Repository<int>` is provided by [`NumberRepository`](types.md#symbol-NumberRepository). The same instance is shared.
|
|
68
68
|
|
|
69
69
|
`app` is provided by [`Program`](types.md#symbol-Program). The same instance is shared. It requires bindings for `Repository<int>`.
|
|
70
70
|
|
|
@@ -74,7 +74,7 @@ It sets `program` to the instance provided for `app`. It calls [`program.start`]
|
|
|
74
74
|
|
|
75
75
|
### Dependencies
|
|
76
76
|
|
|
77
|
-
It uses [`SystemConsole`](dependencies/august/0.
|
|
77
|
+
It uses [`SystemConsole`](dependencies/august/0.21.0/io/contracts.md#symbol-SystemConsole) from `august.io`. It uses [`NumberRepository`](types.md#symbol-NumberRepository) and [`Program`](types.md#symbol-Program) ([`start`](types.md#symbol-Program.start)) from `types`.
|
|
78
78
|
|
|
79
79
|
::::
|
|
80
80
|
|
|
@@ -94,17 +94,17 @@ It implements [`IProgram`](types.md#symbol-IProgram). The `repository` dependenc
|
|
|
94
94
|
|
|
95
95
|
#### `Program.start` · [source](types.md#code) {#symbol-Program.start}
|
|
96
96
|
|
|
97
|
-
It gets `console` ([`Console`](dependencies/august/0.
|
|
97
|
+
It gets `console` ([`Console`](dependencies/august/0.21.0/io/contracts.md#symbol-Console)) from dependency injection. It passes [`repository.get`](types.md#symbol-Repository.get) to [`console.write`](dependencies/august/0.21.0/io/contracts.md#symbol-Console.write).
|
|
98
98
|
|
|
99
99
|
### `IProgram` · interface · [source](types.md#code) {#symbol-IProgram}
|
|
100
100
|
|
|
101
101
|
#### `IProgram.start` · [source](types.md#code) {#symbol-IProgram.start}
|
|
102
102
|
|
|
103
|
-
It gets `console` ([`Console`](dependencies/august/0.
|
|
103
|
+
It gets `console` ([`Console`](dependencies/august/0.21.0/io/contracts.md#symbol-Console)) from dependency injection. It can call [`Console.write`](dependencies/august/0.21.0/io/contracts.md#symbol-Console.write).
|
|
104
104
|
|
|
105
105
|
### Dependencies
|
|
106
106
|
|
|
107
|
-
It uses [`Console`](dependencies/august/0.
|
|
107
|
+
It uses [`Console`](dependencies/august/0.21.0/io/contracts.md#symbol-Console) ([`write`](dependencies/august/0.21.0/io/contracts.md#symbol-Console.write)) from `august.io`.
|
|
108
108
|
|
|
109
109
|
::::
|
|
110
110
|
|
|
@@ -95,17 +95,17 @@ Welcomes a user through the configured logger. It implements [`IGreeter`](greete
|
|
|
95
95
|
|
|
96
96
|
#### `Greeter.greet` · [source](greeter.md#code) {#symbol-Greeter.greet}
|
|
97
97
|
|
|
98
|
-
Prints a personalized greeting. It takes `name` as a string (the user to welcome). It gets `console` ([`Console`](../dependencies/august/0.
|
|
98
|
+
Prints a personalized greeting. It takes `name` as a string (the user to welcome). It gets `console` ([`Console`](../dependencies/august/0.21.0/io/contracts.md#symbol-Console)) from dependency injection. It passes the text `Hello, {name}!` to [`logger.log`](../logging/logger.md#symbol-Logger.log), using injected `console`.
|
|
99
99
|
|
|
100
100
|
### `IGreeter` · interface · [source](greeter.md#code) {#symbol-IGreeter}
|
|
101
101
|
|
|
102
102
|
#### `IGreeter.greet` · [source](greeter.md#code) {#symbol-IGreeter.greet}
|
|
103
103
|
|
|
104
|
-
Prints a personalized greeting. It takes `name` as a string (the user to welcome). It gets `console` ([`Console`](../dependencies/august/0.
|
|
104
|
+
Prints a personalized greeting. It takes `name` as a string (the user to welcome). It gets `console` ([`Console`](../dependencies/august/0.21.0/io/contracts.md#symbol-Console)) from dependency injection. It can call [`Console.write`](../dependencies/august/0.21.0/io/contracts.md#symbol-Console.write).
|
|
105
105
|
|
|
106
106
|
### Dependencies
|
|
107
107
|
|
|
108
|
-
It uses [`Console`](../dependencies/august/0.
|
|
108
|
+
It uses [`Console`](../dependencies/august/0.21.0/io/contracts.md#symbol-Console) ([`write`](../dependencies/august/0.21.0/io/contracts.md#symbol-Console.write)) from `august.io`. It uses [`Logger`](../logging/logger.md#symbol-Logger) ([`log`](../logging/logger.md#symbol-Logger.log)) from `logging`.
|
|
109
109
|
|
|
110
110
|
::::
|
|
111
111
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "august/0.
|
|
2
|
+
title: "august/0.21.0/io/contracts.aug · Hello world with dependencies"
|
|
3
3
|
generated: true
|
|
4
|
-
source: "examples/hello/.aug-spec/august/0.
|
|
4
|
+
source: "examples/hello/.aug-spec/august/0.21.0/io/contracts.aug"
|
|
5
5
|
editLink: false
|
|
6
6
|
prev: false
|
|
7
7
|
next: false
|
|
@@ -10,7 +10,7 @@ search: false
|
|
|
10
10
|
pageClass: aug-example-page
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
-
# `august/0.
|
|
13
|
+
# `august/0.21.0/io/contracts.aug`
|
|
14
14
|
|
|
15
15
|
[Hello world with dependencies](../../../../index.md) · Dependency source and specification
|
|
16
16
|
|
|
@@ -66,11 +66,11 @@ It implements [`Logger`](logger.md#symbol-Logger).
|
|
|
66
66
|
|
|
67
67
|
#### `ConsoleLogger.log` · [source](console.md#code) {#symbol-ConsoleLogger.log}
|
|
68
68
|
|
|
69
|
-
Writes one message. It takes `message` as a string (Text to write). It gets `console` ([`Console`](../dependencies/august/0.
|
|
69
|
+
Writes one message. It takes `message` as a string (Text to write). It gets `console` ([`Console`](../dependencies/august/0.21.0/io/contracts.md#symbol-Console)) from dependency injection. It passes `message` to [`console.write`](../dependencies/august/0.21.0/io/contracts.md#symbol-Console.write).
|
|
70
70
|
|
|
71
71
|
### Dependencies
|
|
72
72
|
|
|
73
|
-
It uses [`Console`](../dependencies/august/0.
|
|
73
|
+
It uses [`Console`](../dependencies/august/0.21.0/io/contracts.md#symbol-Console) ([`write`](../dependencies/august/0.21.0/io/contracts.md#symbol-Console.write)) from `august.io`. It uses [`Logger`](logger.md#symbol-Logger) from `logger`.
|
|
74
74
|
|
|
75
75
|
::::
|
|
76
76
|
|
|
@@ -71,11 +71,11 @@ Writes messages to an application log.
|
|
|
71
71
|
|
|
72
72
|
#### `Logger.log` · [source](logger.md#code) {#symbol-Logger.log}
|
|
73
73
|
|
|
74
|
-
Writes one message. It takes `message` as a string (Text to write). It gets `console` ([`Console`](../dependencies/august/0.
|
|
74
|
+
Writes one message. It takes `message` as a string (Text to write). It gets `console` ([`Console`](../dependencies/august/0.21.0/io/contracts.md#symbol-Console)) from dependency injection. It can call [`Console.write`](../dependencies/august/0.21.0/io/contracts.md#symbol-Console.write).
|
|
75
75
|
|
|
76
76
|
### Dependencies
|
|
77
77
|
|
|
78
|
-
It uses [`Console`](../dependencies/august/0.
|
|
78
|
+
It uses [`Console`](../dependencies/august/0.21.0/io/contracts.md#symbol-Console) ([`write`](../dependencies/august/0.21.0/io/contracts.md#symbol-Console.write)) from `august.io`.
|
|
79
79
|
|
|
80
80
|
::::
|
|
81
81
|
|
|
@@ -68,7 +68,7 @@ greeter.greet(name="AugScript")
|
|
|
68
68
|
|
|
69
69
|
### Providers
|
|
70
70
|
|
|
71
|
-
`Console` is provided by [`SystemConsole`](dependencies/august/0.
|
|
71
|
+
`Console` is provided by [`SystemConsole`](dependencies/august/0.21.0/io/contracts.md#symbol-SystemConsole). The same instance is shared. `Logger` is provided by [`ConsoleLogger`](logging/console.md#symbol-ConsoleLogger). The same instance is shared.
|
|
72
72
|
|
|
73
73
|
`app` is provided by [`Greeter`](app/greeter.md#symbol-Greeter). The same instance is shared. It requires bindings for `Logger`.
|
|
74
74
|
|
|
@@ -78,7 +78,7 @@ It sets `greeter` to the instance provided for `app`. It passes `"AugScript"` to
|
|
|
78
78
|
|
|
79
79
|
### Dependencies
|
|
80
80
|
|
|
81
|
-
It uses [`SystemConsole`](dependencies/august/0.
|
|
81
|
+
It uses [`SystemConsole`](dependencies/august/0.21.0/io/contracts.md#symbol-SystemConsole) from `august.io`. It uses [`Greeter`](app/greeter.md#symbol-Greeter) ([`greet`](app/greeter.md#symbol-Greeter.greet)) from `app`. It uses [`ConsoleLogger`](logging/console.md#symbol-ConsoleLogger) from `logging`.
|
|
82
82
|
|
|
83
83
|
::::
|
|
84
84
|
|
package/docs/examples/index.md
CHANGED
|
@@ -10,12 +10,21 @@ outline: [2, 3]
|
|
|
10
10
|
|
|
11
11
|
# Example projects
|
|
12
12
|
|
|
13
|
-
Read a complete program, follow its dependencies, and compare the source with its compiled explanation. Every file has highlighted **Indentation** and **Braces** views and the actual output of `aug spec`. Dependency links open the exact version used by the project.
|
|
13
|
+
Read a complete program, follow its dependencies, and compare the source with its compiled explanation. Every file has highlighted **Indentation** and **Braces** views and the actual output of `aug spec`. Dependency links open the exact version used by the project. Download a project to try it; native examples require the LLVM preview described on their pages.
|
|
14
14
|
|
|
15
15
|
Start with [Hello world with dependencies](hello/index.md) to trace a greeting through two folder boundaries. Then [review a change to the tested calculator](../guides/change-a-module.md). For a larger application, the [OpenID Connect example](oidc-login/index.md) combines pages, provider and client endpoints, and a session JWT. It is a development demonstration with documented limits.
|
|
16
16
|
|
|
17
17
|
If you are learning the language for the first time, use [the book](../learn/index.md). The gallery is for exploring whole projects and looking at the code behind a specific feature or measurement.
|
|
18
18
|
|
|
19
|
+
## Native libraries (LLVM preview)
|
|
20
|
+
|
|
21
|
+
| Project | What it demonstrates |
|
|
22
|
+
| --- | --- |
|
|
23
|
+
| [CPU tensors with PyTorch](native-pytorch/index.md) | Import real LibTorch from its public August package, add CPU tensors, and verify the elements and sum. Owned tensors are released when their scope ends. |
|
|
24
|
+
| [A database with SQLite](native-sqlite/index.md) | Create an in-memory database, insert a labeled bound value, and query it through the real SQLite implementation. Mutation requires a borrow; scope exit closes the database. |
|
|
25
|
+
| [Compression with zlib](native-zlib/index.md) | Compress a buffer with zlib and verify the restored bytes. A fixed output limit bounds decompression. |
|
|
26
|
+
| [Hashing with Rust BLAKE3](native-blake3/index.md) | Import a Rust implementation through an ordinary August package and verify a published BLAKE3 hash vector. |
|
|
27
|
+
|
|
19
28
|
## Start here
|
|
20
29
|
|
|
21
30
|
| Project | What it demonstrates |
|
|
@@ -71,6 +80,14 @@ If you are learning the language for the first time, use [the book](../learn/ind
|
|
|
71
80
|
| Project | What it demonstrates |
|
|
72
81
|
| --- | --- |
|
|
73
82
|
| [Startup benchmark](startup-benchmark/index.md) | The small program used to measure process startup. |
|
|
83
|
+
| [Floating-point benchmark](float-benchmark/index.md) | Accumulate exact binary fractions and check the final value. |
|
|
84
|
+
| [Function-call benchmark](calls-benchmark/index.md) | Call a labeled function repeatedly with a dependent integer result. |
|
|
85
|
+
| [List traversal benchmark](list-benchmark/index.md) | Grow a list and sum its snapshot values. |
|
|
86
|
+
| [String processing benchmark](strings-benchmark/index.md) | Split text into parts and sum their byte lengths. |
|
|
87
|
+
| [Map deletion benchmark](map-churn-benchmark/index.md) | Delete, replace and reinsert entries, then check values and insertion order. |
|
|
88
|
+
| [Checked-error benchmark](errors-benchmark/index.md) | Interleave successful calls and caught checked failures. |
|
|
89
|
+
| [Record allocation benchmark](records-benchmark/index.md) | Retain immutable records and sum their fields. |
|
|
90
|
+
| [Task scheduling benchmark](tasks-benchmark/index.md) | Start and join two tasks in each bounded scope. |
|
|
74
91
|
| [CPU benchmark](cpu-benchmark/index.md) | Two million dependent integer steps with a checked result. |
|
|
75
92
|
| [Map and Set benchmark](collections-benchmark/index.md) | Insert, find, and iterate over 20,000 collection entries. |
|
|
76
93
|
| [JSON benchmark](json-benchmark/index.md) | Parse, decode, and serialize a typed record 5,000 times. |
|
|
@@ -100,17 +100,17 @@ Greeter(resolve Logger logger to _logger, string name) implements IGreeter {
|
|
|
100
100
|
|
|
101
101
|
### `describe` · [source](app.md#code) {#symbol-describe}
|
|
102
102
|
|
|
103
|
-
Prints a number and returns its label. It takes `x` as an integer (the numeric input, validated and incremented by the chain) and `label` as a string (Text forwarded through each layer unchanged). It gets `logger` ([`Logger`](logging.md#symbol-Logger)) and `console` ([`Console`](dependencies/august/0.
|
|
103
|
+
Prints a number and returns its label. It takes `x` as an integer (the numeric input, validated and incremented by the chain) and `label` as a string (Text forwarded through each layer unchanged). It gets `logger` ([`Logger`](logging.md#symbol-Logger)) and `console` ([`Console`](dependencies/august/0.21.0/io/contracts.md#symbol-Console)) from dependency injection. Failures can raise `ValidationError`.
|
|
104
104
|
|
|
105
105
|
Layers run in the declared order. Call [`Audit.around`](interceptors.md#symbol-Audit.around). Call [`Positive.around`](interceptors.md#symbol-Positive.around). Map `x` to `y`. Call [`AddOne.around`](interceptors.md#symbol-AddOne.around). Map `x` to `y`.
|
|
106
106
|
|
|
107
|
-
It passes `x` to [`console.write`](dependencies/august/0.
|
|
107
|
+
It passes `x` to [`console.write`](dependencies/august/0.21.0/io/contracts.md#symbol-Console.write). It returns `label`.
|
|
108
108
|
|
|
109
109
|
### `IGreeter` · interface · [source](app.md#code) {#symbol-IGreeter}
|
|
110
110
|
|
|
111
111
|
#### `IGreeter.greet` · [source](app.md#code) {#symbol-IGreeter.greet}
|
|
112
112
|
|
|
113
|
-
It gets `logger` ([`Logger`](logging.md#symbol-Logger)) and `console` ([`Console`](dependencies/august/0.
|
|
113
|
+
It gets `logger` ([`Logger`](logging.md#symbol-Logger)) and `console` ([`Console`](dependencies/august/0.21.0/io/contracts.md#symbol-Console)) from dependency injection. It returns `string`. It can call [`Console.write`](dependencies/august/0.21.0/io/contracts.md#symbol-Console.write).
|
|
114
114
|
|
|
115
115
|
### `Greeter` · class · [source](app.md#code) {#symbol-Greeter}
|
|
116
116
|
|
|
@@ -118,13 +118,13 @@ Construction stores its inputs; startup is visible in the greet call. It impleme
|
|
|
118
118
|
|
|
119
119
|
#### `Greeter.greet` · [source](app.md#code) {#symbol-Greeter.greet}
|
|
120
120
|
|
|
121
|
-
Method annotations wrap each method invocation separately. It gets `logger` ([`Logger`](logging.md#symbol-Logger)) and `console` ([`Console`](dependencies/august/0.
|
|
121
|
+
Method annotations wrap each method invocation separately. It gets `logger` ([`Logger`](logging.md#symbol-Logger)) and `console` ([`Console`](dependencies/august/0.21.0/io/contracts.md#symbol-Console)) from dependency injection. Layers run in the declared order. Call [`Audit.around`](interceptors.md#symbol-Audit.around).
|
|
122
122
|
|
|
123
123
|
It returns the text `Hello, {name}!`.
|
|
124
124
|
|
|
125
125
|
### Dependencies
|
|
126
126
|
|
|
127
|
-
It uses [`Console`](dependencies/august/0.
|
|
127
|
+
It uses [`Console`](dependencies/august/0.21.0/io/contracts.md#symbol-Console) ([`write`](dependencies/august/0.21.0/io/contracts.md#symbol-Console.write)) from `august.io`. It uses [`AddOne`](interceptors.md#symbol-AddOne) ([`around`](interceptors.md#symbol-AddOne.around)), [`Audit`](interceptors.md#symbol-Audit) ([`around`](interceptors.md#symbol-Audit.around)), and [`Positive`](interceptors.md#symbol-Positive) ([`around`](interceptors.md#symbol-Positive.around)) from `interceptors`. It uses [`Logger`](logging.md#symbol-Logger) from `logging`.
|
|
128
128
|
|
|
129
129
|
::::
|
|
130
130
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "august/0.
|
|
2
|
+
title: "august/0.21.0/io/contracts.aug · Function and constructor middleware"
|
|
3
3
|
generated: true
|
|
4
|
-
source: "examples/interceptors/.aug-spec/august/0.
|
|
4
|
+
source: "examples/interceptors/.aug-spec/august/0.21.0/io/contracts.aug"
|
|
5
5
|
editLink: false
|
|
6
6
|
prev: false
|
|
7
7
|
next: false
|
|
@@ -10,7 +10,7 @@ search: false
|
|
|
10
10
|
pageClass: aug-example-page
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
-
# `august/0.
|
|
13
|
+
# `august/0.21.0/io/contracts.aug`
|
|
14
14
|
|
|
15
15
|
[Function and constructor middleware](../../../../index.md) · Dependency source and specification
|
|
16
16
|
|
|
@@ -131,7 +131,7 @@ The `logger` dependency is injected as [`Logger`](logging.md#symbol-Logger) and
|
|
|
131
131
|
|
|
132
132
|
#### `Audit.around` · [source](interceptors.md#code) {#symbol-Audit.around}
|
|
133
133
|
|
|
134
|
-
Wrap a call without changing its result. It gets `console` ([`Console`](dependencies/august/0.
|
|
134
|
+
Wrap a call without changing its result. It gets `console` ([`Console`](dependencies/august/0.21.0/io/contracts.md#symbol-Console)) from dependency injection.
|
|
135
135
|
|
|
136
136
|
It passes `"before"` to [`logger.log`](logging.md#symbol-Logger.log), using injected `console`. It sets `result` of type `T` to `next`. It passes `"after"` to [`logger.log`](logging.md#symbol-Logger.log), using injected `console`. It returns `result`.
|
|
137
137
|
|
|
@@ -153,7 +153,7 @@ It takes `y` as an integer (the input to increment). It returns `next` with `y`
|
|
|
153
153
|
|
|
154
154
|
### Dependencies
|
|
155
155
|
|
|
156
|
-
It uses [`Console`](dependencies/august/0.
|
|
156
|
+
It uses [`Console`](dependencies/august/0.21.0/io/contracts.md#symbol-Console) ([`write`](dependencies/august/0.21.0/io/contracts.md#symbol-Console.write)) from `august.io`. It uses [`Logger`](logging.md#symbol-Logger) ([`log`](logging.md#symbol-Logger.log)) from `logging`.
|
|
157
157
|
|
|
158
158
|
::::
|
|
159
159
|
|
|
@@ -73,7 +73,7 @@ Writes a message to the application log.
|
|
|
73
73
|
|
|
74
74
|
#### `Logger.log` · [source](logging.md#code) {#symbol-Logger.log}
|
|
75
75
|
|
|
76
|
-
It takes `message` as a string (Text to display). It gets `console` ([`Console`](dependencies/august/0.
|
|
76
|
+
It takes `message` as a string (Text to display). It gets `console` ([`Console`](dependencies/august/0.21.0/io/contracts.md#symbol-Console)) from dependency injection. It can call [`Console.write`](dependencies/august/0.21.0/io/contracts.md#symbol-Console.write).
|
|
77
77
|
|
|
78
78
|
### `ConsoleLogger` · class · [source](logging.md#code) {#symbol-ConsoleLogger}
|
|
79
79
|
|
|
@@ -81,11 +81,11 @@ Console logger shared by interceptor instances and the application. It implement
|
|
|
81
81
|
|
|
82
82
|
#### `ConsoleLogger.log` · [source](logging.md#code) {#symbol-ConsoleLogger.log}
|
|
83
83
|
|
|
84
|
-
It takes `message` as a string (Text to display). It gets `console` ([`Console`](dependencies/august/0.
|
|
84
|
+
It takes `message` as a string (Text to display). It gets `console` ([`Console`](dependencies/august/0.21.0/io/contracts.md#symbol-Console)) from dependency injection. It passes `message` to [`console.write`](dependencies/august/0.21.0/io/contracts.md#symbol-Console.write).
|
|
85
85
|
|
|
86
86
|
### Dependencies
|
|
87
87
|
|
|
88
|
-
It uses [`Console`](dependencies/august/0.
|
|
88
|
+
It uses [`Console`](dependencies/august/0.21.0/io/contracts.md#symbol-Console) ([`write`](dependencies/august/0.21.0/io/contracts.md#symbol-Console.write)) from `august.io`.
|
|
89
89
|
|
|
90
90
|
::::
|
|
91
91
|
|
|
@@ -88,7 +88,7 @@ catch ValidationError error {
|
|
|
88
88
|
|
|
89
89
|
### Providers
|
|
90
90
|
|
|
91
|
-
`Console` is provided by [`SystemConsole`](dependencies/august/0.
|
|
91
|
+
`Console` is provided by [`SystemConsole`](dependencies/august/0.21.0/io/contracts.md#symbol-SystemConsole). The same instance is shared. `Logger` is provided by [`ConsoleLogger`](logging.md#symbol-ConsoleLogger). The same instance is shared.
|
|
92
92
|
|
|
93
93
|
### Startup
|
|
94
94
|
|
|
@@ -98,7 +98,7 @@ It tries to call [`describe`](app.md#symbol-describe) with `x` `-1` and `label`
|
|
|
98
98
|
|
|
99
99
|
### Dependencies
|
|
100
100
|
|
|
101
|
-
It uses [`SystemConsole`](dependencies/august/0.
|
|
101
|
+
It uses [`SystemConsole`](dependencies/august/0.21.0/io/contracts.md#symbol-SystemConsole) from `august.io`. It uses [`Greeter`](app.md#symbol-Greeter) ([`greet`](app.md#symbol-Greeter.greet)) and [`describe`](app.md#symbol-describe) from `app`. It uses [`ValidationError`](interceptors.md#symbol-ValidationError) from `interceptors`. It uses [`ConsoleLogger`](logging.md#symbol-ConsoleLogger) from `logging`.
|
|
102
102
|
|
|
103
103
|
Built-in operations follow the [language reference](https://greenpandastudios.github.io/augscript/language-constructs).
|
|
104
104
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "List traversal benchmark"
|
|
3
|
+
generated: true
|
|
4
|
+
source: "benchmarks/list"
|
|
5
|
+
editLink: false
|
|
6
|
+
prev: false
|
|
7
|
+
next: false
|
|
8
|
+
outline: [2, 3]
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# List traversal benchmark
|
|
12
|
+
|
|
13
|
+
Grow a list and sum its snapshot values.
|
|
14
|
+
|
|
15
|
+
Open a file to read its source beside the explanation produced by `aug spec`. **Indentation** and **Braces** display the same checked program; your choice carries across file pages.
|
|
16
|
+
|
|
17
|
+
## Project files
|
|
18
|
+
|
|
19
|
+
- [`main.aug`](main.md)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## Try this project
|
|
23
|
+
|
|
24
|
+
[Download this project](/downloads/list-benchmark.zip), then extract the archive in an empty working folder. It contains the checked source, configuration, and generated specs. [Install August](../../getting-started.md) once, then run these commands. Native libraries are prepared automatically when needed:
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
cd list-benchmark
|
|
28
|
+
aug check .
|
|
29
|
+
aug spec .
|
|
30
|
+
aug run .
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
See [the performance page](../../performance.md) for measurements, input sizes, and reproduction steps.
|
|
34
|
+
|
|
35
|
+
[Browse all examples](../index.md)
|