An attribute adds a note to a declaration. It starts with @.
@link(name := "c")
native "c" let puts (msg : CString) : Int;
@target(os := "linux")
native "c" let clock_gettime (id : Int, out : CPtr) : Int;Use attributes when a name needs extra information that is not part of the normal value. A native link name or target condition can live there.
Attributes should be rare in normal app code. If a note is business data, put it in a normal value instead.
Attribute shape
Attributes attach metadata to the declaration that follows them.
@link(symbol := "sys.target.os")
native "musi" let targetOsIntrinsic () : String;The attribute is not the value. It tells the compiler or tooling how to treat the declaration.
Use attributes narrowly
Use attributes for compiler links, native bindings, and target gates. Do not use them as a replacement for records, options, or normal configuration values.