-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Document single-arg lambda design in ADR
- Loading branch information
1 parent
5e475a5
commit 443dd6f
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |