aboutsummaryrefslogtreecommitdiff
path: root/doc/language/keyword/cpsc-keyword-overload.7.md
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-30 14:33:33 +0000
committer_ov4 <ov4@ov4.org>2026-10-30 14:33:33 +0000
commit9b2d82dadbb465de71985a8db3aa8df454579b72 (patch)
tree686703c7f74565baad63f368b90124f8577c4616 /doc/language/keyword/cpsc-keyword-overload.7.md
parent0cf54b4f77ccf8376341950b02ceb7c1d1268ed7 (diff)
docs(types): explain implicit constructors and raw text literalsHEADmain
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'doc/language/keyword/cpsc-keyword-overload.7.md')
-rw-r--r--doc/language/keyword/cpsc-keyword-overload.7.md6
1 files changed, 3 insertions, 3 deletions
diff --git a/doc/language/keyword/cpsc-keyword-overload.7.md b/doc/language/keyword/cpsc-keyword-overload.7.md
index 1f7a0a4..bfd4ece 100644
--- a/doc/language/keyword/cpsc-keyword-overload.7.md
+++ b/doc/language/keyword/cpsc-keyword-overload.7.md
@@ -22,11 +22,11 @@ ENDCLASS
# DESCRIPTION
-OVERLOAD is a compiler extension, absent from the CIE guide. Put it immediately before FUNCTION or PROCEDURE, after PUBLIC or PRIVATE when an access keyword is present. OVERLOAD is reserved. Every definition sharing a case-insensitive name must specify OVERLOAD. Global functions, procedures, class methods and NEW constructors support it; MAIN and built-in functions do not.
+OVERLOAD is a compiler extension, absent from the CIE guide. Put it before FUNCTION or PROCEDURE, after PUBLIC or PRIVATE when an access keyword is present. An implicit constructor places IMPLICIT between OVERLOAD and PROCEDURE. OVERLOAD is reserved. Every definition sharing a case-insensitive name must specify OVERLOAD. Global functions, procedures, class methods and NEW constructors support it; MAIN and built-in functions do not.
Signatures differ by parameter count, parameter types, array rank, or return type. BYREF versus BYVAL and declared array bounds do not distinguish signatures. A PROCEDURE counts as returning VOID, so it can coexist with a FUNCTION having the same parameter list; a call that cannot determine a result type is then ambiguous unless the function specifies a DEFAULT return. Nominal user types remain distinct; equivalent native C type aliases identify the same type.
-Calls require an exact match to the arguments' static types. No implicit conversion is used to select an overload, even when only one OVERLOAD definition exists. Array arguments must be whole array variables with matching element types and rank. After selection, ordinary parameter-mode, array-bound and access checks apply. Functions without OVERLOAD retain their ordinary argument conversions and their implicit result conversions.
+Calls prefer exact static parameter types. If no exact candidate matches, BYVAL parameters may use a single IMPLICIT constructor or the existing CHAR/STRING bridge. Competing converted candidates are ambiguous; numeric widening does not select an overload. See [cpsc-keyword-implicit(7)](cpsc-keyword-implicit.7.md). Array arguments must be whole array variables with matching element types and rank. After selection, ordinary parameter-mode, array-bound and access checks apply. Functions without OVERLOAD retain their ordinary argument conversions and their implicit result conversions.
When the context requires a known result type, the selected overload must return exactly that type. This applies to assignment targets, BYVAL arguments, RETURN values, conditions, FOR bounds, subscripts and CASE comparisons. If the arguments match but no overload returns the required type, the error is `No matching overload for Name(T1, T2) returning T`. A cast `(T) expr` is weaker: it first prefers an overload returning T, then uses ordinary parameter selection and converts the result to T.
@@ -36,7 +36,7 @@ Overloads may be defined in separate input files. A caller sees only its own and
Methods use the same rules, including result-type selection; fields and methods cannot share a name. Constructor calls select NEW by their explicit arguments. DECLARE without arguments, class-valued fields and array elements select a parameterless NEW; if NEW exists but has no matching parameterless overload, compilation fails. PRIVATE checks apply to the selected method or constructor.
-Operator definitions use OVERLOAD FUNCTION OPERATOR followed by the operator symbol or keyword. They support global and member forms with exact operand types; see [cpsc-keyword-operator(7)](cpsc-keyword-operator.7.md).
+Operator definitions use OVERLOAD FUNCTION OPERATOR followed by the operator symbol or keyword. They support global and member forms with exact types preferred over implicit construction; see [cpsc-keyword-operator(7)](cpsc-keyword-operator.7.md).
# EXAMPLE