.@mjtsai you OFTEN want the way Swift acts but it is not explicit, and something I always try to avoid is code that isn't obvious enough.
.@mjtsai I think the problem you identified in your blog entry permeates Swift - trading predictable runtime perf for "the correct way".
-
-
-
@nuoji Why do you say "not explicit"? Because the "var" may be textually far away? -
@mjtsai var arrays will try to optimize for you, so the actual runtime perf and behavior will depend on subtle variations to your code. -
@nuoji Yes, agreed about the perf being more hidden. I thought you were talking about "explicit" when reading the code. -
@mjtsai compare ObjC - switching between mutable and immutable is completely explicit and inspectable. Including when passing arrays as args - View other replies
-
@nuoji Aren't "var" and "inout" just different ways of spelling "mutable"? That's explicit. -
@mjtsai it only describes the language rules, it does not describe the behavior of the underlying runtime. - View other replies
-
@nuoji Right. BTW, my understanding is that this sort of thing was once a (lesser) issue in ObjC as well. - Show more
-
-
-
@nuoji Yep. To me, the questions are 1. How much does the perf difference usually matter, and 2. Is there an escape hatch when it bites you. -
@mjtsai It's a problem of "magic" code too. There is a lot of it built into language - auto closures and return overload are the worst. -
@nuoji Yeah, one thing I've noticed is that it seems to be harder to read other people's Swift code than other people's Objective-C.
-
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.
Christoffer Lernö
Michael Tsai