Is there any optimization like NSFastEnumeration (batch fetching, detecting mutations) in Swift? SequenceType doesn’t seem to do that.
@mjtsai Technically that _can_ be specialized at compile time (and IIRC the compiler has begun to in some cases).
-
-
@rob_rix How can you do that if the sequence you receive is not final? -
@mjtsai Given func f<C: SequenceType>(c:C){ …loop over c… }, compile f_Array & f_Set, dispatch at call to f instead of within the loop. -
@rob_rix So it doesn't work if f takes an array instead of a SequenceType? -
@mjtsai Yeah you’d have to have a generic fallback for when the thing calling the generic thing is itself generic. Diminishing returns! -
@mjtsai & note that the compiler may not do any of this. But as I understand it, it _can_ choose to treat generics as templates like this.
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
Michael Tsai
Rob Rix