Skip to content

Instantly share code, notes, and snippets.

@kirkshoop
kirkshoop / comparison.md
Last active May 19, 2024 17:19
ABI feature comparison
feature description
link-time
replaceable
Allows the std library to know at link-time which services to construct.
Allows specified construction order of services by the std library.
When the order is specified, this enables deterministic reasoning about dependencies for users and replacement implementations.
Prevents any need to address the complexities of runtime replacement in the specification or in the implementation (eg. when to construct, when to destruct, how many replacements allowed, when are replacements allowed, what happens when an invalid replacement is attempted, etc..).
cannonical
across all stdlib
implementations
libraries like TBB and Qt implement a replacement once and that works with all std libraries.
user provided
storage
minimize allocations by allowing a user to supply storage for an operation
user provided allocator Allows the user to determine how operations allocate additional storage
asynchronous
@kirkshoop
kirkshoop / contexts.wit
Last active June 4, 2024 13:32
WasmComponent - System Context
package wasi:contexts@0.1.0;
/// WASI Context is an execution context intended to allow users to
/// schedule async functions onto a context provided by the system.
///
/// It is intended to be portable across platforms
/// It is intended to support zero-allocation scheduling
/// It is intended to abstract users from threads and locks
///
interface context {
use wasi:schedulers@0.1.0.{scheduler};
@kirkshoop
kirkshoop / DesignNotes.md
Last active June 4, 2024 13:10
C++ ABI with versioning and backwards compatibility

ABI Design Notes

Author: Kirk Shoop

feature description
link-time
replaceable
Allows the std library to know at link-time which services to construct.
Allows specified construction order of services by the std library.
Prevents any need to address the complexities of runtime replacement in the specification or in the implementation (eg. when to construct, when to destruct, how many replacements allowed, etc..)
cannonical
across all stdlib
implementations
libraries like TBB and Qt implement a replacement once and that works with all std libraries.
user providedstorage minimize allocations by allowing a user to supply storage for an operation
@kirkshoop
kirkshoop / hello_world-6a4408.cpp
Last active March 18, 2022 01:50
appleclang_13_1_ICE
This file has been truncated, but you can view the full file.
# 1 "<built-in>"
# 1 "/Users/kirk/source/wg21_p2300_std_execution/examples/hello_world.cpp"
/*
* Copyright (c) NVIDIA
*
* Licensed under the Apache License Version 2.0 with LLVM Exceptions
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* https://llvm.org/LICENSE.txt
@kirkshoop
kirkshoop / timer_context.cpp
Last active January 16, 2022 20:45
timer_context
/*
* Copyright 2019-present Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@kirkshoop
kirkshoop / interrupt_context.cpp
Last active January 16, 2022 04:00
interrupt_context
/*
* Copyright 2019-present Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@kirkshoop
kirkshoop / bulkandmain.cpp
Last active December 9, 2021 00:33
bulkandmain.cpp
struct prefix_scheduler_fn {
template<typename Predecessor>
struct _sender : ex::sender_base {
Predecessor p_;
template <std::execution::receiver_of R>
friend auto tag_invoke(ex::connect_t, _sender, R&& rec){
auto prefix = p_ |
ex::let_value(
[sched = ex::get_scheduler(rec)](auto&&... vn){
@kirkshoop
kirkshoop / async_scope.hpp
Created December 3, 2021 21:14
async_scope proposal
// async_scope has a single concern - it provides a scope in which senders
// can be spawned without waiting for each sender to complete.
// async_scope is intended to compose inside of non-blocking operations
// (none of it's methods are allowed to block).
//
// Requirements:
//
// - async_scope must be empty when the destructor runs.
// - senders passed to spawn must not require any CPOs on the receiver
// connected to them.
@kirkshoop
kirkshoop / sudoku.cpp
Last active August 20, 2021 22:18
sudoku
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@kirkshoop
kirkshoop / spec.json
Created January 29, 2021 20:45
distribution of executive orders across days of the year
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data": { "url": "https://www.federalregister.gov/api/v1/documents.json?conditions%5Bcorrection%5D=0&conditions%5Bpresidential_document_type%5D=executive_order&conditions%5Btype%5D%5B%5D=PRESDOCU&fields%5B%5D=citation&fields%5B%5D=document_number&fields%5B%5D=president&fields%5B%5D=type&fields%5B%5D=subtype&fields%5B%5D=publication_date&fields%5B%5D=signing_date&fields%5B%5D=title&fields%5B%5D=effective_on&fields%5B%5D=executive_order_number&per_page=1200", "format": { "type": "json", "property": "results"}},
"transform": [
{ "filter": "year(datum.publication_date) > 1996"},
{
"joinaggregate": [{
"op": "min",
"field": "publication_date",
"as": "firstYear"