Skip to content

An menu/quick reference for Programming Language concepts

License

Notifications You must be signed in to change notification settings

glyh/awesome-pl-concepts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

| 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

List of features

Actor Model

Active Pattern

Algebraic Data Type

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

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

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

Generalized Algebraic Data Type

Generalized Update Syntax

  • 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

Nil Fallthrough

Object Capabilities

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

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

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

View Pattern

About

An menu/quick reference for Programming Language concepts

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published