Skip to content

Instantly share code, notes, and snippets.

       /────────────────────── 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.

Nil struct

Introduction

Change nil literal type from () to Nil.

Simplifying guard case/if case syntax

  • Proposal: TBD
  • Author: Erica Sadun
  • Status: TBD
  • Review manager: TBD

Introduction

This proposal re-architects guard case and if case grammar for unwrapping complex enumerations. It drops the case keyword from if and guard, replaces = with ~=, and introduces the := operator that combines declaration with assignment.

Feature name

Introduction

Bitwise and arithmetic operators are very different, and their precedence relationship is not obvious.

// Feature 1: @mixin extension
struct Pizza {
var containsCheese: Bool
init(cheese: Bool) { ... }
func prepare() { print(self) }
}
struct Margherita {
var pizza: Pizza
init() { pizza = Pizza(cheese: true) }
@Anton3
Anton3 / typed-throws.md
Last active February 18, 2017 13:21
Draft of "Typed throws" proposal

Allow Type Annotation on Throws

Introduction

Typed throws annotation specifies that a function can only throw errors of a certain type:

@Anton3
Anton3 / after_inlining.cpp
Created July 25, 2019 19:31
Inlining coroutines
task<void> foo() {
co_return uninlineable_mess();
}
package name.anton3.vkapi.generator.json
import com.fasterxml.jackson.annotation.JsonUnwrapped
import com.fasterxml.jackson.core.JsonParser
import com.fasterxml.jackson.databind.*
import com.fasterxml.jackson.databind.deser.ContextualDeserializer
import com.fasterxml.jackson.databind.deser.ResolvableDeserializer
import com.fasterxml.jackson.databind.deser.std.StdDeserializer
import com.fasterxml.jackson.databind.node.ObjectNode
import com.fasterxml.jackson.databind.node.TreeTraversingParser

Alias expressions

Summary

Alias expressions allow setting up a constructed object before returning it from a function or passing it as a function argument, while incurring no copies or moves.

Motivation

Sometimes we want to create an object, set it up and return it.