Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The package runs a compiled `Program` with an invocation-scoped observer and tur
## Requirements

- PHP ^8.4
- gosuperscript/axiom 0.x-dev
- gosuperscript/axiom ^0.6
- gosuperscript/monads ^1.0

## Installation
Expand Down Expand Up @@ -111,16 +111,23 @@ try {

## Extension annotations

Core and host source compilers annotate the node currently being evaluated through `Runtime::annotate()`:
Core and host source compilers annotate the node currently being evaluated through `SourceEvaluation::annotate()`:

```php
return new CompiledNode($returnType, function (Runtime $runtime) use ($service) {
$value = $service->lookup();
$runtime->annotate('cache', 'miss');
$runtime->annotate('result', $value);

return Ok(Some($value));
});
use Superscript\Axiom\CompiledSource;
use Superscript\Axiom\SourceCompilation;
use Superscript\Axiom\SourceEvaluation;

private function compile(MySource $source, SourceCompilation $compilation): CompiledSource
{
return $compilation->custom($returnType, function (SourceEvaluation $evaluation) use ($service) {
$value = $service->lookup();
$evaluation->annotate('cache', 'miss');
$evaluation->annotate('result', $value);

return $value;
});
}
```

Because Axiom wraps every `CompiledNode` with the source identity at compile time, host source compilers participate automatically; they do not need tracing-specific integration.
Because Axiom wraps every `CompiledSource` with the source identity at compile time, host source compilers participate automatically; they do not need tracing-specific integration.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "MIT",
"require": {
"php": "^8.4",
"gosuperscript/axiom": "^0.5.0",
"gosuperscript/axiom": "^0.6.0",
"gosuperscript/monads": "^1.0"
},
"require-dev": {
Expand Down
Loading