Version: 1.1.0
Decorators
Decorators attach behavior to a declaration. They sit on the line above a struct or function and start with @.
Essentials
@fieldwise_initgenerates a constructor.@always_inlineand@no_inlinecontrol inlining.@deprecatedwarns callers and can point at the replacement.@implicitallows a converting initializer to run silently.- A decorator is resolved at compile time.
Example
@fieldwise_init
struct Pair:
var a: Int
var b: Int
Keep in mind
Decorators are not Python runtime wrappers. They change compilation of the declaration they sit on.