Uniform function call syntax: Difference between revisions

Content deleted Content added
remove references to unlikely future articles
sort examples alphabetically
Line 5:
 
== Examples ==
=== Nim programming language ===
<syntaxhighlight lang="nim">
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)
</syntaxhighlight>
 
=== D programming language ===
<syntaxhighlight lang="d">
Line 52 ⟶ 35:
int[] e = a.addone().addone();
}
</syntaxhighlight>
 
=== Nim programming language ===
<syntaxhighlight lang="nim">
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)
</syntaxhighlight>