15.2 Reflection
comptime fn toCsvRow<T>(x: &T) -> String {
var out = String.new()
inline for f in reflect(T).fields where f.visible {
out.push("{x.[f]},")
}
out
}reflect(T) -> TypeInfo(comptime only): name, kind (Data,Enum,Union,Prim,Interface,Service,Actor,Topic,Config), fields (name,type,tag,attrs,visibility,default), variants, methods (name,params,ret,effects,attrs), rpcs, attributes.x.[f]— access to a field by the comptime valueFieldInfo.- Runtime reflection only for types with
@reflect:rt.typeinfo(x),rt.get(x, "field") -> Any | NoField,rt.set(&var x, "field", v),rt.call(&x, "method", args) -> Any | CallError. Types without@reflecthave no metadata in the binary. - Reflection sees only what is visible at the point of the call under the rules of §2.3.
See also
Source: docs/spec/oxl-standard.en.md