Documentation
¶
Overview ¶
Package scope provides the `@scope :mods { ... }` directive. The header's modifiers become the effective policy for every atom declared inside the braces. Nested scopes override outer scopes on a per-modifier-name basis; an atom's own modifier always wins.
Typical use:
@scope :timeout=5s :retry=3 {
http.request
json.parse
}
The directive stores its line spans under the private meta key "scope.spans". core.Parser never sees these records; it consults a generic line-indexed modifier lookup that Bundle.OnPreprocess installs via core.WithLineModifiers.
Index ¶
Constants ¶
const ID = "scope"
Variables ¶
var Directive = core.Directive{
Name: "scope",
Example: "@scope :timeout=5s :retry=3 {\n http.request\n}",
Handler: handleDirective,
}
Directive parses `@scope :mods { ... }`.
var ProfileDirective = core.Directive{
Name: "profile",
Example: "@profile reliable :timeout=2s :retry=4",
Handler: handleProfile,
}
ProfileDirective declares a named, reusable set of modifiers:
@profile reliable :timeout=2s :retry=4 @profile fast :parent=reliable :timeout=500ms
A profile must be declared before the @pipeline or @scope that references it. The parent may be declared either before or after the child; only the use site requires the parent to exist by then.
Functions ¶
func ExpandProfile ¶
ExpandProfile returns the effective modifier list for a named profile: parent modifiers first, then the profile's own modifiers overriding on name. Cycles and unknown names are compile errors.
A nil meta, an unknown name, or an unresolved parent returns an error naming the missing profile. The full parent chain is included in cycle diagnostics.
Types ¶
This section is empty.