Wednesday, January 22, 2020

“How Swift Achieved Dynamic Linking Where Rust Couldn’t” ↦

Alexis Beingessner digs into some of the details of Swift’s recent effort to achieve ABI stability and contrasts that to Rust:

For those who don’t follow Swift’s development, ABI stability has been one of its most ambitious projects and possibly it’s defining feature, and it finally shipped in Swift 5. The result is something I find endlessly fascinating, because I think Swift has pushed the notion of ABI stability farther than any language without much compromise.

[…]

Also for context on why I’m writing this, I’m just naturally inclined to compare the design of Swift to Rust, because those are the two languages I have helped develop. Also some folks like to complain that Rust doesn’t bother with ABI stability, and I think looking at how Swift does helps elucidate why that is.

What is ABI stability and why is it important?

When the Swift developers talk about “ABI Stability” they have exactly one thing in mind: they want native system APIs for MacOS and iOS to be written in Swift, and for you to dynamically link to them. This includes dynamically linking to a single system-wide copy of the Swift Standard Library.

Ok so what’s dynamic linking? For our purposes it’s a system where you can compile an application against some abstract description of an interface without providing an actual implementation of it. This produces an application that on its own will not work properly, as part of its implementation is missing.

To run properly, it must tell the system’s dynamic linker about all of the interfaces it needs implementations for, which we call dynamic libraries (dylibs). Assuming everything goes right, those implementations get hooked up to the application and everything Just Works.

Dynamic linking is very important to system APIs because it’s what allows the system’s implementation to be updated without also rebuilding all the applications that run on it. The applications don’t care about what implementation they get, as long as it conforms to the interface they were built against.

[…]

So dynamic linking is our goal, and ABI stability is just a means to that end.

I’ll be honest and say that I don’t really follow all of the details here. I’ve never been much of a compiler nerd. My takeaway is that ABI stability is hard. Really hard. So hard, in fact, that even though Apple has wanted Swift to be ABI-stable from the beginning, it took 5 years and 5 major versions of Swift to achieve.

There are some features of Swift’s design and approach to compilation that lend themselves well to the goal of ABI stability. Even so, ABI stability and dynamic linking are complex goals even under the best of circumstances. I think this final thought from the article sums it up nicely:

Rust actually originally tried a polymorphic design similar to Swift’s, but they eventually backed off from it once the difficulties became clear. Supporting both polymorphic and monomorphic compilation helped Swift a lot, but I think the key difference was ultimately just that Apple had a more significant motivation than Mozilla to pursue dynamic linking and way more resources to throw at this very hard problem.


Tuesday, January 21, 2020

Is America a Democracy or a Republic?

Simple answer: yes.

Every now and then, I have a conversation with someone who seems to take particular delight in insisting that America is a republic and not a democracy. Indeed, as a younger person, I myself frequently made such a statement with the firm belief that it was not only factual but significant.

The most common justification for this view comes in the form of asserting certain definitions of the words republic and democracy. Take for example, this article from the website “Foundations of Liberty”:

In a democracy, all laws and decisions of government are made by the majority. This is not how the United States is governed. The key difference between a democracy and a republic lies in the limits placed on those in the government by the law. In a republic there exists a constitution, or charter of rights, to protect certain inalienable rights that cannot be taken away— even if a majority of voters demand it.

But these definitions don’t really match the ones in the dictionary. The New Oxford American Dictionary defines republic as:

a state in which supreme power is held by the people and their elected representatives, and which has an elected or nominated president rather than a monarch

And democracy as:

a system of government by the whole population or all the eligible members of a state, typically through elected representatives

Those in the know might go so far as to cite Federalist No. 10, which contrasts democracies and republics. The problem is that it doesn’t. It contrasts pure democracies with republics. It even defines what is meant by pure democracy:

[…] a pure democracy, by which I mean a society consisting of a small number of citizens, who assemble and administer the government in person[…]

So yes, Federalist No. 10 contrasts direct, participatory democracy with representative republics but as the dictionary entry above clearly demonstrates, that is simply not what most people mean when they say democracy (without a pure or direct in front of it).

Put simply, republic and democracy are not mutually exclusive terms. They are utterly compatible and often appropriately used together: a democratic republic. Indeed, John Adams and Thomas Jefferson themselves used the term representative democracy. While we’re at it, why not throw in a few more non-mutually-exclusive descriptors? How about constitutional? How about federal? So is America a federal republic? Yup! Is America a constitutional federation? Yes! Is America a constitutional democracy? You betcha! Now let’s put them all together: the United States of America is a federal constitutional democratic republic.

Instead of focusing on semantics, might I humbly suggest we direct our energies instead to ensuring that everyone has a voice in our country? Perhaps by fighting against voter suppression wherever it rears its ugly head?


Tuesday, January 21, 2020

Checking in on Open Offices ↦

I’ve mentioned open office layouts before and the TL;DR version is that they’re terrible. Now Fast Company gives us an update. Here’s the TL;DR version:

Are open offices still terrible?

Yup. They’re still loud and distracting. They still dehumanize everyone with a complete lack of privacy.

Are companies finally going to stop using them?

Nope. They’re so damn cheap compared to building walls that most companies won’t even consider anything else.

Meanwhile, where I’m working at the moment, not only is the office completely open with not so much as a cubicle in sight, we don’t even have permanently assigned desks. So no family pictures on your desk unless you pack them up every night and if you want to keep your same desk, you better get to the office before anyone else who wants it does. It is every bit as awful and dehumanizing as it sounds.


Friday, February 22, 2019

For Everyone ↦

As a great follow-up to the previous post, please watch this 35-minute documentary on the creation of the World Wide Web, and where it stands today.


Friday, February 22, 2019

The WorldWideWeb Rebuild ↦

The European Organization for Nuclear Research (more commonly known as CERN) recently celebrated the 30th anniversary of the creation of the World Wide Web in a unique way:

In December 1990, an application called WorldWideWeb was developed on a NeXT machine at The European Organization for Nuclear Research (known as CERN) just outside of Geneva. This program – WorldWideWeb — is the antecedent of most of what we consider or know of as “the web” today.

In February 2019, in celebration of the thirtieth anniversary of the development of WorldWideWeb, a group of developers and designers convened at CERN to rebuild the original browser within a contemporary browser, allowing users around the world to experience the rather humble origins of this transformative technology.

I doubt that even many technical people know much about the origins of the World Wide Web. When its creator, Tim Berners-Lee was featured sitting at a NeXT computer during the opening ceremonies of the 2012 Olympics in London, I’m certain there were very few watching who knew what precisely was being referenced. Nevertheless, the World Wide Web has unquestionably changed the world and Tim Berners-Lee’s declaration during that ceremony that, “This is for everyone”, should inspire us all.

CERN’s recreation of that original software is a fitting tribute. It’s amazing that many well-constructed modern websites are still readable in this faithful reconstruction. (My own website fairs well on that point, with the notable exception of the generous helping of HTML entities used to better control typography.)

I’m particularly happy that they chose to reproduce the user interface of the NeXT operating system. It’s notable that Tim Berners-Lee’s original creation was as much editor as it was browser; indeed, it made extensive use of what, at the time, were NeXT’s industry-leading frameworks for building rich text editing software.


Tuesday, May 1, 2018

More on Apple’s Cross-Platform API Project ↦

A few months ago, Mark Gurman reported that Apple was working on a way to enable developers to write applications that run on both macOS and iOS. I briefly mentioned it on this blog. Now John Gruber at Daring Fireball reports more details:

THE NAME: There is indeed an active cross-platform UI project at Apple for iOS and MacOS. It may have been codenamed “Marzipan” at one point, but if so only in its earliest days. My various little birdies only know of the project under a different name, which hasn’t leaked publicly yet. […]

WHAT IS IT? I don’t have extensive details, but basically it sounds like a declarative control API. The general idea is that rather than writing classic procedural code to, say, make a button, then configure the button, then position the button inside a view, you instead declare the button and its attributes using some other form. HTML is probably the most easily understood example. […]

WHEN: I’m nearly certain this project is not debuting at WWDC 2018 in June, and I doubt that 2018 was on the table in December. It’s a 2019 thing, for MacOS 10.15 and iOS 13.

On June 6, 2009 (bear with me, I promise this is going somewhere), Palm, Inc. launched its answer to Apple’s iPhone: the palm prē. At the heart of the palm prē was Palm’s long-awaited successor to its aging PDA/smartphone operating system Palm OS: webOS. webOS moved Palm’s platform into the then-modern age in many ways but its signature feature—the whole reason it was called webOS—was that its “native” application API used web technologies: HTML, CSS, and JavaScript. Around the same time, Microsoft announced that Windows 8 would enable developers to write applications for that OS using HTML, CSS, and JavaScript as well.

I remember thinking at the time that Palm and Microsoft had gotten the wrong end of the stick. Web-based applications were hitting something of a peak of popularity at the time and those two companies, among others1, wanted to capitalize on it. But I felt (and still do) that developing web applications was (and is) popular in spite of the specific technologies involved—HTML, CSS, and especially JavaScript—not because of them. Web applications are popular for two reasons: (1) they are cross-platform and (2) they enable a declarative style of development2. I thought that what platform providers should be doing was creating a declarative style of application development without using HTML, CSS, and JavaScript and instead using a new, purpose-built declarative syntax for the user interface and existing programming languages for the actual code.

We still don’t have many details on exactly how Apple’s declarative APIs will work but given Apple’s past work, I’d be surprised if it actually used HTML, CSS, and JavaScript. It seems more likely that they will create a new, purpose-built declarative syntax for the user interface and use an existing programming language for the actual code.


  1. Electron represents the open source equivalent of these efforts; it enables developers to write cross-platform desktop applications in HTML, CSS, and JavaScript. It is the core technology enabling applications like Atom and Slack

  2. What these technologies allow developers to do is separate the user interface from the code that runs it. The user interface becomes a matter of declaring, using a relatively simple text-based syntax, that the developer wants a button here or a text label there, etc. Separately, then, the developer defines what should happen when that button gets clicked. 


Monday, April 30, 2018

T-Mobile and Sprint to Merge ↦

Jon Brodkin, reporting for Ars Technica:

T-Mobile USA and Sprint today announced an agreement to merge, a deal that would combine the US mobile industry’s third and fourth biggest carriers to create a giant nearly as large as AT&T or Verizon Wireless. The all-stock merger deal would have T-Mobile acquire Sprint for $26 billion worth of stock, according to Reuters.

As also noted in the article, this is not the first time that these two companies have tried to merge. A 2014 attempt was in essence blocked by the Obama administration. And, of course, this is just the latest attempt at consolidation among the US’s four major carriers: AT&T tried to merge with T-Mobile in 2011 but that effort also faced opposition from the Obama administration and eventually collapsed.

The Trump administration, however, is far more accommodating to the whims of large corporations. While it is true that the Trump administration has sued to stop the AT&T/Time Warner merger, the opposition to that particular deal appears to be largely motivated by Trump’s hatred of CNN1. It seems likely to me that this deal will be rubber-stamped by the relevant agencies this time around. Consequently, the cellphone oligopoly will shrink from four members to three.


Friday, April 27, 2018

Republicans on the House Intelligence Committee Release Final Report ↦

Matt Zapotosky, Karoun Demirjian, and Greg Miller reporting for The Washington Post:

House Intelligence Committee Republicans released a redacted version of their final report from a year-long probe of Russia’s “multifaceted” influence operation, generally clearing President Trump and his associates of wrongdoing while accusing the intelligence community and the FBI of failures in how they assessed and responded to the Kremlin’s interference in the 2016 election.

The report charges the intelligence community with “significant intelligence tradecraft failings,” suggesting, without saying explicitly, that Russia’s main goal was to sow discord in the United States and not to help Trump win the election. It says investigators found “no evidence that the Trump campaign colluded, coordinated, or conspired with the Russian government,” even as it details contacts between campaign officials and Russians or Russian intermediaries.

The real news here isn’t the report itself. The report is so glaringly divorced from reality as to be laughable. The real news is that this report isn’t from the House Intelligence Committee. The report is from the Republicans on the House Intelligence Committee. The traditional bipartisan nature of the House Intelligence Committee has completely broken down. It is but one of many traditional norms on which our democracy rests which has utterly dissolved in the withering onslaught of Trumpism.

How many norms will still remain when Trump finally leaves office?


Thursday, April 26, 2018

Jackson Withdraws as VA Nominee ↦

Lisa Rein, John Wagner, and Josh Dawsey reporting for The Washington Post:

Ronny L. Jackson, President Trump’s embattled nominee to lead the Department of Veterans Affairs, withdrew from consideration Thursday amid mushrooming allegations of professional misconduct that raised questions about the White House vetting process.

Jackson’s nomination had become imperiled even before Capitol Hill Democrats on Wednesday released new allegations of misconduct. The claims include that he had wrecked a government vehicle after getting drunk at a Secret Service going-away party.

Could it be any clearer that Admiral Jackson’s nomination was an impulse on the part of Donald Trump and that it was not given the consideration or vetting that it so badly needed?


Thursday, April 26, 2018

School District Prepares for Gun Violence With Rocks ↦

Tanya Chen, reporting for BuzzFeed News:

The superintendent of a Pennsylvania school district has taken a unique approach to keep his students safe in the event of a school shooting. He’s equipped his classrooms with 5-gallon buckets of river rocks for students to throw at an armed intruder.

[…]

His idea to literally stone an armed shooter is not in direct response to the Parkland shooting. [Superindendent] Helsel told BuzzFeed News his schools have had buckets of stones ready to use in their classrooms for two years now.

It’s bad enough that our children have to worry about being shot in school. Now we are asking them to be prepared to literally stone an armed intruder while being shot at. When will this madness end?