Curious: why do you use classes instead of structs for implementations in swiftz?
Conversation
no reason. I'm probably going to end up switching them to structs where I can.
1
2
developer.apple.com/library/prerel seems to mostly favor classes. Comments? Trying to grok perf of call-by-value.
4
Some fancier specifics: the compiler has enough info that it could pass stack structs byref in simple cases.
1
1
3
Right, if no mutating in callee. So what are non-simple cases / why does array need to be special?
1
Basically array is special because it allows broader sharing of the backing buffer across array ops.
1
1
4
That's what I'd like more than 140 chars on, yeah. :) Impl of pass-by-val array + un/shared backing.
1
1
Replying to
Hopefully one day you'll be able to read stdlib/Array.swift, but I still haven't heard about that.
Replying to
Would be great, yeah. And I do appreciate the answers you are giving, just also into more digging…
1
I *believe* it's all implemented in-library: Array are structs with an unsafe pointer to shared buffers.
2
2
Show replies



