5 Syntax Proposals
Nathan McCarty edited this page 2025-09-02 07:38:23 +00:00

Gos and No-Gos

Gos

  • Expression based
  • Unified type and term language, a type signature is any expression that returns a Type This probably means we have to the general style of X : a -> b type definitions
  • Partial application friendly syntax Even though this language is going to be more systems oriented, it's still going to have functional semantics. Like most other functional programming languages, whitespace should act like the function application operator.

NoGos

  • Indentation Sensitivity To play this one safe for now, I'm just going to require all logical-lines to be semi-colon terminated. We'll likely want to look into ways to reduce the semi-colonitis later

Function Definitions

Pattern matching definition:

def add_to_end(arg1: List t -> arg2: t -> List t) matching arg1, arg2 {
  [], y => [y];
  x :: xs, y => x :: add_to_end xs;
}

matching should also be usable outside a def to declare a pattern-matching anonymous function

Single body definition:

def add_nats(arg1: Nat -> arg2: Nat -> Nat) taking arg1, arg2 => 
  arg1 + arg2;

taking should behave entirely as shorthand for a matching function with only one block, and work everywhere a matching would work

main :: IO ()
main = undefined