Archive for February 28, 2020

Friday, February 28, 2020

Swift Argument Parser

Nate Cook:

We’re delighted to announce ArgumentParser, a new open-source library that makes it straightforward — even enjoyable! — to parse command-line arguments in Swift.

[…]

In addition to what we’ve seen so far, ArgumentParser supports --flag arguments for Boolean or enumerable properties, multiple names for options and flags, encapsulating groups of arguments, and much more. You can learn more by visiting the repository’s README, browsing the guides in the documentation folder, and reading the in-source symbol documentation.

You can also explore the Swift project’s in-flight adoption of ArgumentParser:

  • indexstore-db is a simple utility with two commands.
  • swift-format uses some advanced features, like custom option values and hidden flags.

This looks both full featured and easy to use. It’s also interesting to see how it was implemented using property wrappers (to associate metadata with the instance variables that represent each option) and reflection (so that it can get the name of the instance variable from its declaration, without your having to retype it).

Hopefully this will eventually be built into the standard library so that single-file scripts can use it without needing to manage any dependencies.

See also: getopt_long, argparse.

Previously:

How Crash Bandicoot Hacked the Original Playstation

Ars Technica (via Hacker News):

For today’s episode of War Stories, Ars Technica sat down with Naughty Dog Co-founder Andy Gavin to talk about the hurdles in bringing the original Crash Bandicoot to gamers around the world. When Andy and his partner Jason Rubin made the decision to bring the action platforming genre into three dimensions, it required living up to their company ethos of “leaving no stone unturned” in the search for memory - even if it meant hacking Sony’s library code.

Previously:

Shadow Cloud Gaming Service Removed From the App Store

Tim Hardwick (Reddit):

Cloud gaming service Shadow has had its apps removed from the App Store after it was found to be in violation of Apple’s guidelines.

For those unfamiliar with the service, Shadow allows subscribers to play triple-A titles on their smartphones, tablets, set-top boxes and computers, while high-end remote servers take the burden of processing the graphically intensive games.

Is this another case where Apple wants them to remove In-App Purchase? If so, how was it approved the first time?

Previously:

Plague Inc. Removed From the China App Store

Eliza Gkritsi (via Cabel Sasser):

Popular infection simulation game Plague Inc. has been removed from Chinese app stores, Apple and Xiaomi users noticed today, after enjoying renewed popularity during the Covid-19 outbreak.

[…]

Chinese authorities have been known to ban adult content and games with politically sensitive hidden messages. Plague Inc. has been praised for its educational value and scientific approach.

[…]

The internet regulator informed Ndemic Creations that the game was removed from app stores for “illegal” content, the developers said in a statement released on their website on Thursday evening.

It remains in the US App Store, where it’s an Editors’ Choice.

Chris Kerr:

The studio explained it doesn’t know whether the game has been pulled because of its newfound coronavirus connection, and indicated the Cyberspace Administration has yet to offer a concrete explanation for the game’s sudden removal.

Previously:

Google Earth Beta Supports Other Browsers

Tom Warren (via Hacker News):

Google is opening up its web-based version of Earth to browsers like Firefox, Edge, and Opera today. The search giant originally launched Google Earth on the web back in 2017, and axed its desktop apps at the same time. Google says “we are big supporters of open web standards,” but Earth launched on the web with Chrome-only Native Client (NaCl) technology as there wasn’t a standard available to support what it wanted to do. This resulted in Earth becoming one of the first of many Chrome-only sites from Google.

NaCI allowed Google to bring its native C++ app code and run it directly in a Chrome browser, with all the performance required to let you zoom in and out of locations on a virtual globe. Google has spent the past three years contributing to emerging web standards like WebAssembly, which allows developers to bring native code to the web.

Now it seems to work in every major browser except Safari.

Previously:

Craig Federighi’s Advice

UC Berkeley (via Scott):

Craig Federighi (B.S. ’91, M.S. ’93 CS), the senior vice president of software engineering at Apple, Inc., delivers some “Questionable Advice from One Very Lucky Berkeley Engineer.”

This View from the Top conversation with Dean Tsu-Jae King Liu was delivered Nov. 21, 2019, in Banatao Auditorium at UC Berkeley.

He doesn’t spill any beans about NeXT or Apple, but the video gives some insights into the person in charge of Apple’s software and how he got to that position.