Archive for February 17, 2025

Monday, February 17, 2025

Swift Proposal: InlineArray

SE-0453:

This proposal introduces a new type to the standard library, InlineArray, which is a fixed-size array. This is analogous to the classical C arrays T[N], C++’s std::array<T, N>, and Rust’s arrays [T; N].

[…]

It’s important to understand that Array is a heap allocated growable data structure which can be expensive and unnecessary in some situations. The next best thing is to force a known quantity of elements onto the stack, probably by using tuples.

[…]

We introduce a new top level type, InlineArray, to the standard library which is a fixed-size contiguously inline allocated array. We’re defining “inline” as using the most natural allocation pattern depending on the context of where this is used. It will be stack allocated most of the time, but as a class property member it will be inline allocated on the heap with the rest of the properties. InlineArray will never introduce an implicit heap allocation just for its storage alone.

[…]

InlineArray will be a simple noncopyable struct capable of storing other potentially noncopyable elements. It will be conditionally copyable only when its elements are.

Initialization is special-cased to avoid constructing a temporary array from the literal, and it does not conform to Sequence or Collection.

We do plan to propose new protocols that look like Sequence and Collection that avoid implicit copying making them suitable for types like InlineArray and containers of noncopyable elements. SE-0437 Noncopyable Standard Library Primitives goes into more depth about this rationale and mentions that creating new protocols to support noncopyable containers with potentially noncopyable elements are all marked as future work.

[…]

With the introduction of InlineArray, we have a unique opportunity to fix another pain point within the language with regards to C interop. Currently, the Swift compiler imports a C array of type T[24] as a tuple of T with 24 elements.

But they haven’t decided how to do that yet without breaking compatibility.

Previously:

Grammarly vs. Apple’s Writing Tools

Adam Engst:

Keep that background in mind when I say that my $144 annual subscription to Grammarly is one of my most worthwhile tech expenses. While Apple is just now getting into the game with its Writing Tools, Grammarly has been helping my writing since 2016. Its interface and capabilities have improved over time, and for what I need to write and edit in Google Docs, WordPress, Discourse, Mimestream, and now Lex, Grammarly has become an essential tool. For native Mac apps, you need the Grammarly Desktop app; for Web apps, Grammarly provides extensions for Safari, Chrome (and Chromium browsers like Arc), and Firefox.

[…]

Although Grammarly lets you turn off numerous aspects of its checking, my gripes are not among them.

[…]

However, thanks to the judicious addition of generative AI tools, I’m now happy to accept a few editing tics for the significant improvements that Grammarly makes to my drafts.

[…]

Since late October, I’ve become hooked on a feature that allows you to select text and hover over a blue button to the left of the paragraph to see an improved version with changes clearly highlighted.

[…]

While Grammarly integrates seamlessly into your text and clearly shows what will happen if you accept a change in nearly all situations, Apple’s Writing Tools require constant activation and provide significantly less feedback about their changes.

Chit Chat Across the Pond:

This week, the delightful Adam Engst of TidBITS joins us to talk about how he learned to write so well, what it’s like having an editor, and then moves into how he uses the AI tool Grammarly to improve his writing.

He says that Grammarly has gotten a lot better recently.

Previously:

Update (2025-03-03): Collin Donnell:

I’m back on Grammarly, at least until we see what improvements Apple has in a few months. I still like Proofread, but the UI is pretty lacking. There’s nothing between “add missing commas” and “rewrite this and completely change the tone.”

On the Undesign of Apple Intelligence Features

Nick Heer:

The flaws in results from Apple Intelligence’s many features are correctly scrutinized. Because of that, I think some people have overlooked the questionable user interface choices.

[…]

Apple is not breaking new ground in features, nor is it strategically. It is rarely first to do anything. What it excels at is implementation. Apple often makes some feature or product, however time-worn by others, feel so well-considered it has reached its inevitable form. That is why it is so baffling to me to use features in the Apple Intelligence suite and feel like they are half-baked.

[…]

What this looks like on my Mac, sometimes, is as a blue button beside text I have highlighted. This is not consistent — this button appears in MarsEdit but not Pages; TextEdit but not BBEdit. These tools are also available from a contextual menu, which is the correct place in MacOS for taking actions upon a selection.

In any case, Writing Tools materializes in a popover. Despite my enabling of Reduce Transparency across the system, it launches with a subtle Apple Intelligence gradient background that makes it look translucent before it fades out. This popover works a little bit like a contextual menu and a little like a panel while doing the job of neither very successfully. Any action taken from this popover will spawn another popover.

As with Translate, I don’t think popovers work well for large blocks of text that I want to interact with.

Jason Snell:

I’m sure Apple is pouring everything it can into building better, more modern models, and we’ll hear about that effort in detail in June. But what troubles me most about the Apple Intelligence rollout isn’t that Apple was caught flatfooted by the AI hype train and is struggling to catch up—it’s that Apple’s implementation of AI features also feels slapdash and rushed.

Apple doesn’t have to end up with the best large language model around in order to win the AI wars. It can be in the ballpark of the best or partner with the leaders to get what it needs. But it can’t fail at the part that is uniquely Apple: Making those features a pleasure to use, in the way we all expect from Apple. Right now, that’s where Apple is failing.

Nick Heer:

Apple has a chance to move A.I. features beyond a blinking cursor in a chat bot — like a plain language command line. Very little of what is out today is a thoughtful implementation of these features. Cleanup in Photos is pretty good. Most of the other stuff — summaries of phone calls, Notification Summaries, Writing Tools, Memory Movies in Photos, and response suggestions in Mail and Messages — are more cumbersome than they are elegant.

Previously:

Gatekeeper vs. .terminal and .fileloc Files

Vladimir Metnew (2020, tweet):

Popular macOS apps with a file-sharing functionality didn’t delegate file quarantine to OS leading to File Quarantine bypass (Windows MOTW analogue) for downloaded files.

[…]

Many popular products like Keybase, Slack, Skype, Signal, Telegram decided to fix the issue, but the vulnerability remains unfixed in file-syncing apps: Dropbox, OneDrive, Google Drive, etc.

[…]

Apple knows that it’s possible to execute files on the device with .fileloc. Apple also knows that all default apps have quarantine enabled.

Launching a quarantined file with .fileloc doesn’t have security risks, because the user will be asked to confirm file launching.

That means, .fileloc is not a vulnerability by itself unless there are files without a quarantine attribute.

[…]

OneDrive removes quarantine meta-attribute because Apple granted it com.apple.security.files.user-selected.executable entitlement. […] Apple’s head of macOS security made an exception for OneDrive 😯.

And file sync apps outside the Mac App Store don’t apply it, either.

Jeff Johnson:

Remember my sandbox escape that Apple said doesn’t have any actual security implications?

Well it has actual security implications.

Thomas Reed:

Apple has done EXACTLY what I was hoping they would do to cope with the plague of adware installing malicious configuration profiles! In Big Sur, it will no longer be possible to install these profiles via the command line, or in any way without explicit user consent! 🤩

Previously: