Forgot to remember a result in C++ and realized that couldn’t have happened in Swift three times over: 1. The method would have needed @ discardableResult, 2. init would have complained about the un-initialized property, 3. using the property would have complained about NIL.

Template parameters in Swift error messages always look like a surprised grave digger. Whoever came up with that syntax, thanks for the smiles:

ObjectBox.Box<τ_0_0>

Hey, if I have a framework that does iOS 12 stuff, and I want to add one class/extension to it only for iOS 13, which uses 13-only API, can I do that without making the extension its own framework?

Like if #available but around a class?

I remember learning about linked lists because that’s how you searched for a particular window on classic macOS. They’re a fun and fairly straightforward concept if you know pointers.

That said, I’m happy i don’t need to use them in my day-to-day work anymore.

Anyone ever made their own wristwatch out there? Preferentially a wearable really dumb computer with always-on display and battery time of at least 3 days? Also with a decent built-in clock?

Anyone know where to start? Are there tiny mainboards that fit that bill?

Wasn’t aware that, in C++

Foo myVar = myMakeFoo();

will not call any copy constructors, move constructors or assignment operator overloads. Looks like myVar’s address is just passed into myMakeFoo() as the return value address and constructed in place w/o copying. Clever!

So given Combine is coming up (but will take a few years to trickle down), what would you use in Swift if you had to notify clients of changes in your object today?

Imagine you have class Lazy<A> {} and a class Other<B> {}, and want to add an extension to any to Lazy<Other<B>>, you can declare an OtherProtocol and make Other conform (“tag” Other with that protocol), and then extension Lazy<A: OtherProtocol> {}

Just saw an @Ignore annotation in some Java tests. This actually sounds like a handy way to keep institutional knowledge: Write tests for things you’ve deemed unimportant for this release, mark them ignored, then later have a reminder how this was intended to work.

I love “The Good Witch”. It’s sappy and has a tiny hint of fantasy that you can ignore if you want to. Also, Catherine Bell, James Denton, Catherine Disher and Peter MacNeill.

I only just realized that you can use protocols as tags on arbitrary classes. Not unlike how some people use template arguments as tags in C++.

I only just learned about xclangspec files for Xcode:

github.com/RobotsAnd…

Apparently just in time to see Xcode 11 dropping support for them. I guess LSP is the way forward? If Xcode 11 supports third-party LSP servers, that is.

GDPR door-slam, noun: Making your users traverse more than 3 links to even get to a screen that lets them turn off tracking.

If your site doesn’t show me an “off” switch by page 3, I’m leaving and never coming back.

Looking at you, Oath/TechCrunch/Tumblr.

C++’s

noexcept(false)

is some of the worst wording I have to use regularly. Have to look it up each time. Especially given there is also nothrow(). Why isn’t it throws(…) or so?

Neat thing about tests: Sometimes you go to write a test to verify that a failure is graceful, and in the process figure out a ridiculously simple way to actually make it no longer fail.

If you declare a top-level Swift function named fatalError() with the right signature, it’ll quietly override the Swift standard library function of the same name (at least in your module).

Could be useful for unit tests. Though its declaration as -> Never limits its usefulness.

I’ve been annoyed because every time I push the crown on my Apple Watch to get back to the home screen, Siri starts (I guess I’m holding it too long).

I found the off switch for that: You have to turn off Siri on your PHONE (the “home button opens Siri” switch in Settings).

Is there a 4-minute timer that I can clip to the edge of my tea carafe and leave there? Keep forgetting to set the watch. #bitter

Fun fact: You can’t do

git reset HEAD^

on the first commit in a repository (as much as you may wish to).

What I recently learned:

If you have a Swift class with func doFoo() and you declare a protocol protocol LikeFoo { func doFoo() }, you can make Foo retroactively conform to that protocol by writing extension Foo: LikeFoo {}.

Might be useful if you want to mock something.

Also suggests creating the GUI app based on the command line template and setting the current directory in the Scheme to make it find its files.

It’s cross-platform code, so it’s not as if it needs a bundle, but this tutorial’s code will never deploy properly to end users.

Going through a tutorial and realizing that the author is either very conservatively opinionated, or a beginner.

Tips include things like “so we don’t have to delete code we may need later, ifdef it out” and “install your framework dependency in /Library or ~/Library” …