Archive for October 11, 2017

Wednesday, October 11, 2017

HashVisitable Swift Evolution Proposal

Vincent Esche (via Tyler Fox):

In short: Hashable is utterly error-prone and does not compose well. And that’s a shame!


If even the official Swift documentation gets the implementation of hashValue wrong, then who is to expect the average Swift programmer to do any better?


Now, I’m the first to admit that a scenario where one needs to have multiple hashing algorithms is rather rare.

There are however certain circumstances where multiple hashes per value are desired, if not outright necessary: Bloom Filters.


As the name implies this new API makes use of the visitor pattern. Instead of implementing the hashing logic on the type T itself we are moving it into dedicated Hasher types, which then get passed to the objects to be hashed.

Here’s his propoasal.

See also: SE-0185: Synthesizing Equatable and Hashable conformance.

New Waterproof Kindle Oasis

Lauren Goode:

The new Kindle Oasis — the same name as last year’s premium Kindle — has jumped up in size, moving from a 6-inch screen to a 7-inch screen. It has an aluminum back, which gives it a more premium look and feel than the Kindles with soft-touch plastic.

Unlike last year’s Kindle Oasis, which used a magnetic case you attached to the e-reader to extend its battery life, the new Oasis relies entirely on its built-in battery. It has a similar physical design, with one thicker side that tapers down on the other side, for one-handed reading. But Amazon has made a point of saying that it managed to fit in a bigger battery, while keeping the tapered side of the device at 3.4 millimeters.


There are physical page-turn buttons, plus the touchscreen page-turn option; Amazon says it’s worked on both the hardware and software side of things to make page-turning feel faster.

The previous generation Kindle Oasis, which will be discontinued, is one of my favorite hardware products ever. Its shape is very comfortable to hold, it weighs only 4.6 oz. (without the case), and at 5.6″ × 4.8″ it fits in my back pocket or jacket pocket.

The new Kindle Oasis has a larger screen but weighs 6.8 oz. (more than a Kindle Voyage). It’s now 6.3″ × 5.6″ and looks significantly larger in Goode’s photo. The shape and buttons should still be good, but to me the larger size reduces the appeal a bit. Still, it’s much smaller than an iPad mini 4 at 8.0″ × 5.3″ and 10.4 oz.

See also: Kirk McElhearn, Gus Mueller.

Update (2017-11-01): Heather Kelly (via Jason Snell):

Water, it turns out, triggers the Oasis touchscreen. One small splash can turn the page, change the font size, exit the book or do anything else a rogue hand might. In my tests, it didn’t take more than one fat droplet to activate the 7-inch touchscreen.

Kirk McElhearn:

The new Kindle Oasis has the nicest display of any Kindle yet. In the past, Kindles have been plagued by uneven lighting; it was sometimes a crapshoot with different models, whether you’d see the LED bleed on the bottom or the side of the display. If you look at the photos in my review of the original Kindle Oasis, you can see that the lighting is uneven. But on the new model, it’s very smooth, with just some additional brightness at the bottom (which doesn’t show up in the photo below).

The new Oasis is also fast; page turns are fast, accessing menus is fast, and even typing is faster than before. It’s still got a bit of a lag, but you no longer have to wait to see a letter display before trying the next one when you’re searching for something.

Update (2017-12-07): Jason Snell:

The second-generation Oasis is a nice piece of hardware, but I really appreciated the light weight of the first-generation model and I had hoped Amazon would push a little bit more in that direction. The larger screen is good, but it’s not like I’m reading a hardcover book—it’s just a slightly larger paperback size, which is fine but not revelatory.