Archive for October 17, 2022

Monday, October 17, 2022

A Possible Vision for Macros in Swift

Douglas Gregor (via Joe Groff):

Macros can offer a way out of this conundrum, because they allow one to introduce boilerplate-reducing facilities without requiring a bespoke language extension or a separate source-manipulating tool to do so. A good macro system could replace the need for a swath of new language features, but one must be careful not to degrade the development experience by making it too hard to build good tools (i.e., C macros are notorious for breaking tooling).

We propose to introduce a macro system into Swift. At a very high level, macros can be explicitly triggered with syntax such as #stringify(x + y), subsuming a number of existing expressions that use similar syntax already (#line, #colorLiteral(...), etc.) with a general features. Macros can also be triggered more implicitly in response to type checking, e.g., applying a macro to the argument passed to a function. Macro arguments are type-checked so that tooling behaves similarly to today, but macro evaluation involves transforming the syntax so that it can serve a number of different use cases.

A possible vision for macros in Swift talks about the design space and proposes a path for macros in Swift.

Previously:

Compiling Swift Generics

Slava Pestov (tweet):

Well, I finally got around to starting a write up about how generics work last year, and I think I its finally in good enough shape that I can release the first part of what is going to be a three part series. So here it is:

[…]

The first half of Part I begins with a big-picture overview of the key ideas behind Swift generics, and then goes on to talk about foundational material that's important to understanding the Swift compiler in general: the compilation pipeline, module system, request evaluator, types, and declarations. The second half of Part I actually dives into the details of the generics implementation in earnest; starting with the AST for generic declarations, and then going on to talk about generic signatures, substitution maps, conformances, and generic environments.

Previously:

WhatsApp More Private Than iMessage

Sami Fathi:

In a post sharing a Meta billboard in New York City promoting WhatsApp over SMS or iMessage, Zuckerberg said WhatsApp is far better for privacy-concerned users thanks to its end-to-end encryption, ability to set messages to disappear after a set period of time, and its availability across multiple platforms.

He’s not wrong, as iMessage downgrades to SMS if there are any Android users in the conversation, and WhatsApp’s backups are encrypted so that Apple can’t read them. WhatsApp also gives you more access to your own data, with the ability to export conversations. Unfortunately, the people I text with use iMessage.

Previously:

Update (2022-10-18): Balakumar K and James Peckham (in 2021, via Simone Manganelli):

“The information we share with the other Facebook Companies includes your account registration information (such as your phone number), transaction data, service-related information, information on how you interact with others (including businesses) when using our Services, mobile device information, your IP address, and may include other information identified in the Privacy Policy section entitled ‘Information We Collect’ or obtained upon notice to you or based on your consent,” it adds.

[…]

If you don’t want to allow Facebook to do this, your only alternative is to switch to another messaging service such as Telegram or Signal.

WhatsApp:

We collect information about your activity on our Services, like service-related, diagnostic, and performance information. This includes information about your activity (including how you use our Services, your Services settings, how you interact with others using our Services (including when you interact with a business), and the time, frequency, and duration of your activities and interactions), log files, and diagnostic, crash, website, and performance logs and reports.

iMessage also collects some metadata.

The actual WhatsApp message data is not shared with Meta. However, it is stored in iCloud backups:

If you have iCloud Backups turned on for your entire iPhone, an unencrypted version of your chat history is also backed up to iCloud. To ensure your WhatsApp chats and media are only backed up with end-to-end encryption, turn iCloud Backup off on your device.

For information on how we collect and process your data, including your end-to-end encrypted backup, please see the WhatsApp Privacy Policy.

Matthew Green:

Hmm, took a look at the Apple developer docs and I see why Apple may have made this harder than it should be. Doesn’t excuse WhatsApp for failing to engineer a solution.

Apple:

The isExcludedFromBackup resource value exists only to provide guidance to the system about which files and directories it can exclude; it’s not a mechanism to guarantee those items never appear in a backup or on a restored device.

However, it seems like they could get around this problem by encrypting the database or by storing it in a folder such as Caches that is excluded from backup.

Ending Support for Facebook Instant Articles

Nick Heer:

Sara Fischer, of Axios, is reporting today that Meta’s proprietary Instant Articles format will go away in April. This should not be a surprise — Instant Articles does nothing for Meta’s virtual reality efforts, Meta is cutting costs, and Google has been phasing out its commitment to its similar AMP format.

Previously: