Feeds:
Posts
Comments

The Qt World Summit videos were just posted, including my talk which was a condensed (40-minute) version of my CppCon 2017 metaclasses talk with some small tweaks for a Qt-specific audience.

Here it is below:

Last week I did an interview by email with InfoQ. It just went live:

C++17 is Here: Interview with Herb Sutter

Topics include:

  • What parts of C++17 should developers get most excited about?
  • Why didn’t concepts make it into C++17?
  • What will be the major focus areas for C++20?
  • What do you find interesting or inspiring about new languages like Rust, Swift, and Go?
  • Any new books coming? What’s your main focus today?

In my household, iOS 7 was sickening — literally. When it came out with its flashy parallax home screen and (IMO too often gratuitous) motion effects, my wife was one of the many people it immediately made motion-sick. After 30 years of loyally loving Apple products, my wife almost had to dump her iPhone. It was so bad that it’s the only time in my life we’ve written an email directly to the CEO of a company; we didn’t expect Tim Cook to reply, but we hope it helped raise awareness, and fortunately (likely not because of us, even slightly, but very happily), Settings > Accessibility > Reduce Motion came long just in time, and iOS was usable again.

Now iOS 11 has done it again. Just unlocking the phone is motion sickness-inducing because the lock screen now flies upward out of the way on every unlock, even if you have Settings > Accessibility > Reduce Motion enabled. (What happened to “No means no”?) And there appears to be more motion again around the lock and home screens and when just opening and switching the built-in apps, so now my wife is feeling ill again in the first 10 seconds of every phone session since she upgraded, and we’re having Android conversations again. And we don’t want Android. Really.

iOS is supposed to be the most usable phone OS, but you can’t use something if you can’t look at it.

 

Open letter to Apple designers:

We love your work because you love usability, and especially in recent years you love accessibility. Please, get back to those roots.

What is it with all the motion lately? You are known for minimalism, and that “design is how it works.” Design is not about “how it looks” eye candy — gratuitous motion is not a feature, yet it seems that in recent releases you have had a temptation to go for “cool” effects that do not improve usability. Please resist. I hope we can all agree that parallax on the home screen has insignificant effect on improving usability; I turned it off as soon as I could even though I’m not motion sickness-prone (seriously, this aspect of iOS reminds me unflatteringly of Clippy bouncing around). And yes, I realize that you likely made the iOS 11 lock screen swerve careen glide up on unlock in order to teach that “hey look! see? it lives up there just off the top of the screen” so that we remember that we can now pull it down anytime to get it back — yes, we know, we learned it once the first time, could we please now not have to live with that animation forever? Please stop with the careening screen elements. You know what Nancy Reagan would say about the animations: Just Say No.

Minimal-change proposed resolution: Please, just make all the new motion effects, including the fly-away lock screen, respect Settings > Accessibility > Reduce Motion. (Translation: “No means no.” We said No already. Please respect it.) Or give us a new way to turn it off. Please.

We want to keep using iOS, but we can’t use it if we can’t look at it. We don’t want to have to switch to Android to get a phone we can use. Don’t let Android win on usability, which is supposed to be your home turf — and don’t let Android win on accessibility, which is so important these days and which I know is important to you.

Thank you for your consideration and help.

 

If you know of a workaround that can disable these awful motion effects, please mention it in the comments. (But please don’t suggest jailbreaking, which isn’t an option for us because that would be license-violating and security-compromising.)

My CppCon talk yesterday is now on YouTube. You can read more about in my July blog post on “Metaclasses: Thoughts on generative C++” which contains links to the current paper and some examples that work so far on the live prototype compiler cppx.godbolt.org.

Thanks again to Bjarne Stroustrup for making C++ so general and powerful with just a single kind of “class” (essential for this work), to Andrew Sutton for implementing the prototype metaclasses compiler, to Matt Godbolt for hosting it on his site, to everyone on the committee and in the community on whose work this is trying to build and have provided comments and feedback, and to Bash Films and CppCon for making these videos available so quickly. As in previous years, the CppCon videos will also be available on Channel 9 as well, though that usually takes a few extra weeks to happen.

[revised 9/8 to reflect that there is no need to wait till the next WG21 meeting]

As I mentioned in my Kona (March) trip report, WG21 (the ISO C++ committee) completed work on C++17 at our March meeting. At that point it was technically finalized, and since then we have been in the final procedural endgame of formal ISO approval and publication.

Today, I’m pleased to report that the last major ballot was completed: A few hours ago, the C++17 DIS (Draft International Standard) ballot came back with 100% approval, 23 editorial comments, and no technical comments. Unanimous approval of a DIS means that we get to skip the FDIS ballot (as we hoped) and proceed directly to publication. As far as ISO is concerned, we are now done and they are just waiting for us to update the document editorially and send them the final PDF we want to be published.

So the remaining steps are:

  • The project editor (Richard Smith) and helpers will review and resolve the editorial comments, and any other pending editorial tweaks they feel like fixing (e.g., speling, formatting). This includes generating the official record of response paper summarizing what was done for each editorial DIS comment received.
  • We send the final PDF to ISO for publication, and ISO after a month or two ISO publishes it in the ISO store.

Note again that all this is just formally putting a bow on C++17. WG21’s active project now is C++20, and we already began work on that at our last meeting in Toronto, including to add a major feature (concepts!), and we’ll continue serious work on that in Albuquerque and beyond.

This is a product of many people’s labors and many often-unsung efforts. Thank you again to the hundreds of participants in the ISO C++ committee, and many interested commenters and helpers in the community, for all your work and support for C++ standardization.

As I mentioned earlier, part of my fall schedule is to give a repeat of this spring’s sold-out seminar: “High-Performance and Low-Latency C++” (October 9-11, London, UK).

I am still getting mails about whether there are alternative/additional European dates for this seminar. Unfortunately, the answer is still no, but since I’m getting inquiries about it let me repeat that part of the earlier post:

On October 9-11, I’ll be in London giving a one-time repeat of “High-Performance and Low-Latency C++” (course details page). This is the same as the public course I gave in Stockholm [in April]; because that course sold out, and I was coming to Europe again for Qt World Summit anyway, we decided to do a single repeat that same week, this time in London.

Notes: (1) Some of you have emailed me asking if there will be other dates/cities, and the answer is no, sorry, I do seminars very rarely and this is the last one I have time to do for the foreseeable future. So if you are interested then this is the one to attend. (2) Some of you have also emailed me to ask whether the seminar will be recorded, and the answer is again no, sorry, the organizers are not set up for that. However, you can find all of my past Effective Concurrency writing (on which parts of this course are based) freely available via this blog, just search for that phrase or use the category tag — there’s a book’s worth of free material written by me in individual-article form.

So, if you’re interested, I hope you’ll be able to attend this October, and I look forward to seeing many of you there.

I’ve been working on an experimental new C++ language feature tentatively called “metaclasses” that aims to make C++ programming both more powerful and simpler. You can find out about it here:

  • Current proposal paper: P0707R1. I hope the first ten pages give a readable motivation and overview. (The best two pages to start with are 9 and 10, which probably means I need to reorder the paper…)
  • Initial intro talk video: ACCU 2017 (YouTube). This is the initial public presentation three months ago. Thank you to Roger Orr, Russel Winder, Julie Archer, and the other ACCU organizers for inviting me and for holding back the video until we could have the ISO C++ summer meeting about a week ago, so it could go live along with a report (herein) on the results of this feature’s first presentation to the ISO C++ committee. And special thanks to Ina and Arvid, the two audience volunteers who graciously agreed to come on-stage to participate in a live mini UX study. There’s a lot of subtle information in their nuanced reactions to the code examples; pay special attention when their responses are different or as their responses evolve.
  • “Incomplete and experimental” prototype compiler. The Clang-based prototype by Andrew Sutton is available as an online live compiler at cppx.godbolt.org, and as source at github.com/asutton/clang. It’s incomplete but can compile a number of the examples in the paper (see the paper for example code links). Thanks to Matt Godbolt for hosting it on godbolt.org!

Please see the paper and video to answer “what are metaclasses and why should I care?” If you’re the “show me code first, English later” kind of person, try the live compiler and these quick examples: interface, base_class, value (regular type), plain_struct (these links are also in the paper).

The rest of this post aims not to duplicate any information above, but to provide some context about the broader journey, and what I and others are attempting to accomplish.

A journey: Toward more powerful and simpler C++ programming

Phase 1: By using the existing language better

About five years ago, I started working on long-term effort toward making using C++ simpler and safer.

In the first phase, a small group of us—centered on Bjarne Stroustrup, Gabriel Dos Reis, Neil MacIntosh and Andrew Pardoe—pushed to see how far we could get with “C++ as it is” plus just a few well-chosen library-only extensions, with a particular goal of improving type and memory safety. Bjarne, Neil, and I first publicly reported on this effort in the two CppCon 2015 plenary sessions “Writing Good C++14” and “Writing Good C++14… By Default.” The results of that work so far have manifested as the C++ Core Guidelines and its support library GSL that adds a limited number of library types (e.g., span, now being standardized); and I led the Lifetime design in particular (available in the Guidelines /docs folder) which Neil and I and others continue to work on formalizing with the aim of sharing a “draft” static analysis spec later this year.

One of the goals of this phase was to answer the question: “How much progress can we make toward simplifying the existing C++ language with only a few key library extensions?” The answer as I see it turned out to be: “Some solid progress, but probably not a major simplification.” And so that answer led to phase two…

Phase 2: By evolving the language

Two years ago, I started to focus specifically on exploring ways that we might evolve the C++ language itself to make C++ programming both more powerful and simpler. The only way to accomplish both of those goals at the same time is by adding abstractions that let programmers directly express their intent—to elevate comments and documentation to testable code, and elevate coding patterns and idioms into compiler-checkable declarations. The work came up with several potential candidate features where judiciously adding some power to the language could simplify code dramatically.

Of those potential candidate features, metaclasses is the first major piece I picked to propose for ISO C++. [*] We presented it for the first time at the summer ISO C++ meeting earlier this month, and it received a warm reception. There was (rare) unanimous support for pursuing this kind of capability, but also some concern about how best to expose it and specific design change feedback the committee wants us to apply to improve the proposal. [**] We’ll work to include in a revision for the November standards meeting as we start the multi-year process of vetting and refining the proposal. So this is good progress, but note that it (only) means encouragement to continue the experiment and see where it leads; it’s far too early to talk about potential ship vehicles.

So do expect change: The proposal is still evolving, and it in turn assumes and builds on the static reflection proposal (P0578 et al.) and the compile-time programming proposal (P0633), both of which are actively evolving in their own right. Incidentally, one of the contributions of Andrew Sutton’s prototype metaclasses compiler is that it is implementing those other proposals too(!), since the metaclasses feature needs them. The aim is to keep the latest compiler and the latest P0707 paper in sync with each other and with those related proposals, but there will doubtless be occasional drift in between syncs.

What’s next

I’ll talk about metaclasses more in my upcoming CppCon 2017 talk this September, and Andrew Sutton will also be giving two CppCon talks about metaclasses—one about implementing them in Clang, and one about using them for a real project.

This is just the beginning, and we’ll see whether it all pans out and leads somewhere, but I hope you enjoy this exploration and I look forward to talking with many of you about it at CppCon this September.

 

———

Notes

[*] I actually brought a smaller piece from this same work to the committee at the previous meeting, the winter meeting in Kona: P0515 (consistent comparisons), which proposes adding the three-way <=> comparison operator. P0515 is only about a minor feature, and not one of the most important things that can help improve C++, so normally I wouldn’t have picked that piece to contribute first; but the committee was already continuing to actively discuss comparisons, so I cherry-picked it from my design work and contributed it since I had the design in my pocket anyway. Happily the committee liked what they saw and both EWG and LEWG accepted it, and it is now progressing well and on track to hopefully be voted into draft C++20 in the next meeting or two. Thanks to Jens Maurer and Walter Brown for the heavy lifting of writing the core language and library standardese wording, respectively, for that P0515 proposal.

[**] The committee’s design feedback was primarily about how to wrap up the transformation code: Instead of putting it inside a new “meta” class-like abstraction, how about wrapping the same code inside a compile-time function-like abstraction that takes an input meta::type parameter and returns a generated meta::type return value? This doesn’t affect the proposal’s basic engine, just the shape of its steering wheel—for example, we could change the first line of each example metaclass definition from the class-like syntax

$class interface {
    constexpr {
        // … basically same code …
    }
};

to the decorator-function-like syntax

meta::type interface(const meta::type source) {
    // … basically same code …
};

where the latter has the advantage that it’s easy to see that we’re reading one type and generating another type. Interestingly, I think this dovetails with the mini UX study in the video where most of the difficulty the UX participants seemed to encounter was in understanding the $class syntax, not the metaclass bodies and not later using the metaclasses to author new types.

But we’ll explore this and other options and validate/invalidate it with more experiments… and feel free to express your thoughts in the comments if you like one of these styles better, or perhaps another variation.