awesome-pl-concepts icon indicating copy to clipboard operation
awesome-pl-concepts copied to clipboard

An menu/quick reference for Programming Language concepts

| Rationale | Convention | Contributing | TODO |

Note: some features doesn't have a name, I have to coin it out. That said, please make a PR if you find better term for them.

By topic

  • Caching: Caching with Reactive Invalidation

  • Calculus: Dot Calculus, Lambda Calculus, Symmetric Interaction Calculus, Term Rewriting, Turing Machine

  • Code Generation: Hygienic Macro, Lisp Macro, Reader Macro

  • Dependency: Fragment Based Code Distribution

  • Design Pattern: Async/await, Continuation Passing, Message Passing, Trait

  • Pattern Matching: Active Pattern, Pattern matching, View Pattern

  • Evaluation: Compile-time Code Evaluation, Lazy Evaluation

  • First Class: First Class Date, First Class Module, First Class Regex, First Class Type

  • Memory Management: Garbage Collection, Ownership, Reference Counting, Memory Safety

  • Mutitasking: Async/await, Coroutine, Green Thread, Symmetric Interaction Calculus, Free Parallelism

  • Paradigm: Functional Programming, Logic Programming

  • Polymorphism: Row Polymorphism

  • Property: Referential Transparency

  • Subsystem: Datalog, Module

  • Syntax Sugar: Automatic Broadcast Implementation, Chained Try, For Comprehension, Generalized Update Syntax, Universal Function Call Syntax

  • Type: Algebraic Data Type, Capability Safety, Class Invariant, Dependent Type, Effect System, Generalized Algebraic Data Type, Gradual Typing, Linear Type, Nil Fallthrough, Reference Capabilities

List of features

Actor Model

Active Pattern

Algebraic Data Type

Async/await

Automatic Broadcast Implementation

Caching with Reactive Invalidation

Capability Safety

  • Description: A property that functions cannot access data besides that reachable via their closure, their inputs, and global constants. Generally implied by referential transparency, and incompatible with mutable global variables.
  • Implementations: Pony, Monte, Wyvern

Chained Try

  • Description: A generalization of optional chaining in JavaScript. A language construct that accepts a series of blocks where each block will be executed only if the previous blocks yield an error.
  • Example Usage:
try {
    assert user_exists(name)
    current_user = get_user(name)
    assert user_not_banned(current_user)
    do_lots_of_stuff_with(current_user)
} {
    deny_login_of_user(name)
}

// Replacing if-and-bind, like Python's walrus operator:
try {
    match = regex.search("\d+(\d)", text)
    assert match
    process_numbers(match[0])
} {
    match = regex.search("\w+(\d)", text)
    assert match
    process_letters(match[0])
} {
    print("No match.")
}

// Replacing complicated conditions that would otherwise be in a single line.
try {
    assert user.age > 18 and user.has_feature_enabled
    assert user.has_billing_account and user.get_credits() > 0
    assert user.get_last_payment().age_in_days < 90
    process_as_premium_user()
} {
    process_as_normal_user()
}

// Replacing nested catch blocks:
try {
    response = fetch_from_network(resource_id)
    assert response.network_success
    value = response.value
} {
    assert resource_id in offline_cache
    value = offline_cache[resource_id]
} {
    print("Failed to get resource. Use manual value?")
    response = user_input("Resource override: ")
    assert not response.cancelled
    value = response.value
} {
    raise Error('Network not available and ID {resource_id} not in offline cache.')
}
print(value)


Class Invariant

Compile-time Code Evaluation

Continuation Passing

  • Description: a pattern in which the state of an executing program may be captured and passing around, resume on demand.
  • Implementation: Scheme continuation

Coroutine

Datalog

Dependent Type

Dot Calculus

Effect System

First Class Date

First Class Module

First Class Regex

First Class Type

Fragment-based Code Distribution

Free Parallelism

  • Description: Parallelism is imposed implicitly by the langauge runtime.
  • Implementation: Futhark, HVM

For Comprehension

Formal Methods

  • Description: A series of techiques that helps proving the behavior of the program
  • Implementation: Coq proof assitant

Functional Programming

Garbage Collection

Generalized Algebraic Data Type

Generalized Update Syntax

Gradual Typing

Green Thread

  • Description: An abstraction that allow easily writing preemptive concurrent code, without actually using OS thread
  • Implementation: Java green thread

Hygienic Macro

Lambda Calculus

  • Implementation: pLam

Lazy Evaluation

Linear Type

Lisp Macro

Logic Programming

Memory Safety

Module

Message Passing

Nil Fallthrough

Object Capabilities

  • Description: See Capability safety

Ownership

  • Description: A system that helps compiler decide when to free heap-allocated memory statically by annotating the ownership of heap allocated variables to entities in the program.
  • Implementation: Rust ownership

Pattern matching

Reader Macro

  • Description: Macro system that gets called by the reader, before AST is formed.
  • Implementation: Common Lisp, Elixir Sigils (this is a weaker alternative to reader macro) )

Reference Capabilities

  • Description: A type system feature in which each reference carries a modifier to the capabilites, which can describe whether reading or writing is allowed, and whether these features are isolated to this reference.
  • Impelementation: Pony

Reference Counting

Referential Transparency

  • Description: A property for a function where: 1. returns the same for identical arguments; 2. has no other side effects.

Row Polymorphism

Symmetric Interaction Calculus

Term Rewriting

Trait

  • Description: An interface that allows writing type safe code on different types.
  • Implementation: Haskell typeclass, Rust trait

Turing Machine

Universal Function Call Syntax

View Pattern