Bycopy pragma
The bycopy pragma can be applied to an object or tuple type or a proc param. It instructs the compiler to pass the type by value to procs:
type
Vector {.bycopy.} = object
x, y, z: float
The Nim compiler automatically determines whether a parameter is passed by value or by reference based on the parameter type’s size. If a parameter must be passed by value or by reference, (such as when interfacing with a C library) use the bycopy or byref pragmas. Notice params marked as byref takes precedence over types marked as bycopy.
当前内容版权归 nim-lang.org 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 nim-lang.org .