aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorGravatar zinc <zinc@downsta.ir> 2026-10-14 16:58:59 +0330
committerGravatar zinc <zinc@downsta.ir> 2026-10-14 16:58:59 +0330
commit77d2f8a44e2503796a7ef5c170e11811a4f7fcfd (patch)
treedf316b685295cecaf8d587ad3bf36a245839abca /docs
parentbool: normalising into a bool keeps an incompatible source type, so the retur... (diff)
prototypes: parameters may be unnamed, int f(int, int*); (appendix b.2.13)
Diffstat (limited to 'docs')
-rw-r--r--docs/SPEC.md4
1 files changed, 2 insertions, 2 deletions
diff --git a/docs/SPEC.md b/docs/SPEC.md
index 30d547d..128f961 100644
--- a/docs/SPEC.md
+++ b/docs/SPEC.md
@@ -683,7 +683,7 @@ node*.u make() { ... } // owned result (.u)
fn f(a, b) { ... } // untyped; types are inferred
fn f(int a, b) { ... } // parameters may mix
T first<T>(T* p) { ... } // generic
-int proto(int n); // prototype (parameter names are required)
+int proto(int n); // prototype (int proto(int); also works: a prototype's parameter names are optional)
```
a bare `name(params) { ... }` with no `fn` and no type is not a function declaration (error: expected a declaration).
@@ -1116,7 +1116,7 @@ each item gives a minimal program, the expected behavior (per this spec) and the
10. a syntax error hides errors in the statements skipped by recovery: `int a = ; int b = 3 +;` reports only the first error (8.2). by design, but easy to miss.
11. fixed (1.2.2): an unterminated `/* ...` comment was accepted silently; it is error: unterminated comment. (an unterminated string literal is still only reported as a later syntax error.)
12. settled (3.2.3): `x as int * y` parses `int*` as the type. this is the rule (the type is read greedily, as zc0 does too), so the program is a syntax error.
-13. prototypes need parameter names: `int f(int);` => `expected a name, found ')'`.
+13. fixed (5.2.1): a prototype's parameters may be unnamed (`int f(int, int*);`). a lone type name counts as a type only in a prototype; with a body it is still the parameter's name, and an unnamed typed parameter there is `a parameter needs a name`.
14. `len(s)` on a `char*` returns word 0 of the string when `typecheck` is off.
15. duplicate `case` labels are not diagnosed (4.7.2).
16. a local `const` cannot be used in a constant expression (b.1.7).