mjtsai + airspeedswift   59

Twitter
Some nice code size improvements in 5.2. This is a graph the % change in each project in the Swift source compatibility suite. pic.twitter.com/HLfb7iXdmR

— Ben Cohen (@AirspeedSwift) February 6, 2020
FavoriteTweet  AirspeedSwift 
14 days ago by mjtsai
Twitter
Just posted a pitch for making Swift’s modify accessors a public feature.https://t.co/nYtnQMr3Hm

— Ben Cohen (@AirspeedSwift) December 19, 2019
FavoriteTweet  AirspeedSwift 
9 weeks ago by mjtsai
Twitter
I already have trouble with the youfs using DDR to refer to a video game...

— Ben Cohen (@AirspeedSwift) December 2, 2019
FavoriteTweet  AirspeedSwift 
11 weeks ago by mjtsai
Twitter
OK people abbreviating advent of code tweets to AOC is giving me twitter double take whiplash

— Ben Cohen (@AirspeedSwift) December 2, 2019
FavoriteTweet  AirspeedSwift 
11 weeks ago by mjtsai
Twitter
Time between numeric package launch and a thread of disagreement about what * means for matrices: 28 hours.

— Ben Cohen (@AirspeedSwift) November 9, 2019
FavoriteTweet  AirspeedSwift 
november 2019 by mjtsai
Twitter
The extensive use of indentation in SwiftUI code makes the case for 2-space indents stronger than ever.

— Ben Cohen (@AirspeedSwift) June 10, 2019
FavoriteTweet  AirspeedSwift 
june 2019 by mjtsai
Twitter
RealityKit is another great new API that is taking full advantage of Swifthttps://t.co/Tav1MDdaVR

— Ben Cohen (@AirspeedSwift) June 3, 2019
FavoriteTweet  AirspeedSwift 
june 2019 by mjtsai
Twitter
This is the best text message interaction I’ve had in some time. pic.twitter.com/MlLV7zvtaG

— Ben Cohen (@AirspeedSwift) April 5, 2019
FavoriteTweet  AirspeedSwift 
april 2019 by mjtsai
Twitter
About once a week I type

var endIndex: Index { _base.endIndex }

Then compile, mutter “fuck” under my breath, and add the return.

This proposal would make me so happy. https://t.co/Zspbt4yjRF

— Ben Cohen (@AirspeedSwift) March 22, 2019
FavoriteTweet  AirspeedSwift 
march 2019 by mjtsai
Twitter
This is using unsafe operations under the hood (to move the memory out of the buffer) but only the bottom layer needs to do this. You can then layer more yielding subscripts on top of it (as Dictionary does here – the unsafe stuff is isolated in _NativeDictionary).

— Ben Cohen (@AirspeedSwift) December 16, 2018
FavoriteTweet  AirspeedSwift 
december 2018 by mjtsai
Twitter
The caller can then modify that optional in-place, and the value inside it remains uniquely referenced. Then the caller returns from the yield, and dictionary can move the element back into its storage before returning.

— Ben Cohen (@AirspeedSwift) December 16, 2018
FavoriteTweet  AirspeedSwift 
december 2018 by mjtsai
Twitter
Here’s the code for Dictionary’s subscript _modify: https://t.co/QPhnJx8aTj. It’s actually in a type that Dictionary wraps, but this helps make it quite readable, as do @lorentey’s helpful comments.

— Ben Cohen (@AirspeedSwift) December 16, 2018
FavoriteTweet  AirspeedSwift 
december 2018 by mjtsai
Twitter
Swift doesn’t rely on two strings being the same form for them to compare equal. It supports strings with any valid normalization. Normalization for comparison purposes happens on the fly.

— Ben Cohen (@AirspeedSwift) November 19, 2018
FavoriteTweet  AirspeedSwift 
november 2018 by mjtsai
Twitter
It’s not undefined. It’s well-defined but opaque, and to be used for algorithmic purposes only.

— Ben Cohen (@AirspeedSwift) November 19, 2018
FavoriteTweet  AirspeedSwift 
november 2018 by mjtsai
Twitter
@simjp @jesse_squires ContiguousArray exists because Array can “lazily” bridge an NSArray without doing a full conversion. That means access sometimes needs a branch (to check if it’s a lazy array) that the optimizer can’t eliminate.

— Ben Cohen (@AirspeedSwift) June 18, 2018
FavoriteTweet  AirspeedSwift 
june 2018 by mjtsai
Twitter
Some assumptions to watch out for in 4.2 now that hash values are randomly seeded:

- that a Dictionary will get built in the same order for same input on every process run

- that hashValue == rawValue for enums

- that you can safely += hashValue into an Int without overflow

— Ben Cohen (@AirspeedSwift) June 14, 2018
FavoriteTweet  AirspeedSwift 
june 2018 by mjtsai
Twitter
The thing you can’t do just by extending Substring is store “extra” information for your processing, like a locale or a character set to skip. But I’m not sure if that’s better than just passing those in as args to certain functions.

— Ben Cohen (@AirspeedSwift) June 7, 2018
FavoriteTweet  AirspeedSwift 
june 2018 by mjtsai
Twitter
Since substrings (or any collection slice) must have itself as a slice, you can write mutating methods on them that update self to eat characters. This is how the default implementation of popFirst works.

— Ben Cohen (@AirspeedSwift) June 7, 2018
FavoriteTweet  AirspeedSwift 
june 2018 by mjtsai
Ben Cohen on Twitter: "Podcasts have crowded out music in my listening time and it’s a bad thing."
Podcasts have crowded out music in my listening time and it’s a bad thing.

— Ben Cohen (@AirspeedSwift) April 30, 2018
FavoriteTweet  AirspeedSwift 
april 2018 by mjtsai
Ben Cohen on Twitter: "Now in review on Swift Evolution: adding Unicode Properties to Unicode.Scalar https://t.co/sbOMrjLra7"
Now in review on Swift Evolution: adding Unicode Properties to Unicode.Scalarhttps://t.co/sbOMrjLra7

— Ben Cohen (@AirspeedSwift) April 24, 2018
FavoriteTweet  AirspeedSwift 
april 2018 by mjtsai
Ben Cohen on Twitter: "I badly need to come up with a good way to end a question with a type and not make it look like I mean an optional…"
I badly need to come up with a good way to end a question with a type and not make it look like I mean an optional…

— Ben Cohen (@AirspeedSwift) April 19, 2018
FavoriteTweet  AirspeedSwift 
april 2018 by mjtsai
Ben Cohen on Twitter: "sorry… "
sorry pic.twitter.com/MZKKoIeICh

— Ben Cohen (@AirspeedSwift) April 7, 2018
FavoriteTweet  AirspeedSwift 
april 2018 by mjtsai
Ben Cohen on Twitter: "Hashing needed some more work before this could happen, but @lorentey has been working on a proposal to turn the hashing improvements he landed in 4.2 into a proposal for a public API: https://t.co/bZXFRSVUIO… https://t.co/koBXkuX
Hashing needed some more work before this could happen, but @lorentey has been working on a proposal to turn the hashing improvements he landed in 4.2 into a proposal for a public API: https://t.co/bZXFRSVUIO

— Ben Cohen (@AirspeedSwift) April 2, 2018
FavoriteTweet  AirspeedSwift 
april 2018 by mjtsai
Ben Cohen on Twitter: "Mutating through an optional will trigger COW currently - we need generalized accessors.… "
Mutating through an optional will trigger COW currently - we need generalized accessors.

— Ben Cohen (@AirspeedSwift) March 16, 2018
FavoriteTweet  AirspeedSwift 
march 2018 by mjtsai
Ben Cohen on Twitter: "Force unwraps are an important tool for certain cases, but if you're using them constantly throughout your code it's a bad sign. There's often a faster/cleaner/less error-prone way to do what you want. s/Force unwraps/Indexes/"
Force unwraps are an important tool for certain cases, but if you're using them constantly throughout your code it's a bad sign. There's often a faster/cleaner/less error-prone way to do what you want.

s/Force unwraps/Indexes/

— Ben Cohen (@AirspeedSwift) March 15, 2018
FavoriteTweet  AirspeedSwift 
march 2018 by mjtsai
Ben Cohen on Twitter: "Oh wait scratch that… it’s only the start of the topic, not the thread. Hey ho."
Oh wait scratch that… it’s only the start of the topic, not the thread. Hey ho.

— Ben Cohen (@AirspeedSwift) January 23, 2018
FavoriteTweet  AirspeedSwift 
january 2018 by mjtsai
Ben Cohen on Twitter: "For anyone looking for an offline option for the Swift forums that isn’t email… each category has an RSS feed that’s working well for me from Reeder."
For anyone looking for an offline option for the Swift forums that isn’t email… each category has an RSS feed that’s working well for me from Reeder.

— Ben Cohen (@AirspeedSwift) January 23, 2018
FavoriteTweet  AirspeedSwift 
january 2018 by mjtsai
Ben Cohen on Twitter: "Why did they do that? Because compliance had insisted on setting the threshold so low (for “safety”) that they had to do it often, despite remonstrations that this was exactly what would end up happening. Software is hard—peop
Why did they do that? Because compliance had insisted on setting the threshold so low (for “safety”) that they had to do it often, despite remonstrations that this was exactly what would end up happening.

Software is hard—people are impossible.

— Ben Cohen (@AirspeedSwift) January 21, 2018
FavoriteTweet  AirspeedSwift 
january 2018 by mjtsai
Ben Cohen on Twitter: "I used to work on a trading system with a dialog box very much like this, for when someone tried to send a surprisingly huge trade into the market. One day the trader saw it, and typed the codeword anyway, dropping the index by 3%
I used to work on a trading system with a dialog box very much like this, for when someone tried to send a surprisingly huge trade into the market.

One day the trader saw it, and typed the codeword anyway, dropping the index by 3% https://t.co/OdX1WQiNTO

— Ben Cohen (@AirspeedSwift) January 21, 2018
FavoriteTweet  AirspeedSwift 
january 2018 by mjtsai
Ben Cohen on Twitter: "This feature, along with recursive protocol constraints, is a major step forward for declaring ABI stability for the std lib.… https://t.co/ws1n8ua6Ct"
This feature, along with recursive protocol constraints, is a major step forward for declaring ABI stability for the std lib.https://t.co/roI3Zpm4a8

— Ben Cohen (@AirspeedSwift) January 8, 2018
FavoriteTweet  AirspeedSwift 
january 2018 by mjtsai
Airspeed Velocity on Twitter: "@mjtsai @jckarter @lapcatsoftware There are really only 3 options though. Trap, coalesce, or (probably unrealistic) modify the colliding strings to make them not-canonically-… https://t.co/rTrS4y8s7R"
There are really only 3 options though. Trap, coalesce, or (probably unrealistic) modify the colliding strings to make them not-canonically-equivalent.

In Swift, if you know that different representations have meaning, you should be using String.UTF16View or [UInt8] as your key.

— Airspeed Velocity (@AirspeedSwift) December 11, 2017
FavoriteTweet  AirspeedSwift 
december 2017 by mjtsai
Airspeed Velocity on Twitter: "@mjtsai @jckarter @lapcatsoftware O(1) bridging from Swift to ObjC only happens when the types in the ObjC container are verbatim-bridged. Which String/NSString aren’t."
O(1) bridging from Swift to ObjC only happens when the types in the ObjC container are verbatim-bridged. Which String/NSString aren’t.

— Airspeed Velocity (@AirspeedSwift) December 11, 2017
FavoriteTweet  AirspeedSwift 
december 2017 by mjtsai
Airspeed Velocity on Twitter: "@mjtsai @jckarter @lapcatsoftware Bit of clarification: the crash is definitely a bug. The code to bridge into Swift from ObjC coalesces keys and shouldn’t trap, but it assum… https://t.co/IG6xbc4w9m"
Bit of clarification: the crash is definitely a bug. The code to bridge into Swift from ObjC coalesces keys and shouldn’t trap, but it assumes the count from the NSDictionary, an invalid optimization.

— Airspeed Velocity (@AirspeedSwift) December 11, 2017
FavoriteTweet  AirspeedSwift 
december 2017 by mjtsai
Airspeed Velocity on Twitter: "Amongst other things, gyb was hiding just how much code got deleted in that PR. The gyb files alone were a reduction of 3,346 lines of Swift… https://t.co/XOuJBrrIiX"
Amongst other things, gyb was hiding just how much code got deleted in that PR. The gyb files alone were a reduction of 3,346 lines of Swift. pic.twitter.com/lZnGON2Tcq

— Airspeed Velocity (@AirspeedSwift) November 30, 2017
FavoriteTweet  AirspeedSwift 
november 2017 by mjtsai
Airspeed Velocity on Twitter: "Eliminating IndexDistance would make writing generic algorithms much easier: https://t.co/jCyYRg74gs"
Eliminating IndexDistance would make writing generic algorithms much easier:https://t.co/jCyYRg74gs

— Airspeed Velocity (@AirspeedSwift) November 8, 2017
FavoriteTweet  AirspeedSwift 
november 2017 by mjtsai
Airspeed Velocity on Twitter: "@mjtsai If only they’d thought to ask someone who doesn’t think their preferred silver bullet is a silver bullet."
If only they’d thought to ask someone who doesn’t think their preferred silver bullet is a silver bullet.

— Airspeed Velocity (@AirspeedSwift) October 12, 2017
FavoriteTweet  AirspeedSwift 
october 2017 by mjtsai
Airspeed Velocity on Twitter: "@nicklockwood @eneko @zats Can you imagine the howls of anguish if you had to write str.distance(from: str.startIndex, to: str.endIndex) though?"
Can you imagine the howls of anguish if you had to write str.distance(from: str.startIndex, to: str.endIndex) though?

— Airspeed Velocity (@AirspeedSwift) September 21, 2017
FavoriteTweet  AirspeedSwift 
september 2017 by mjtsai
Airspeed Velocity on Twitter: "@jckarter @nicklockwood @zats @Ilseman This correlates with cost a bit, but not perfectly. I’d say if you have to allocate memory, that’s more suspect than taking O(n) time."
This correlates with cost a bit, but not perfectly. I’d say if you have to allocate memory, that’s more suspect than taking O(n) time.

— Airspeed Velocity (@AirspeedSwift) September 21, 2017
FavoriteTweet  AirspeedSwift 
september 2017 by mjtsai
Airspeed Velocity on Twitter: "@jckarter @nicklockwood @zats @Ilseman Collections have a count. They also have properties like emptiness, first element. A string doesn’t “have” an uppercase string."
Collections have a count. They also have properties like emptiness, first element. A string doesn’t “have” an uppercase string.

— Airspeed Velocity (@AirspeedSwift) September 21, 2017
FavoriteTweet  AirspeedSwift 
september 2017 by mjtsai
Airspeed Velocity on Twitter: "@jckarter @nicklockwood @zats @Ilseman i.e. a property is something a value has, whereas a function is something you can do."
i.e. a property is something a value has, whereas a function is something you can do.

— Airspeed Velocity (@AirspeedSwift) September 21, 2017
FavoriteTweet  AirspeedSwift 
september 2017 by mjtsai
Airspeed Velocity on Twitter: "@jckarter @nicklockwood @zats @Ilseman We really don’t have a hard-and-fast rule I’m afraid. The best I have is to think about the meaning of the word “property”."
We really don’t have a hard-and-fast rule I’m afraid. The best I have is to think about the meaning of the word “property”.

— Airspeed Velocity (@AirspeedSwift) September 21, 2017
FavoriteTweet  AirspeedSwift 
september 2017 by mjtsai
Airspeed Velocity on Twitter: "If you’ve upgraded your projects to Swift 4, how did you find the introduction of the Substring type affects your code?"
If you’ve upgraded your projects to Swift 4, how did you find the introduction of the Substring type affects your code?

— Airspeed Velocity (@AirspeedSwift) July 6, 2017
FavoriteTweet  AirspeedSwift 
july 2017 by mjtsai
Airspeed Velocity on Twitter: "Great point. If you’ve ever wondered why there’s an ArraySlice type, it’s essentially the same explanation as for Substring. https://t.co/xBCMlUSf1o"
Great point. If you’ve ever wondered why there’s an ArraySlice type, it’s essentially the same explanation as for Substring. https://t.co/xBCMlUSf1o

— Airspeed Velocity (@AirspeedSwift) June 8, 2017
FavoriteTweet  AirspeedSwift 
june 2017 by mjtsai
Airspeed Velocity on Twitter: "Turns out there are Sequences out there that define Element != Iterator.Element 💀"
Turns out there are Sequences out there that define Element != Iterator.Element 💀

— Airspeed Velocity (@AirspeedSwift) April 25, 2017
FavoriteTweet  AirspeedSwift 
april 2017 by mjtsai
Airspeed Velocity on Twitter: "🎉 Using associated types with where clauses, we can now create Sequence.Element where Iterator.Element == Element!"
🎉 Using associated types with where clauses, we can now create Sequence.Element where Iterator.Element == Element!

— Airspeed Velocity (@AirspeedSwift) April 25, 2017
FavoriteTweet  AirspeedSwift 
april 2017 by mjtsai
Airspeed Velocity on Twitter: "@jckarter @Ilseman people want to dynamically generate their assertion strings sometimes unfortunately (the stdlib’s internal one is static)"
@jckarter @Ilseman people want to dynamically generate their assertion strings sometimes unfortunately (the stdlib’s internal one is static)

— Airspeed Velocity (@AirspeedSwift) April 7, 2017
FavoriteTweet  AirspeedSwift 
april 2017 by mjtsai
Airspeed Velocity on Twitter: "You don’t have to make public posts to give feedback on proposals. You can always email the review manager for a proposal directly. https://t.co/sbMUqPQvOm"
You don’t have to make public posts to give feedback on proposals. You can always email the review manager for a proposal directly. https://t.co/sbMUqPQvOm

— Airspeed Velocity (@AirspeedSwift) April 6, 2017
FavoriteTweet  AirspeedSwift 
april 2017 by mjtsai
Airspeed Velocity on Twitter: "@mjtsai it’s just that this particular change was ABI impacting (changes the type of Dictionary.Value) so was proposed during stage 1"
@mjtsai it’s just that this particular change was ABI impacting (changes the type of Dictionary.Value) so was proposed during stage 1

— Airspeed Velocity (@AirspeedSwift) February 20, 2017
FavoriteTweet  AirspeedSwift 
february 2017 by mjtsai
Airspeed Velocity on Twitter: "@mjtsai there are other changes likely for Swift 4 that would make this less awkward (e.g. to supply a default value when subscripting)"
@mjtsai there are other changes likely for Swift 4 that would make this less awkward (e.g. to supply a default value when subscripting)

— Airspeed Velocity (@AirspeedSwift) February 20, 2017
FavoriteTweet  AirspeedSwift 
february 2017 by mjtsai
Airspeed Velocity on Twitter: "@jckarter "Goto is considered harmful. But what if... you weren't using Goto... enough?" https://t.co/z3XCYWKpVp"
@jckarter "Goto is considered harmful. But what if... you weren't using Goto... enough?" https://t.co/z3XCYWKpVp

— Airspeed Velocity (@AirspeedSwift) January 23, 2017
FavoriteTweet  AirspeedSwift 
january 2017 by mjtsai
AirspeedVelocity on Twitter: "#first7jobs intern, national sound archive book stacker, british library sw engineer sw eng manager next month: swift standard library @ 🍏"
#first7jobs
intern, national sound archive
book stacker, british library
sw engineer
sw eng manager
next month: swift standard library @ 🍏

— AirspeedVelocity (@AirspeedSwift) August 6, 2016
FavoriteTweet  AirspeedSwift 
august 2016 by mjtsai
AirspeedVelocity on Twitter: "Your reminder that building arrays with reduce, while fun, is accidentally quadratic. http://t.co/5hmrpQkKBS"
Your reminder that building arrays with reduce, while fun, is accidentally quadratic. pic.twitter.com/5hmrpQkKBS

— AirspeedVelocity (@AirspeedSwift) August 1, 2015
FavoriteTweet  AirspeedSwift 
august 2015 by mjtsai
AirspeedVelocity on Twitter: "http://t.co/v40Lb2ugBx"
pic.twitter.com/v40Lb2ugBx

— AirspeedVelocity (@AirspeedSwift) July 22, 2015
FavoriteTweet  AirspeedSwift 
july 2015 by mjtsai
AirspeedVelocity on Twitter: "Messages converts O(n) into O👎, which is a bit judgmental of it given it doesn’t know the context."
Messages converts O(n) into O👎, which is a bit judgmental of it given it doesn’t know the context.

— AirspeedVelocity (@AirspeedSwift) July 22, 2015
FavoriteTweet  AirspeedSwift 
july 2015 by mjtsai
AirspeedVelocity on Twitter: "Send good vibes to @chriseidhof, who is trying to get the Unicode section of the Strings chapter of our book to render in LaTeX…"
Send good vibes to @chriseidhof, who is trying to get the Unicode section of the Strings chapter of our book to render in LaTeX…

— AirspeedVelocity (@AirspeedSwift) July 8, 2015
FavoriteTweet  AirspeedSwift 
july 2015 by mjtsai
AirspeedVelocity on Twitter: "where works with while let too: while let line = readLine() where !line.isEmpty { print(line) }"
where works with while let too: while let line = readLine() where !line.isEmpty { print(line) }

— AirspeedVelocity (@AirspeedSwift) June 13, 2015
FavoriteTweet  AirspeedSwift 
june 2015 by mjtsai
Twitter / AirspeedSwift: @optshiftk code-signing probs
@optshiftk code-signing probs

— AirspeedVelocity (@AirspeedSwift) August 18, 2014
FavoriteTweet  AirspeedSwift 
august 2014 by mjtsai

Copy this bookmark:



description:


tags: