From 0ce95077752ee04cbb06135b25bc770d33884184 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Tue, 2 Jun 2026 09:54:14 +0100 Subject: [PATCH] docs: rewrite 'Function calls requiring ()' section as proper design entry Replace the raw conversation fragment with a structured improvement entry covering the motivation (TIdentExpr.IsNoArgFuncCall ambiguity), the interaction with the Result-variable convention, migration impact, and effort estimate. --- docs/future-improvements.adoc | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/docs/future-improvements.adoc b/docs/future-improvements.adoc index 9e8cfc9..cd14dbf 100644 --- a/docs/future-improvements.adoc +++ b/docs/future-improvements.adoc @@ -23,6 +23,36 @@ prioritise them. == Language +=== Require `()` on all zero-argument function calls + +*What.* Require explicit parentheses on every function call, even those +with no arguments. A bare identifier `Foo` would unambiguously refer to +a field or variable; `Foo()` would always be a call. + +*Why it matters.* The current ambiguity between a zero-argument call and a +variable/field reference is resolved today by `TIdentExpr.IsNoArgFuncCall`, +a flag that requires lookahead in the parser and special-casing throughout +semantic analysis and ARC codegen. Eliminating the ambiguity simplifies all +three phases and aligns Blaise with modern languages (Swift, Rust, Go, +Kotlin) that require `()` on every call. + +*Interaction with the `Result` variable.* Blaise already uses the bare +function name to refer to the implicit `Result` variable inside a function +body — writing `MyFunc := 42` is equivalent to `Result := 42`. This +convention is retained: inside the body of `MyFunc`, the bare name +`MyFunc` continues to refer to `Result`, not to a recursive call. A +recursive call must use `Self.MyFunc()` (method) or `MyFunc()` (procedure/ +function), consistent with the existing house style documented in CLAUDE.md. + +*Migration impact.* Existing Blaise code that calls zero-argument functions +without parentheses — e.g. `Count`, `IsEmpty` used as expressions — would +need mechanical updating. A migration-analyser pass can detect and +auto-fix the pattern. + +*Effort.* Medium — parser change is small; the larger work is updating the +test suite, standard library, and any user code, plus landing the +migration-analyser auto-fix pass first. + === Procedural types - reference to function/procedure (anonymous methods)