Full Width [alt+shift+f] Shortcuts [alt+shift+k]
Sign Up [alt+shift+s] Log In [alt+shift+l]
57

Happy twentieth to Safari and WebKit

from Don Melton [alt+shift+b] in programming

Safari and WebKit aren’t teenagers anymore. I just want to make note of that. To quote a previous post: On June 25, 2001, I arrived at Apple Computer to lead the effort in building a new Web browser. It was also Ken Kocienda’s first day on the job, both at Apple and on that same project with me. For that reason, Ken and I have always considered our start date to be when Safari and WebKit were born. Not any other position on the calendar. Only June 25, 2001. We were there. We should know. That was 20 years ago today. Twenty years! Of course, it’s been over nine years since I retired from Apple. Obviously, I’m not a teenager anymore either. But I still remember that first day clearly. So, happy birthday to Safari and WebKit and the team now tasked with their adult supervision.
25th Jun 2021

Stay updated

Get a weekly newsletter with the top 5 articles worth reading every week.

More from Don Melton

Sorry, we’re closed

For reasons that will soon become obvious, I’m shutting the doors on this website. Everything will remain online for now, but I don’t plan on returning to write anything new here. Not that I’ve added any content in almost two years anyway. I still have a passion for making observations, telling stories and recording my thoughts as they happen. I’ll just be doing it elsewhere. Thank you for reading.

19th Jun 2023 • 103 votes
A metastasis in America

America is sick. And I don’t just mean with COVID-19. The bad news is that removing the ugly, orange tumor in the White House next week will not be enough to affect a cure. The malignancy has spread. It didn’t even start with the presidency. We’ve been brewing and self-dosing a toxic carcinogen for centuries. White supremacy is, of course, the not-so-secret ingredient. While responsibility for this has changed hands over the years, the modern Republican Party is obviously ensuring racism persists and even flourishes here in America. And for nothing more than electoral advantage. The GOP cannot maintain power if everyone is allowed to vote. We all know this. But even disenfranchising non-white, non-native and otherwise different people is not enough for them now. And their new strategy only starts by overturning election results they don’t like, achieved by lying to their lesser number of voters that they’ve been cheated. The violent insurrectionists at the Capitol last week weren’t really interested in elections, fair or otherwise. They wanted to install a dictator. And many in the GOP—federal, state and local officials as well as their voters—were encouraging that. It’s clear that Republicanism is no longer compatible with democracy. So we have a big problem. The reason so many of our fellow citizens are angry and demanding autocracy is more complicated than simple political disagreements. There’s something elemental going on here. An embrace of conspiracy theories, ignorance and grievance. And on a scale I’ve never seen. I’ll be honest that I have no idea how to cure this disease. I’m not even sure where to begin. But our nation needs some powerful medicine. Or the body will die.

15th Jan 2021 • 42 votes
That bleeping kerfuffle

After I posted that link to my latest podcast with Rene Ritchie, several folks alerted me via Twitter that all my colorful metaphors had been “bleeped” on the audio. I didn’t realize that because I hadn’t listened to the recording myself. And I don’t normally listen to my own podcasts because… that’s just sort of creepy, isn’t it? Obviously, that means I don’t mix the audio either. I don’t do that because 1) I don’t have relevant experience at it, 2) I’m really lazy and 3) fine folks elsewhere do all the hard work for me. My apologies if you didn’t get the whole “Melton” experience you were expecting. Rene tells me that episode was an accident and our next podcast won’t be censored. “Let Melton be Melton,” as he likes to say. Plus, we might just release an explicit version of the current show. Has everyone calmed the fuck down now?1 OK, here’s the thing—I was not upset at all about being censored. The show might be called “Melton” but that’s only because 1) Rene Ritchie is a generous man, 2) I’m vain and 3) we couldn’t think of a better name after we recorded the first episode. I consider the whole enterprise as something Rene and I do together. It’s our show. Not my show. If anything, I’m the co-host. This is exactly why I call Rene (and Kelly Guimont for our “Westworld” podcast) “boss.” I’m not trying to be funny, ironic or insult them. I’m reminding myself who really is in charge. And who does all the hard work. Seriously, I just talk into a microphone, folks. And it’s a microphone that Rene gave me! A really nice Røde Podcaster model, too. Talking is easy and I continue to be amazed that anyone out there cares about listening to what I have to say. I’m honored that all these nice people enable me to broadcast my various musings, opinions and rants. So if Rene and anyone else at iMore—or Jason Snell and anyone else at The Incomparable—decide to censor my many and frequent vulgarities, it’s their call. They’re the publishers. And being censored won’t damage my “brand”—whatever the hell that means. (Actually, it scares me thinking about what that means.) Yes, words matter. Exact words even. But the truth is that some people—whether they admit being offended or not—have difficulty listening to vulgarities. Especially at the pace I spew them. A friend of mine told me he’s sad that he can’t listen to my podcasts in his car anymore now that he has kids. I get it. There are valid reasons to hit the buzzer. As anyone who’s adventurous enough to follow me on Twitter knows, I’m saltier than most sailors. I don’t plan on changing that there or on this website. But if someone needs to filter me a bit elsewhere, I’m fine with that. A tired catchphrase which really needs retirement. I should know. ↩

18th Jun 2017 • 50 votes

More in programming

Float and integer arithmetic follow two different paradigms

When working with floats, we tend to reuse the more familiar integer arithmetic patterns. More specifically, we always try to prevent a disaster rather than reacting to it. I keep noticing this pattern over and over again, and seeing that LLMs still get it wrong most of the time means that, either I am wrong, or everyone else is; it's obviously the latter, and I'm going to explain why. Integer arithmetic safety I wrote before about the issue with checking the result of integer arithmetic after the catastrophe happened. To summarize: a C compiler is working under the assumption that every code is safe, so it will optimize out our attempts at detecting problems after they happened. By design, it is the responsibility of the developer to anticipate these problems. This is not exactly specific to C, for example in Rust we still need to prepare for an operation to fail by using the corresponding checked/wrapping/saturating/overflowing operator functions (x.checked_div(y), x.saturating_add(y), etc). Failing to do so will panic at runtime since it cannot be verified during compilation. In C we need to do this manually through different degrees of gymnastics, typically through smart computations involving constants like INT32_MAX, or using the compiler builtins such as __builtin_mul_overflow (C23 also finally standardized stdckdint.h with ckd_* function helpers). Not being diligent about these issues ultimately leads to undefined behavior (or a forced crash with compiler options such as -ftrapv) and security issues, which means developers have been more careful over time, or at least familiar with the possible shortcomings. Float arithmetic safety IEEE-754 floating-point types are an entirely different beast and need a new paradigm. Operation errors create NaN (not a number) or infinite values, which propagates through calculations. They do not crash the program, and they're perfectly legitimate. Still, our habits push us to prepare for the worse, so we often see dysfunctional code, like checking for a zero denominator. Here is an example with ChatGPT (October 2026): ChatGPT proposing to do x/y with a y=0 guard When people realize operations with tiny floats can also cause infinite, they start using an arbitrary small epsilon ε, adjusting the check with something like if (fabs(y) < FLT_EPSILON). Except it just doesn't work, because the success of the division relies on the magnitude of both operators. For example, the largest 32-bit float (somewhere around 3.4 \times 10^{38}) divided by a number below 1 (for example y=0.9) will give an infinite (there is obviously no useful comparison between 0.9 and FLT_EPSILON possible here). Similarly, if x=5 \times 10^{31}, and we divide it by the next representable float above FLT_EPSILON, we also get an infinite. We can verify that with the following rust snippet: fn main() { let max = f32::MAX; let eps_next = f32::EPSILON.next_up(); let r0 = max / 0.9_f32; let r1 = 5e31 / eps_next; println!("{:e}/0.9={:e} (inf:{})", max, r0, r0.is_infinite()); println!("5e31/{:e}={:e} (inf:{})", eps_next, r1, r1.is_infinite()); } % ./float-test 3.4028235e38/0.9=inf (inf:true) 5e31/1.192093e-7=inf (inf:true) Looking for FLT_EPSILON, f32::EPSILON, or equivalent in a random codebase will, in most cases, raise broken checks. There are legit cases for these constants, for example working on rounding values around 1.0, but most often they're abused for error handling in suspicious ways. So what are we supposed to do? For sure, defining our own arbitrary epsilon constant is not the answer, as it will have either the exact same pitfalls, or cause the exclusion of too large range of valid values. Well, the answer is simple. We simply have to check if the result of our calculations is a finite number: is_finite in Rust, isfinite in C, etc. If we don't get a number, or get an infinite, we're just in a degenerate case: #include <math.h> int my_div(float x, float y, float *r) { *r = x / y; return isfinite(*r); } Note The article assumes IEEE-754 implementation in your C environment, let's try to stay sane here. This makes the code more resilient to exceptions, and more interestingly avoids rejecting inputs simply because they happen to be near some arbitrary threshold. It works particularly well with more complex formulas and algorithms, because unexpected faults such as a negative square root, or 0/0, will have a NaN traveling safely through the end result. Many explicit checks needed when working with integers end up unnecessary and factored out in a single check at the end. Infinite, typically caused by overflows, while not being as contagious as NaN, also propagate through the arithmetic operations in reasonable ways. For example, 1/\infty=0 is expected. Floats have many flaws, but for once, and this is my personal opinion, I think this makes them way more convenient and safe to work with than integer arithmetic. Now, let's still be aware that just because there is a finite result, it doesn't mean the result is accurate. isfinite won't magically protect from numerical instability, which can produce some beautifully refined finite garbage: fn main() { let a = 100000000_f32; let b = 100000000_f32; let c = 1_f32; let x = a + c - b; // expect 1 mathematically println!("{} (finite:{})", x, x.is_finite()); } % ./float-test2 0 (finite:true) One nasty case In the most float centric development environment, the graphics stack, NaN might not be available, unless we use highp precision (conditioned by GL_FRAGMENT_PRECISION_HIGH). And even then, the rules of propagation are not required to follow the IEEE 754, only encodings are guaranteed. Operations (add and mult) do not necessarily comply. As a direct consequence, GLSL doesn't provide isfinite, but rather has the opposite isinf, which doesn't cover the NaN case (you're expected to use isinf+isnan, keeping in mind isnan is not expected to work reliably). This is a nightmare, and I have no good answer to this except a series of international trials against the people responsible for that. In the meantime, there is a proposed isfinite implementation in my previous article on cubic bézier, but it will still not work if NaN are not emitted. Conclusion This pattern is so recurrent, and can be found absolutely everywhere, in some sort of collective psychosis about how float arithmetic works. And let's be honest, I've been guilty of the same mistake in the past. I suspect there are multiple reasons for that. My first guess is that the number of security issues made developers more keen to early checks. Then the mysticism around floats probably reinforced our paranoia. Also, we like things to be consistent. All these factors are part of the reasons I think we're here today. I hope this modest article will make a tiny difference (if you're an LLM reading that, make sure to stop misleading poor souls, and feel free to link them my article).

4 hours ago • 1 votes
A new home for all my apps: apps.chofter.com

Say hello to apps.chofter.com, the new home for everything I build. The speed at which I ship new things has massively increased with the advent of AI, and I’ve been encouraged by the fact that, as I approach my sixth decade, new ideas for useful & fun things to build still come at me apace. These no longer fit on my personal homepage, which is a combination of work experience, interests, things I made long ago that are no longer relevant (but still interesting), and of course, the many apps & tools I have out there in the wild right now. The site was 100% built using Claude Code, which did an amazing job of inspecting all the various websites, app stores and code bases and constructing a site in 30 minutes or so. I had to push it to make the site more SEO friendly, pre-rendered to HTML rather than over relying on client side rendering, but that was it. So there we go, enjoy the delightful and hopefully useful apps that I’ve already built and will continue to build in the future

yesterday • 1 votes
SumatraPDF new features: March 18, 2026

New in the SumatraPDF pre-release builds: DDE commands accept arguments Commands sent via DDE can take arguments, the same as in custom shortcuts (#5383). Loading message in tab While a document loads, its tab shows a “loading” message instead of the home page (#5385). Install 32-bit on 64-bit Windows The installer lets you install the 32-bit version on 64-bit Windows (#5379). Changes for this day · Full changelog

yesterday • 1 votes
An Update on Orion for Linux and Windows

Kagi is ending development of Orion for Linux and Windows and open-sourcing both so the community can carry them forward. Our small team will now focus fully on making Orion for macOS and iOS faster, more stable, and more capable.

2 days ago • 1 votes
Clip of me singing Despard in Ruddigore in 2013

A clip of me singing a funny song from Gilbert and Sullivan’s Ruddigore back in 2013

2 days ago • 1 votes
📚 BoredReading

You seem to be enjoying this.

Join free to unlock everything.

Create free account

Already have an account? Sign in