This reads a lot like “get off my lawn.”
I’m unsure why he’s so upset about Swift’s optionals or Kotlin’s null shorthand. Once you grok the syntax/operators, they operate intuitively.
In Swift:
var l = s?.characters.count ?? 0
In Kotlin (length is a property, not a method — c'mon Bob):
var l = s?.length ?: 0
Both are completely safe. After either of those statements you’re guaranteed to have l assigned an integer — and in either case it will be the correct amount of characters.
Are either of these examples worse than this:
size_t l = strlen(s);
Maybe, maybe not. But if s is null we now have undefined behavior. Personally, I’ll take the type safety.
Maybe, maybe not. But if s is null we now have undefined behavior. Personally, I’ll take the type safety.
To be fair, it could be a totally valid pointer with a null terminator missing down the road ending in a read to a protected page.
The shitty thing is that Pascal and Fortran and Ada and other contemporaries of C already knew the right answer to this problem.
I agree with you. But, using Bob’s ridiculous argument, the developer should be in charge of checking for the terminator and adding it if need be — or trusting that it will always be there.
Given that I have seen and written a lot of terrible pointer math, I remain unconvinced that testing for the terminator, possibly checking the remaining allocated memory, possibly calling realloc(), etc… before you get the length of a string if better than optional-syntax.
Still no official release schedule for WebKit — although it can be turned on in the developer preview of Safari Technology Preview.
The WebKit Feature Status lists CSS Grid Layout Level 1 as in development.
The alternative take — yet equally rigorous — is to only apply margins in one direction. I can remember having my mind blown by a Harry Roberts article a few years ago on this very topic. He suggests using margin-bottom to push things down, and margin-left to push things across.
Understanding margins and padding — along with a little * { box-sizing: border-box; } — is really what allowed me to wrap my mind around CSS.
that’s really interesting, thanks! as someone just learning CSS it’s great to be able to draw on best practices other people have worked out the hard way.
Related: Jason Scott’s take on this.
He does a pretty good job summarizing the need for this:
There are backups of the Internet Archive in other countries already; we’re not that bone stupid. But this would be a full, consistently, constantly maintained full backup in Canada, and one that would be interfaced with other worldwide stores. It’s a preparation for an eventuality that hopefully won’t come to pass.
I’m really excited for this. I can’t wait to read the finished version.
Here’s a little anecdote. A few months ago I saw a comment by Bob (the author of this book) on Reddit, saying that he’s currently working on a book about interpreters. That got me super excited, because I was working on my own book about interpreters! Slightly intimidated that someone, who’s already written a great book, will be releasing a book about the same topic and maybe competing with me, I contacted Bob. I told him about my book and asked him if we’re essentially writing the same book. I was unsure about keeping on working on my book, now that there’s a pro tackling the same issues and covering the same niche. His reply couldn’t have been more motivating and encouraging, even if he tried. He essentially told me that I should keep working on my book, that there’s always room for more books and that he can’t wait to read it. I still think back to that email from time to time and credit it with giving me one of the many pushes needed to finish the book.
Have you thought about making print copies of your book? I’ve been looking for an excuse to play around with Go, but I heavily favor the dead tree version. Either way, congrats on finishing it!
Yes, I plan on releasing a print version in the next couple of months. Hopefully in February. I’ll send out a message on the mailing list, as soon as I know more. The major thing that’s holding me back is creating a print-proof cover image, that has the correct size, colors, resolution, margins, etc… That’s just not my area of expertise :)
Please do! I just bought a digital copy after forgetting for a while, but I personally would be way more excited to shell out cash for something I can hold.
Wow! Inspiring.
I’m learning Go myself, and this book really excites me.