Insert the url of the feed you want to read here (e.g. http://news.google.com/?output=rss):

inessential.com

Brent Simmons’s weblog.

My CocoaConf Yosemite 2017 Talk 25 Mar 2017, 6:55 pm

Yosemite 2017 was so great. It always is.

Below is the rough draft of my first-night talk. A few notes…

The actual spoken version is probably not even close to the text, which was written before any rehearsal, and of course it’s never my intent to memorize it exactly.

The bit with Laura Savino was a quick three-chord rock medley. We both played acoustic guitar and sang. It went like this:

B: Louie Louie, oh baby, we gotta go
L: Yeah yeah yeah yeah yeah
B: Louie Louie, oh baby, we gotta go
L: Yeah yeah yeah yeah yeah
B: I live on an apartment on the 99th floor of my block
L: Hang on Sloopy, Sloopy hang on
B: I look out my window imagining the world has stopped/> L: Hang on Sloopy, Sloopy hang on
[Slight change of chords]
B & L: Teenage wasteland, oh yeah, only teenage wasteland [repeated]

Here’s my favorite video for Brimful of Asha.

During the Squirrel Picture interlude (slide #3) I told the Squirrel Story, which wasn’t planned or recently rehearsed, but I’ve told it often enough that it didn’t really need rehearsal.

I dedicated the performance of Hallelujah to Dori Smith.

The talk was meant to be about 20 minutes long. Afterward I went around the room with a microphone and each person introduced themselves. (The talk’s job is to be a first-night ice-breaker talk.)

I spent about 10 hours on rehearsal for those 20 minutes.

Here’s the talk:

Slide #1: Three Chord Rock

Hi. I’m Brent.

Before I get started — seeing my friend Brad Ellis reminded me of the most rock-n-roll moment of my life. Where’s Brad? Hi Brad. Anyway — I was at a party at my friend Chris’s house, and he let me borrow his guitar and do a sing-along. I think we did White Rabbit and Me and Bobby McGee and Hotel California.

Well, here’s the problem — I have a hard time hanging on to a guitar pick. Especially after a few beers. So at one point the pick goes flying, and I’m strumming with my fingers.

But I had a hangnail, and it got a bit aggravated as I was strumming. At the end I noticed that there was my actual blood on the guitar. I felt bad about it, but Chris was gracious, of course, and I thought that right then: that’s rock and roll.

You can use this as metaphor. Bleeding? Keep right on playing. Maybe you won’t even notice that you’re bleeding, at least not until you stop.

Chris told me later that the guitar cleaned up fine, so all was well.

Okay. On to the actual talk…

I bet most of you have heard the phrase “three chord rock n roll.” Or have heard that “rock is so great because you only need three chords.”

What you may not realize is that it’s even easier than that: it’s three specific chords. Always the same three chords.

They might be in any key but they’re the first, fourth, and fifth. In the key of C, the first is C, the fourth is F, and the fifth is G. In the key of A it’s A, D, and E.

And when a song does have more than those three chords, it has at least those three chords. They’re the foundation for almost all pop and rock.

One part of music is building tension and then resolving it. I’ll demonstrate on guitar.

[On guitar] Play the first .... and you’re fine. You’re home. Play the fourth .... and there’s a little tension. Not a ton, but some. But you want to go back to the first, to home.

Then play the fifth ... and you have maximum tension. You definitely want to go back home to the first.

So with those three chords you have everything you need to write a thousand songs.

Now for a little demo, I’d like to invite Laura Savino up to help me out.

[music]

Thanks, Laura!

SO LET ME MAKE TWO POINTS VERY CLEAR.

  1. ONE. If you’re writing apps or a website or doing a podcast or whatever — if you’re just starting out and only know the equivalent of three chords, don’t worry — you can create a masterpiece with just three chords.

  2. TWO. If you do know more than three chords, you might want to consider just using those three chords anyway. People love those three chords. They’re appealing. They’re accessible and intimate. They work.

Slide #2: “Brimful of Asha“ by Cornershop, Asha Bhosle, and You

One of my personal favorite three-chord-rock songs came out in the mid-90s. Brimful of Asha by Cornershop.

Who here knows this song?

Let me explain what it’s about:

Asha Bhosle sang songs for Bollywood musicals. The actresses would lip-sync, but it was her singing. She did this for over a thousand movies. Over 12,000 songs.

Some of those songs would be released as singles. Years ago a single would come out on vinyl, as a 45. A 45 is smaller than a regular album, and it has one song on each side. The number 45 means 45 revolutions-per-minute — you’d have to set your turntable to 45 instead of the usual 33 1/3. So: a 45 is a single.

So here’s a little bit from the song:

[There’s dancing, behind movie screens…]

I love that image. That Asha is not just singing but dancing as she’s singing. We never see her dancing, but that joy and engagement shows up in her performance.

And so this song is about hope. It’s about how a song can bring some consolation and hope when people need it.

And her name Asha actually means hope. Brimful of Asha — brimful of hope.

HERE’S MY POINT.

We're in the same business. People form an emotional connection to whatever we’re making. The things we make can bring hope to other people. Knowing that, it’s our job to be as engaged and joyful as she is as we make our things. Maybe we’re not literally dancing, but it should be the metaphorical equivalent.

Slide #3: Squirrel Picture

Squirrel!

When I was a kid we went to a Methodist church. I haven’t been to church hardly at all since I was a kid, but I remember one cool thing from church services: the minister would pause and ask people to shake hands with the people around them.

So here are the rules. Tell people to have a good conference, and shake hands with at least one person from another table. Stand up!

Slide #4: “Hallelujah” by Leonard Cohen, with Singing by James Dempsey

A few weeks ago I found myself in a hotel bar with a bunch of other nerds. I also found a piano. If there’s a piano, I’m going to play it. So I talked a few people — James Dempsey, Jean McDonald, Curt Clifton, and Jim Correia, into singing some songs.

I forget who suggested Hallelujah. Might have been James. I didn’t know it very well, but I did my best. James sang, and he was awesome.

So when I was thinking about this talk, I was thinking of doing the most beautiful possible thing I could do. So I remembered James singing this song.

I may not be religious, but I think it’s plain that there is awesome magnificence greater than anything any human could make. It’s right outside.

I’m not sure bears feel humble at the sight of these mountains; I’m not sure birds are awed at the vistas they fly over.

But we do. Humans do. And knowing that we can’t measure up, it doesn’t stop us. Intead, we’re inspired.

So here’s what I love about Hallelujah. It’s about trying and failing, and loving and losing — and singing Hallelujah anyway. In Cohen’s words, it may be a broken Hallelujah, but it’s still on our lips.

James Dempsey please report to the stage.

Everybody is encouraged to sing along. Especially to the chorus.

[Hallelujah]

Slide #5: Picture of my cat Papa

I’m going to go around the room and have everyone introduce themselves. RULE: if anyone can’t hear, yell out.

Them That’s Got Shall Get 8 Mar 2017, 2:29 am

I try — earnestly, with good faith — to understand the Republican ideologies.

And I think I’ve figured out one of them: they want to make life harder for poor people so that they have more incentive to become rich, and they want to make life better for rich people to reward success, since it should be rewarded, and since doing so provides even more incentive for poor people to become rich.

If you look at it just the right way, you can see it’s not entirely wrong. If the government made material life pretty sweet for everybody, then some people wouldn’t bother to work to earn a living. I wouldn’t bother — I’d just make software and give it away for free.

If the government made life semi-sweet — well, anybody who wants the full sweet would want a job. But some people would be fine with semi-sweet, and they wouldn’t work.

I think that’s where Republicans stand: they think the government has made life semi-sweet, enough so that a bunch of people just take and don’t work. Republicans think: we need to give them an incentive to work.

This explains the health care bill: it takes from the poor, who need incentives to work, and gives to the wealthy, who need rewards for their success. (So the Republicans think.)

* * *

It’s as if the Republicans have no realistic conception of what it’s like to be poor. The choice isn’t between health care and an iPhone, as one Republican suggested — it’s between food and rent, or worse, and forget health care and iPhones entirely.

I was “poor” in my very early 20s. I put that in quotes because I was never in danger of starving or becoming homeless — my parents would have helped me. (They did plenty, in fact.)

But still, even this small experience gives me some insight. I remember buying generic macaroni and cheese because I literally didn’t have enough money for Kraft. And forget hot dogs. And forget vegetables.

I don’t mean that I had some money lying around that I’d put aside; I mean that I had a few dollars to last a week, and if I bought Kraft, which was a few dimes more, I would run out of money before the week was over.

(My bank had a $5 minimum balance for my account. I could withdraw as little as $5 — and in those days ATMs were free — but that would have meant having more than $10 in my account to get that $5. I got so angry because I had, as I recall, $6.91 but couldn’t get at it. I remember thinking that another $5 would change my life.)

I’m not complaining about this, or saying that I had things particularly tough. Not at all.

I’m saying that if you take that experience, and take away any possibility of help from family, and then stretch it out for years and decades — with the inevitable issues, health and otherwise, that happen to everybody — then you have a life where getting ahead is really, really difficult. I can’t imagine; I can only try.

But it’s no semi-sweet life. Not even close.

Don’t Be Scared If You Have to Get an MRI 23 Feb 2017, 9:37 pm

“Totally normal,” said my neurologist of the results of the MRI on my head. No worries.

I was afraid to get an MRI in the first place.

I got a crown last week, and that didn’t worry me — it’s my ninth. Breathe the gas and just chill for a while. No big deal. It’s almost sad when it’s over.

But I was afraid to get the MRI, because I’m slightly claustrophobic, and all I knew was that they’d put me in a big tube and then walk away.

How It Went

I didn’t have any dietary restrictions in advance. They didn’t inject me with anything. I was told to wear comfortable clothes with no metal — so I wore sweatpants, a T-shirt, and a sweatshirt. I was able to leave my rings (gold, two small diamonds) on.

Beforehand I did a three-sixty in front of a ferrous metal detector. Then I was led through the doors with the giant warnings about extremely powerful magnets.

I put in earplugs that the technician gave me, and then put on headphones. He asked me what music I’d like, and I replied, “80s. Bowie.” I lied down on the thing. There was a firm but not painful thing to hold my head still and give it something to rest on. Under the lower half of my legs was a foam thing that kept them elevated a little. It was comfortable.

He told me it would take about 20 minutes. He also gave me a bulb to hold onto and to squeeze as an alert, and he said they could pause the tests if needed.

Then he slid me in. The tube was more narrow than I expected. And for the first couple seconds I did feel panic rising a little bit, and I thought about squeezing the bulb — but I didn’t. I oriented myself and took some deep breaths.

I was staring up at the top of the tube (I was on my back), but there was this mirror contraption (two mirrors? hard to tell) that I was looking at, and so I was looking out through the end of the tube. What I was actually seeing was a nice, calm painting on the wall — a river and some trees — and I could see the length of my body and my feet, which were free of the tube. I told myself I could scramble out on my own if I had to.

The music started with a Bowie song — “Life on Mars.” Later there were songs by Talking Heads and similar bands. It was good to have music because I could note the passage of time that way. (I guess I was listening to a Pandora station or something similar.)

The machine was noisy, but I had plenty enough ear protection, and the different scans had different patterns. One scan near the end included a bit of vibration. The technician talked to me through the headphones a couple times to let me know how much time was remaining. I just kept my eyes on that painting the whole time.

I had no trouble being still, except when I had to swallow. I just did. It was otherwise comfortable. And I could have gone another 20 minutes, easy.

* * *

Of course, I’m lucky. I have very good insurance through Omni, and it paid for this. And, even luckier, the results were totally normal.

Hear that, world? The inside of my head is totally normal. I don’t mind feeling good about some good news for a change.

Update 4:15 pm: I’ve heard that not all MRIs are so nice. They might not have the mirrors and the music. In that case, well, I’m sorry. Just remember that they won’t forget you’re in there, and they’ll let you out at the end. Stay cool.

OmniOutliner Essentials 22 Feb 2017, 6:17 pm

Omni introduces OmniOutliner Essentials:

We didn’t want to just reach out to our existing audience; we wanted to introduce the joys and benefits of outlining to a much larger audience. We decided that meant two things: we needed to make the app much simpler, and we needed to make it much more affordable.

It’s in public preview now. You can check it out.

I’ve been the junior developer on the OmniOutliner team for a couple years, and it’s a joy to work on an app that I’ve loved for years as a user. We’re not finished yet with this release, but I’m very happy with how it’s turning out.

PS I like that Ken mentions MORE in the blog post:

We shipped the first beta of OmniOutliner while Mac OS X was still in beta, and doing so introduced us to a passionate community of outliners who had been using great outlining tools like MORE for over a decade.

MORE was by Living Videotext, which was Dave Winer’s company. Later I went to work at Dave’s company UserLand Software, which also included an outliner in its app Frontier, which I worked on. So there is a sort-of family tree connection from OmniOutliner back to MORE.

How Trump’s Support Erodes 5 Feb 2017, 12:25 am

Even Trump’s supporters know he’s not a good and competent man — nevertheless, they think they can get what they want from him. It’s a cynical deal, and bad, but you can understand it.

Trump’s vagueness and flip-flops, and the suggestion that he not be taken literally, all help him with this: his supporters, who don’t all want the same things, see what they want to see.

Many Republicans wanted a corporatist to replace Scalia on the Supreme Court, so that decisions like Roe v. Wade could be over-turned and, especially, so that more decisions like Citizens United would be made. It’s likely they’ll get that with a Gorsuch confirmation, no matter how Democrats fight (and they should fight).

But beyond that, every time Trump actually does something specific — as opposed to just saying hard-to-pin-down things — he erodes some support.

For example: many Republicans — Vice President Pence perhaps foremost, along with the Christian Sharia — want to see LGBTQ protections rolled back. But other Republicans don’t, and Ivanka Trump and Jared Kushner reportedly managed to prevent (at least for now) an Executive Order to that effect.

Many Republicans support multilateral free trade (as do I), and in particular agreements that strengthen our ties in Asia as a balance against emerging Chinese power. Well, TPP is not going to happen, and the future of NAFTA is in question.

Many Republicans do not support a Muslim ban which would make our country less safe and demonstrate to the world that we are not the beacon of liberty we’ve claimed.

Many Republicans support a strong NATO alliance and consider Russia one of our biggest threats — but Trump doesn’t. The jettisoning of the post-war American peace in favor of allying with Russia in a clash of civilizations with Islam is not what every Republican wants to see. (What is the winning condition — or final solution — for that kind of clash?)

Not every Republican is willing to spend taxpayer billions on a big, beautiful wall. They all know that Mexico is not paying for it.

Yes, there are some supporters who’ve been happy with everything.

But with each specific move, or lack of move, more supporters learn they’re not going to get what they want, and they learn they’ll get some things they don’t want.

Trump campaigned as almost a Rorschach test, where a large-enough coalition could believe he was on their side. As he makes specific moves, elements of that coalition learn that he’s not.

And that’s how his support erodes — because once you realize he’s not on your side, all you have left to support is his narcissism, mendacity, cruelty, corruption, and incompetence.

Web Developer Position Open at Omni 31 Jan 2017, 8:57 pm

Check out Omni’s jobs page:

The Omni Group is seeking a senior front-end web developer to develop and maintain a world-class website for our Mac and iOS products. The position is part of the Design Department and will focus on bringing mockups to life.

Omni makes great apps and it’s a wonderful place to work.

First Week Notes 30 Jan 2017, 8:03 pm

It’s not Russian Roulette when there’s a bullet in every chamber — it’s just Russian.

* * *

It should be clear by now that Democrats in Congress should resist every single thing Trump attempts. Every nominee. Every law. Every single thing. Do not collaborate.

* * *

The next thing might be a “Religious Freedom” executive order that permits anti-LGBTQ discrimination.

* * *

Things move fast. History:

Jan 30, 1933: Hitler becomes Chancellor of Germany.

Feb 27, 1933: Reichstag fire.

Mar 23, 1933: Enabling Act, which establishes the dictatorship.

Things move faster these days, seems like. The question is: what will be the equivalent of the Reichstag Fire?

It has to be an emergency where Trump can claim “temporary” expanded powers.

Would massive, continuous protests be enough? Quite possibly. (Which is not an argument against protests. I’m quite definitely in favor of protests.)

But don’t be surprised when those powers end protest, free speech, and the free press, in the name of national security and order.

You might think Trump isn’t historically aware enough to know the would-be dictator’s playbook. Maybe he is, maybe he isn’t. I don’t know.

But Bannon is.

Mighty Yosemite 25 Jan 2017, 5:01 am

A little birdie — okay, it was Sol-meister K. — tells me that CocoaConf Yosemite is close to selling out.

Don’t miss out! It’s so beautiful. This will be my third trip — because I miss it when I’m not there, and because the people are awesome.

Omni’s Roadmap and Scripting 24 Jan 2017, 8:22 pm

Omni: Looking Back, Looking Ahead—2017 Edition:

In 2016 we scratched the surface with URL automation on iOS, but in 2017 we plan to roll out user automation on iOS in a big way across all our apps with a much richer set of capabilities. This automation support won’t be limited to a simple set of URL primitives; instead, we’re adding support for running JavaScript code: code that has the same level of deep support for manipulating the data in our apps as we’ve previously exposed to AppleScript…

Right before the holidays I approached Sal [Soghoian] to review the automation work we’ve been doing, and over the past weeks he’s been enthusiastically exploring the boundaries of what’s already possible as well as helping us see what else we need to build before shipping this.

Today 20 Jan 2017, 6:10 pm

Today wasn’t so bad. Sure, the enemies of democracy, the Constitution, rationality, compassion, national and international institutions, decency, competence, ethics, art, science, and truth itself — and of anyone who isn’t a white man — now darken the offices of power. But they haven’t done much yet. The bad days are still to come.

My loathing and contempt for President Trump feels complete — but it isn’t. It will continue to deepen.

Tomorrow 19 Jan 2017, 9:10 pm

Remember today, since we may spend the rest of our lives getting back to this point.

I hope to remember tomorrow as the first of many days where the American people said “fuck you” to the new President.

The Difference in the Vote 6 Jan 2017, 10:24 pm

Had Hillary Clinton won Wisconsin, Michigan, and Pennsylvania — states that normally go blue — she would have won an Electoral College majority and she would be President-elect.

She didn’t — despite winning the popular vote by nearly 3 million votes — and Donald Trump is President-elect.

Russia worked to influence the election. Did they succeed? Did their efforts matter?

I don’t know how you’d gauge that. But it’s interesting to note just how close it was.

Wisconsin: 1,405,284 - 1,382,536 = 22,748

Michigan: 2,279,543 - 2,268,839 = 10,704

Pennsylvania: 2,970,733 - 2,926,441 = 44,292

That adds up to Trump winning those states by 77,744 votes.

That’s a small number of votes. That’s 0.06% of the total votes cast (128,824,833) — or 0.82% in Wisconsin, 0.24% in Michigan, and 0.75% in Pennsylvania. Not even 1% in any one of those states.

If you grant that Russia’s efforts had a small effect — well, there’s the difference.

You may think otherwise: you may think their efforts had an even greater effect, or none at all, and I suspect what you think depends on which candidate you backed.

For me: I believe that everything mattered. Russia’s attack on our democracy isn’t the only issue of consequence. But, still, take away just this one thing, and I strongly suspect Clinton would have won.

PS In contrast, Clinton won the popular vote by 2,865,075 votes, which is 2.2% of the popular vote.

The Declassified Report 6 Jan 2017, 9:53 pm

From the Office of the Director of National Intelligence:

We assess with high confidence that Russian President Vladimir Putin ordered an influence campaign in 2016 aimed at the US presidential election, the consistent goals of which were to undermine public faith in the US democratic process, denigrate Secretary Clinton, and harm her electability and potential presidency. We further assess Putin and the Russian Government developed a clear preference for President-elect Trump.

(Via Talking Points Memo.)

Manton’s Thing 6 Jan 2017, 9:22 pm

Manton’s doing important work, and you should back it.

Microblogging on the open web could be — should be — the next thing. Manton’s building it. With your help.

OPML File Type on Macs 5 Jan 2017, 9:20 pm

I was fixing a bug in OmniOutliner where it wouldn’t open a file with an uppercase .OPML suffix. I did some digging, and the fix was to register the app as handling the com.apple.news.opml file type.

Which upset me. I’ll explain.

OPML — Outline Processor Markup Language — was invented in 2000 by Dave Winer at UserLand Software. It’s not Apple’s format, and the correct file type is org.opml.opml.

I was working for Dave at the time. Some time after Dave wrote the first OPML reading and writing code, I ported it to C. Later, when I was working on NetNewsWire, in 2002, I wrote what may have been the first Objective-C code for reading and writing OPML. And today I work on OmniOutliner, which supports OPML, and I’ve published an open source OPML parser.

So I know OPML. After Dave, I may have worked with this format more than anyone else in the world.

This file type redefinition not only created a bug that I had to figure out and fix, it also demonstrated disrespect. I suspect it was entirely thoughtless — but, well, that’s still bad.

Radar forthcoming.

Update: Bug filed: rdar://29888756.

‘The Devastation Is Very Important to Me’ 3 Jan 2017, 8:26 pm

During the Cold War, I was a kid, and then a teenager, and I often thought about the end of human life. Maybe an all-out nuclear war followed by nuclear winter would not have killed everybody, but maybe it would have.

I imagined a billion people vaporized. Then I imagined just one person vaporized a billion times.

I imagined one person dying in flames a billion times. I imagined one person coughing and sick and dying of radiation poisoning a billion times. I imagined one child dying of hunger, in the dark, a billion times.

Every single good thing a human hand ever did is wiped away. Every argument made meaningless. Spoken and written words all vanish — the very idea of words is gone.

The legs of every single table break, and not a single table stands to hold a vase of flowers. No windows hang on anywhere. Buildings subside, dams allow the water through, and airplanes sink into the ground.

Dogs, if they live, reshape back into wolves, over generations, and cats forget our warmth. Animals know things, but they don’t know they know things. If they feel love, they can’t name it.

The wind rushes over the poisoned ground, touching no one forever, and the sun shines for billions more years but never again on human consciousness. The sun illuminates no human grace or tenderness or mercy, because we are gone, and, in this terrible end, it would have been better had we never lived.

Nobody knows the nothingness or calls it nothingness.

* * *

So fuck anybody who says that more countries should have nuclear weapons, or that we should have more bombs, or that an arms race would be just fine.

Fuck fucking off.

Lindy West on Leaving Twitter 3 Jan 2017, 7:03 pm

She writes:

On 29 December, Twitter CEO Jack Dorsey tweeted: “What’s the most important thing you want to see Twitter improve or create in 2017?” One user responded: “Comprehensive plan for getting rid of the Nazis.”

“We’ve been working on our policies and controls,” Dorsey replied. “What’s the next most critical thing?” Oh, what’s our second-highest priority after Nazis? I’d say No 2 is also Nazis. And No 3. In fact, you can just go ahead and slide “Nazis” into the top 100 spots. Get back to me when your website isn’t a roiling rat-king of Nazis. Nazis are bad, you see?

Style Guide Update: Agent of Russia 2 Jan 2017, 10:33 pm

As we were updating the inessential.com style guide for the new year, we came across an interesting question: do we refer to Donald Trump as:

  • President-elect Donald Trump, or
  • President-elect and Russian agent Donald Trump, or
  • President-elect and agent of Russia Donald Trump.

(Obviously, “President-elect” changes to “President” on January 20, unless God graces us with a stroke of luck.)

The first option was discarded as a disservice to our readers. So it really came down to this wording: “Russian agent” or “agent of Russia.”

The committee was divided, and arguments were intense and lengthy. But we finally decided that “Russian agent” could imply that he is on the books and takes direct orders from Russia, which we can’t prove right now.

However, “agent of Russia” simply says that he is working to effect change benefiting the interests of Russia before our own. Which is obvious, and objectionable only in the sense that we regret that it’s true.

So there you have it. Until something changes, we will refer to him as President-elect and agent of Russia Donald Trump.

Why I Prefer Protocol-Oriented-Programming in Objective-C to Swift 30 Dec 2016, 11:42 pm

I first learned protocol-oriented-programming with Objective-C, and I was very pleased to see the Swift team emphasize this style.

But, at least at this writing at the end of 2016, I still run into problems when I use this style of programming in Swift.

Here’s the problem I’m trying to solve:

Variant Value

I’m working on a schema-less hierarchical database. Tables can contain tables, and they can contain values such as strings, numbers, booleans, dates, arrays, and so on.

To represent these values, I’d rather use a Value protocol rather than a Value class. If it’s a protocol, then I can have completely separate implementations: BoolValue and DateValue and ArrayValue and so on would conform to Value, but otherwise would have different implementations.

But here’s the thing: ArrayValue needs to have an actual Swift array of type [Value].

So let’s say you want to add something to that Swift array, where arrayValue is of [Value] type. Let’s say you’ve created trueValue, which is a BoolValue, and BoolValue conforms to the Value protocol.

arrayValue += [trueValue]

You can’t. Because even though BoolValue conforms to the Value protocol, this isn’t handled automatically. The compiler knows all the types involved, but it still won’t let you do this unless you explicitly cast. The following works:

arrayValue += [trueValue as Value]

In Objective-C, no casting is required:

[arrayValue addObject:trueValue];

This may seem like nitpicking on my part, but that added bit of housekeeping makes protocol-oriented-programming in Swift feel a little bit unnatural.

A natural form of protocol-oriented-programming might start with this premise: any time the protocol type is called-for, you can use an object that conforms to that protocol.

More complexity, to push the point

Let’s say you have two arrays:

let array1 = [trueValue as Value]
let array2 = [trueValue]

You and I both know that those arrays contain just one object, and it’s an identical object. Those two arrays are absolutely equal.

But you can’t compare them:

array1 == array2 will not compile, because array1 is of type [Value] and array2 is of type [BoolValue]. Even though BoolValue conforms to Value, this won’t work.

In Objective-C, you’d just use isEqual:, and it would work as expected.

But it gets worse:

let array1 = [trueValue as Value]
let array2 = [trueValue as Value]

Okay: now you know those two arrays couldn’t possibly be more equal.

But array1 == array2 still won’t compile, and you’ll get the following error:

binary operator '==' cannot be applied to two '[Value]' operands

In Objective-C, you’d write:

NSArray *array1 = @[trueValue];
NSArray *array2 = @[trueValue];

And [array1 isEqual:array2] will return YES.

(You could type those arrays using lightweight generics, and the outcome is the same: it works.)

So: a second premise for natural protocol-oriented-programming might be: a protocol-conforming object should have the same features as other objects — for instance, you should be able to make it Equatable (the equivalent of, in Objective-C, responding to isEqual:).

Two TV Shows 29 Dec 2016, 7:26 pm

Orange leader. Dominance and narcissism and corruption and bullshit and lies. Families breaking up. The claim of making the world great masking a business empire.

See Leah Remini: Scientology and the Aftermath. It’s riveting.

And I can’t help but feel like, in a way, all of America just joined Scientology. (Not literally, of course.)

* * *

The Man in the High Castle has long been my favorite Philip K. Dick novel, and one of my favorite novels ever.

(My Mom pushed it on me when I was a teenager. I’ve been a Dickhead ever since.)

In it, the Germans and Japanese won the second World War (or did they?) and America is split up and occupied — by the Japanese empire on the west and the Reich to the east.

I’m five episodes into the TV show. It doesn’t faithfully track the novel — it’s much more of a thriller than I remember from the book. Which is fine: the novel is a novel, and the TV show is a TV show.

And I can hardly pull myself away, not least because it also speaks to the current moment.

Page processed in 0.564 seconds.

Powered by Super Surge in cooperation with Fresh Content.