Skip to content

Instantly share code, notes, and snippets.

func f() throws Error1 { return 42 }
func g(meaning: Int) throws Error2 { print(meaning) }
func test() {
do {
try g(try f())
} catch let err1 as Error1 {
print("Error1")
} catch let err2 as Error2 {
print("Error2")

Suggestion for behaviours proposal

Basic syntax

public behaviour lazy<Value>: Value {
  private var storage: Value?

  // Only `init()` allowed for now
 init() {

function-type( function-type-parametersopt ) throws-annotationopt -> type

function-type-parametersfunction-type-parameter , function-type-parameters

function-type-parametersfunction-type-parameter ...opt

function-type-parameterattributesopt inoutopt type

throws-annotationthrows | rethrows

Refactor metatypes

Introduction

  • Rename metatypes T.Type to Metatype

Refactor Metatypes, repurpose T.self and Mirror

Introduction

This proposal want to revise metatypes T.Type, repurpose public T.self notation to return a new Type type instance rather than a metatype, merge SE-0101 into Type, rename the global function from SE-0096 to match the changes of this proposal and finally rename current Mirror type to introduce a new (lazy) Mirror type.

       /────────────────────── Domain 1
      /
     /                       /───────────── Domain 2
    /                       /
─────────────────────────────────────────────────────── Core operators
             \
              \──────────────────────────── Domain 3
               \
 \──────────────── Domain 4

Refine if case syntax

Introduction

Change syntax of pattern-matching versions of if and guard.