4 ms·
For me, I felt the same way initially, but I found it depends on the case. The case you gave is probably now one I would do, I would probably have the external
by tcmart14 3y ago
For me, I felt the same way initially, but I found it depends on the case. The case you gave is probably now one I would do, I would probably have the external be 'for' if I expected the caller to pass in a list that I was gonna iterate over inside of the method.
An example I like to use to show when and how I used it. I have been playing with Metal. If I write a function called translate, I will have it's external parameter as 'by' with the internal parameter being 'vector'. As a simple example:
func translate(_ origin: simd_float3, by vector: simd_float3) -> simd_float3 {
// do some stuff
}
let newVector = translate(originalVector, by: translatingVector)