Uniform function call syntax
Uniform function call syntax (UFCS) or uniform call syntax (UCS) is a programming language feature in D, Nim, Koka, Effekt, , Lean , and other programming languages, that allows any function to be called using the syntax for method calls (as in object-oriented programming), by using the receiver as the first parameter and the given arguments as the remaining parameters. The same technique is used in the AviSynth scripting language under the name "OOP notation". UFCS is particularly useful when function calls are chained (behaving similar to pipes, or the various dedicated operators available in functional languages for passing values through a series of expressions). It allows free functions to fill a role similar to extension methods in some other languages. Another benefit of the syntax is related to completion systems in IDEs, which use type information to show a list of available functions, dependent on the context. When the programmer starts with an argument, the set of potentially applicable functions is greatly narrowed down, aiding discoverability.
Uniform function call syntax (UFCS) or uniform call syntax (UCS) is a programming language feature in D, Nim, Koka, Effekt, , Lean , and other programming languages, that allows any function to be called using the syntax for method calls (as in object-oriented programming), by using the receiver as the first parameter and the given arguments as the remaining parameters. The same technique is used in the AviSynth scripting language under the name "OOP notation". UFCS is particularly useful when function calls are chained (behaving similar to pipes, or the various dedicated operators available in functional languages for passing values through a series of expressions). It allows free functions to fill a role similar to extension methods in some other languages. Another benefit of the syntax is related to completion systems in IDEs, which use type information to show a list of available functions, dependent on the context. When the programmer starts with an argument, the set of potentially applicable functions is greatly narrowed down, aiding discoverability. int first(int[] arr) { return arr[0]; } int[] addone(int[] arr) { int[] result; foreach (value; arr) { result ~= value + 1; } return result; } void main() { auto a = [0, 1, 2, 3]; // all the following are correct and equivalent int b = first(a); int c = a.first(); // chaining int[] e = a.addone().addone(); } type Vector = tuple[x, y: int] proc add(a, b: Vector): Vector = (a.x + b.x, a.y + b.y) let v1 = (x: -1, y: 4) v2 = (x: 5, y: -2) # all the following are correct v3 = add(v1, v2) v4 = v1.add(v2) v5 = v1.add(v2).add(v4) Until 2018, it was common to use this term when actually referring to qualified/explicit path syntax and most commonly the fully qualified path syntax: because it is possible to have several traits defining the same method implemented on the same struct, a mechanism is needed to disambiguate which trait should be used. Member functions can also be used as free functions through a qualified (namespaced) path. The term UFCS is incorrect for these uses, as it allows using methods as (namespaced) free functions, but not using free functions as methods.
References
- UFCS proposal · retrieved 2026-11-19 · rev 1356535537
Cite this reference
MLA "UFCS proposal." "UFCS proposal" (PDF). 2026-11-19. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4174.pdf. Accessed 25 November 2026.
Chicago "UFCS proposal." "UFCS proposal" (PDF). 2026-11-19. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4174.pdf.
APA "UFCS proposal" (PDF). (2026). UFCS proposal. Retrieved November 25, 2026, from http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4174.pdf
- Using IntelliSense · retrieved 2026-11-19 · rev 1356535537
Cite this reference
MLA "Using IntelliSense." 2026-11-19. https://msdn.microsoft.com/en-us/library/hcw1s69b.aspx. Accessed 25 November 2026.
Chicago "Using IntelliSense." 2026-11-19. https://msdn.microsoft.com/en-us/library/hcw1s69b.aspx.
APA encyclopegia.org. (2026). Using IntelliSense. Retrieved November 25, 2026, from https://msdn.microsoft.com/en-us/library/hcw1s69b.aspx
- How Non-Member Functions Improve Encapsulation · retrieved 2026-11-19 · rev 1356535537
Cite this reference
MLA "How Non-Member Functions Improve Encapsulation." 2026-11-19. https://www.drdobbs.com/cpp/how-non-member-functions-improve-encapsu/184401197. Accessed 25 November 2026.
Chicago "How Non-Member Functions Improve Encapsulation." 2026-11-19. https://www.drdobbs.com/cpp/how-non-member-functions-improve-encapsu/184401197.
APA encyclopegia.org. (2026). How Non-Member Functions Improve Encapsulation. Retrieved November 25, 2026, from https://www.drdobbs.com/cpp/how-non-member-functions-improve-encapsu/184401197
- Unified function call syntax (UFCS) · retrieved 2026-11-19 · rev 1356535537
Cite this reference
MLA "Unified function call syntax (UFCS)." Sutter, Herb (13 October 2023). 2026-11-19. https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p3021r0.pdf. Accessed 25 November 2026.
Chicago "Unified function call syntax (UFCS)." Sutter, Herb (13 October 2023). 2026-11-19. https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p3021r0.pdf.
APA Sutter, Herb (13 October 2023). (2026). Unified function call syntax (UFCS). Retrieved November 25, 2026, from https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p3021r0.pdf
- Rename UFCS to accurately reflect its functionality. · Issue #1140 · rust-lang/rfcs · retrieved 2024-05-18 · rev 1356535537
Cite this reference
MLA "Rename UFCS to accurately reflect its functionality. · Issue #1140 · rust-lang/rfcs." "Rename UFCS to accurately reflect its functionality. 2024-05-18. https://github.com/rust-lang/rfcs/issues/1140. Accessed 25 November 2026.
Chicago "Rename UFCS to accurately reflect its functionality. · Issue #1140 · rust-lang/rfcs." "Rename UFCS to accurately reflect its functionality. 2024-05-18. https://github.com/rust-lang/rfcs/issues/1140.
APA "Rename UFCS to accurately reflect its functionality. (2024). Rename UFCS to accurately reflect its functionality. · Issue #1140 · rust-lang/rfcs. Retrieved November 25, 2026, from https://github.com/rust-lang/rfcs/issues/1140
- Nim by Example - Procs · retrieved 2024-05-18 · rev 1356535537
Cite this reference
MLA "Nim by Example - Procs." 2024-05-18. https://nim-by-example.github.io/procs/. Accessed 25 November 2026.
Chicago "Nim by Example - Procs." 2024-05-18. https://nim-by-example.github.io/procs/.
APA encyclopegia.org. (2024). Nim by Example - Procs. Retrieved November 25, 2026, from https://nim-by-example.github.io/procs/
- The Koka Programming Language · retrieved 2024-05-18 · rev 1356535537
Cite this reference
MLA "The Koka Programming Language." 2024-05-18. https://koka-lang.github.io/koka/doc/book.html. Accessed 25 November 2026.
Chicago "The Koka Programming Language." 2024-05-18. https://koka-lang.github.io/koka/doc/book.html.
APA encyclopegia.org. (2024). The Koka Programming Language. Retrieved November 25, 2026, from https://koka-lang.github.io/koka/doc/book.html
- Functions · retrieved 2025-04-08 · rev 1356535537
Cite this reference
MLA "Functions." 2025-04-08. https://effekt-lang.org/tour/functions. Accessed 25 November 2026.
Chicago "Functions." 2025-04-08. https://effekt-lang.org/tour/functions.
APA encyclopegia.org. (2025). Functions. Retrieved November 25, 2026, from https://effekt-lang.org/tour/functions
- Structures · retrieved 2025-12-08 · rev 1356535537
Cite this reference
MLA "Structures." 2025-12-08. https://lean-lang.org/functional_programming_in_lean/Getting-to-Know-Lean/Structures/#behind-the-scenes. Accessed 25 November 2026.
Chicago "Structures." 2025-12-08. https://lean-lang.org/functional_programming_in_lean/Getting-to-Know-Lean/Structures/#behind-the-scenes.
APA encyclopegia.org. (2025). Structures. Retrieved November 25, 2026, from https://lean-lang.org/functional_programming_in_lean/Getting-to-Know-Lean/Structures/#behind-the-scenes
- Functions · retrieved 2026-11-19 · rev 1356535537
Cite this reference
MLA "Functions." 2026-11-19. http://dlang.org/function.html#pseudo-member. Accessed 25 November 2026.
Chicago "Functions." 2026-11-19. http://dlang.org/function.html#pseudo-member.
APA encyclopegia.org. (2026). Functions. Retrieved November 25, 2026, from http://dlang.org/function.html#pseudo-member
- Operators · retrieved 2026-11-19 · rev 1356535537
Cite this reference
MLA "Operators." 2026-11-19. http://avisynth.nl/index.php/Operators#Operator_Precedence. Accessed 25 November 2026.
Chicago "Operators." 2026-11-19. http://avisynth.nl/index.php/Operators#Operator_Precedence.
APA encyclopegia.org. (2026). Operators. Retrieved November 25, 2026, from http://avisynth.nl/index.php/Operators#Operator_Precedence
- N1585: Uniform Calling Syntax (Re-opening public interfaces) · retrieved 2026-11-19 · rev 1356535537
Cite this reference
MLA "N1585: Uniform Calling Syntax (Re-opening public interfaces)." Francis Glassborow (2 May 2004). 2026-11-19. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1585.pdf. Accessed 25 November 2026.
Chicago "N1585: Uniform Calling Syntax (Re-opening public interfaces)." Francis Glassborow (2 May 2004). 2026-11-19. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1585.pdf.
APA Francis Glassborow (2 May 2004). (2026). N1585: Uniform Calling Syntax (Re-opening public interfaces). Retrieved November 25, 2026, from http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1585.pdf
- Universal Function Call Syntax (UFCS) · retrieved 2026-11-19 · rev 1356535537
Cite this reference
MLA "Universal Function Call Syntax (UFCS)." a b "Universal Function Call Syntax (UFCS)". 2026-11-19. http://ddili.org/ders/d.en/ufcs.html. Accessed 25 November 2026.
Chicago "Universal Function Call Syntax (UFCS)." a b "Universal Function Call Syntax (UFCS)". 2026-11-19. http://ddili.org/ders/d.en/ufcs.html.
APA a b "Universal Function Call Syntax (UFCS)". (2026). Universal Function Call Syntax (UFCS). Retrieved November 25, 2026, from http://ddili.org/ders/d.en/ufcs.html
- Unified Call Syntax · retrieved 2026-11-19 · rev 1356535537
Cite this reference
MLA "Unified Call Syntax." a b "Unified Call Syntax" (PDF). 2026-11-19. https://isocpp.org/files/papers/N4165.pdf. Accessed 25 November 2026.
Chicago "Unified Call Syntax." a b "Unified Call Syntax" (PDF). 2026-11-19. https://isocpp.org/files/papers/N4165.pdf.
APA a b "Unified Call Syntax" (PDF). (2026). Unified Call Syntax. Retrieved November 25, 2026, from https://isocpp.org/files/papers/N4165.pdf
Cite this article
MLA
"Uniform function call syntax." encyclopegia.org, 2026, https://encyclopegia.org/wiki/uniform-function-call-syntax. Accessed 25 November 2026.
Chicago
"Uniform function call syntax." encyclopegia.org. Accessed November 25, 2026. https://encyclopegia.org/wiki/uniform-function-call-syntax.
APA
encyclopegia.org. (2026). Uniform function call syntax. Retrieved November 25, 2026, from https://encyclopegia.org/wiki/uniform-function-call-syntax
Accessed November 25, 2026 · CC BY-SA 4.0 · citation page · JSON