From c02945e236f3b0c2e5c76f0e9a33c4365e07dc39 Mon Sep 17 00:00:00 2001 From: John Alanbrook Date: Mon, 16 Feb 2026 18:53:53 -0600 Subject: [PATCH] document functino nr args --- CLAUDE.md | 1 + docs/language.md | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/CLAUDE.md b/CLAUDE.md index 53c6de34..34e5c349 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -22,6 +22,7 @@ All code uses 2 spaces for indentation. K&R style for C and Javascript. - No classes — only objects and prototypes (`meme()`, `proto()`, `isa()`) - No `for...in`, `for...of`, spread (`...`), rest params, or default params - No named function declarations — use `var fn = function() {}` or arrow functions +- Functions have a maximum of 4 parameters — use a record for more - Variables must be declared at function body level only (not in if/while/for/blocks) - All variables must be initialized at declaration (`var x` alone is an error; use `var x = null`) - No `try`/`catch`/`throw` — use `disrupt`/`disruption` diff --git a/docs/language.md b/docs/language.md index 962450de..66755117 100644 --- a/docs/language.md +++ b/docs/language.md @@ -398,6 +398,8 @@ fn2() // 1 ### Arguments +Functions can have at most **4 parameters**. Use a record to pass more values. + Extra arguments are ignored. Missing arguments are `null`. ```javascript @@ -406,6 +408,11 @@ fn(1, 2, 3) // 3 (extra arg ignored) var fn2 = function(a, b) { return a } fn2(1) // 1 (b is null) + +// More than 4 parameters — use a record +var draw = function(shape, opts) { + // opts.x, opts.y, opts.color, ... +} ``` ### Immediately Invoked Function Expression