Skip to content

Instantly share code, notes, and snippets.

View michelf's full-sized avatar

Michel Fortin michelf

View GitHub Profile
@michelf
michelf / Interlocking.md
Last active December 10, 2020 14:12
Interlocking in A Hierarchy of Actors

A Hierarchy of Actors

This is an attempt to define an Actor system where some actors can make synchronous calls to others. It tries to keep blocking on the margins — where it is more tolerable — and to not allow anything that could cause deadlocks.

There are two basic rules to add to the current actor pitch:

  • Actors can have a parent actor chosen when initializing the actor.
  • A child actor can call synchronously methods of its parent actor.

A typical application could look like this. The Main thread actor has child task actors, which can have subtasks:

/// An type with a default form.
protocol DefaultFormRepresentable {
static var defaultForm: Self { get }
var isDefaultForm: Bool { get }
}
// MARK: Generic conformance based on other protocols
// generic implementation for array-style collections

Concurrent

Introduction

This proposal introduces the concept of concurrent functions to Swift. A concurrent function is guarantied to be thread-safe by protecting access to shared mutable states.

Pure for guarantied value semantics

Introduction

This proposal introduces the concept of pure functions to Swift. A pure function is guarantied to allow only value semantics, even when dealing with classes.

@michelf
michelf / Really Simple Submodules.md
Created March 5, 2017 21:05
Draft proposal for submodules in Swift.

Really Simple Submodules

Motivation

The goal of this proposal is to provide lightweight intra-module boundaries so you can avoid exposing every internal declaration within a big module to all other files in the module.

Not a goal: addressing the file-level access fileprivate/private or scoped/protected debates. This is left to other proposals.