Skip to content

Commit

Permalink
Document single-arg lambda design in ADR
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-healy committed Sep 26, 2023
1 parent 5e475a5 commit 443dd6f
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions adrs/003_single_arg_lambdas_in_ast.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# ADR-003: Use single-argument lambdas in the AST

**Date**: 26/09/2023
**Status**: Current

## Decision

Always treat lambdas/functions in the abstract syntax tree as if they only take
a single argument.

## Context

While spiking an implementation of a bidirectional typechecking algorithm, it
became clear that having lambdas with multiple arguments represented in the AST
was making things unnecessarily complicated, by requiring the type checking and
inference functions to take multiple "steps" at once.


## Tradeoffs

Since we can easily build single argument lambdas from the current surface
syntax, and since it's relatively trivial to walk the AST to "gather up" nested
lambdas into a single multi-arg closure in the bytecode, there's no real
tradeoff here. It simplifies the AST at no major cost.

0 comments on commit 443dd6f

Please sign in to comment.