Concept Maps using C++23 Library Tech

Abstract

C++0x Concepts had a feature Concept Maps that allowed a set of functions, types, and template definitions to be associated with a concept and the map to be specialized for types that meet the concept.

This allowed open extension of a concept.

Read more…

Slides from C++Now 2023 Async Control Flow

Using Sender/Receiver for Async Control Flow

Steve Downey

These are the slides, slightly rerendered, from my presentation at C++Now 2023.

Abstract

How can P2300 Senders be composed using sender adapters and sender factories to provide arbitrary program control flow?

  • How do I use these things?
  • Where can I steal from?

Read more…

Some Informal Remarks Towards a New Theory of Trait Customization

A Possible Technique

constexpr bool g(int lhs, int rhs) {
    auto& op = partial_eq<int>;
    return op.ne(lhs, rhs);
}
Compiler Explorer with Supporting Code A trait is defined as a template variable that implements the required operations. Implementation of those operations is possible via a variety of techniques, but existence is concept checkable. It might prove useful to explicitly opt in to a sufficiently generic trait. The technique satisfies the openness requirement, that the trait can be created independently of the type that models the trait. There can still only be one definition, but this enables opting std:: types into new traits, for example. It also doesn't universally grab an operation name. The trait variable is namespaceable. Syntax isn't really awesome, but not utterly unworkable.

Read more…

A local CMake workflow with Docker

l#+BLOG: sdowney

An outline of a template that provides an automated workflow driving a CMake project in a docker container.

This post must be read in concert with https://github.com/steve-downey/scratch of which it is part.

Routine process should be automated

Building a project that uses cmake runs through a predictable lifecycle that you should be able to pick up where you left off without remembering, and for which you should be able to state your goal, not the step you are on. make is designed for this, and can drive the processs.

Read more…

std::execution, Sender/Receiver, and the Continuation Monad

Some thoughts on the std::execution proposal and my understanding of the underlying theory.

What's proposed

From the paper's Introduction

This paper proposes a self-contained design for a Standard C++ framework for managing asynchronous execution on generic execution contexts. It is based on the ideas in [P0443R14] and its companion papers.

Which doesn't tell you much.

It proposes a framework where the principle abstractions are Senders, Receivers, and Schedulers.

Sender
A composable unit of work.
Receiver
Delimits work, handling completion, exceptions, or cancellation.
Schedulers
Arranges for the context work is done in.

Read more…

Standard Vocabulary for Algorithms

This is feedback after considering A Plan for C++23 Ranges Disclosure: I voted in favor of this. It does not suggest work on views::maybe [P1255R6]​. I'm fine with that priority.

Vocabulary is not just Types between Components

There's broad agreement that 'vocabulary types' belong in the standard. Domain independent types that can be used between otherwise uncoupled facilities. They each depend on facilities provided by Standard C++ and can thus be developed independently. Each component can rely on the API of a core vocabulary type not changing. This allows facilities to communicate effectively. A component can have std::string or std::vector<int> in its interface with little concern. The STL parts of the standard library have always relied on concepts for constraining template parameters implicitly, requiring an Iterator of particular category in places, or specializing algorithms based on such. Composition of container types has also been natural. No one is confused by a std::unordered_map<std::string, std::vector<my::person>>.

Read more…

Blog Infrastructure Work

What feels like actual productive work, but is only work adjacent? Fixing up the blog.

I managed to gradually destroy the whole thing after a decade or more of platform migrations and upgrades. This is a new and from (mostly) scratch install, into which I've imported the contents of the old one. Good backups and some hints from the excellent staff at panix.com got me back in shape. I hope.

Read more…

Value Oriented Programming: A Manifesto

Object Oriented Programming

The primitive entities are objects which have certain properties
  • Objects have Identity
  • Objects have State
  • Objects have Behavior

Values are not Objects

The primitive entities are values which have none of the properties of Objects
  • Values have no identity
  • Values have no State
  • Values have no Behavior

A positive definition of VOP

  • Values are Equivalent
  • Values are Immutable
  • Values are Side-effect Free

Read more…