Fuzion Logo
fuzion-lang.dev — The Fuzion Language Portal

Calls

Parentheses in calls are optional. How about commas to separate actual arguments and dots to separate the call target from the called feature name?

Other Languages

Haskell call syntax

Haskell omits parentheses and commas in function calls, i.e.

  a b c d

is equivalent to the Java code a(b,c,d). Further examples, inspired by schoolofhaskell.com :

Haskell Java Comment
a b c d
a(b,c,d)
f -1
f-1
CAVEAT: This is not a call, but an infix operation!
f (-1)
f(-1)
Parentheses around argument make this a call.
(f a b)
f(a,b)
Parentheses go around a call
a b * c d
a(b)*c(d)
Call has highest precedence
a (b * c) d
a(b*c, d)
Parentheses are needed around infix/prefix/postfix expressions given as call arguments
f g x
f(g, x)
Even if f, g are both functions, g is not called here, but passed as argument to f. Function call binds to the left.
f (g x)
f(g(x))
Parentheses are required to pass the result of applying g to x to f.
f $ g $ x
f(g(x))
Alternatively, $ can be used as a function call operator that binds to the right.
(f . g) x
int fg(int y) { return f(g(y)); }
fg(x);
Function composition in Haskell is done using a dot.
f x y = x + y*y
g = f 3
g 4
int f(int x, y) { return x + y*y; }
int g(int y) { return f(3, y); }
g(4);
Currying: Applying only a part of the arguments to a function results in a function that expects the remaining arguments.
f (a, b)
record Tuple(int v, int w) { }
f(new Tuple(a, b))
Classical call syntax in Haskell with comma-separated arguments results in a call with one argument that is a tuple.

Scala-3

The following table contains examples inspired by a discussion on stackoverflow.

TBD: What does call syntax in Scala-3 look like? Any changes?

Scala Java Comment
o.m(a)
o.m(a)
Dot notation like in Java.
o m (a)
o.m(a)
Operator notation.
o m a
o.m(a)
Operator notation with single argument does not require parentheses.
o m
o.m()
Operator notation without arguments does not require parentheses.
a m: o
o.m:(a)
Operator notation inverts target and arguments if called method ends in :.

Nim

Examples inspired by manual at nim-lang.org.

Nim Java Comment
m(o, a)
o.m(a)
Not object-oriented style notation.
o.m(a)
o.m(a)
Dot notation like in Java.
o.m
o.m()
Parentheses are optional for dot notation with no arguments

Fuzion call syntax

The following tables show what is currently considered for Fuzion:

Call with and without parentheses

Fuzion Haskell Java Comment
a(b,c,d)
a b c d
a(b,c,d)
Fuzion should support classic call syntax.
a b c d
a b c d
a(b,c,d)
Parentheses and commas should be optional.
a b (c d)
a b (c d)
a(b,c(d))
Parentheses group calls and arguments.
a (b c) d
a (b c) d
a(b(c),d)
Parentheses group calls and arguments.

Examples

call1 is
a(x,y,z String) => say "called a($x, $y, $z)"
a(x,y String) => say "called a($x, $y)"
a(x String) => say "called a($x)"
a() => say "called a()"
b(x,y String) => "b($x, $y)"
b(x String) => "b($x)"
c(x String) => "c($x)"
b := "b()"
c := "c()"
d := "d()"
# calls with parentheses
a(b,c,d)
a(b, c, d)
a( b, c, d)
a(b, c)
a(b)
a()
# calls without parentheses
a b c d
a b c
a b
a
# calls with parentheses around arguments
a b c (d)
a b (c) (d)
a (b) (c) (d)
# call with parentheses to group call
a b (c d)
a (b c) d
a (b c d)
# mixed calles with and without parantheses
a(b c, d)
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Binding strength of calls and prefix/postfix operators:

Fuzion Haskell Java Comment
f -1
f (-1)
f(-1)
Raku-style: infix or postfix operators bind stronger if there is no space between the operator and its operand.
f - 1
f - 1
f - 1
With spaces, we get an infix operator, so this is equivalent to f.infix -(1).
f-1
f - 1
f - 1
Without any spaces, we also get an infix operator, so this is equivalent to f.infix -(1).
f x-1
f (x-1)
f(x-1)
Extended Raku-style: infix operators without space bind stronger than calls!
f x - 1
f x - 1
f(x) - 1
Extended Raku-style: infix operators with space bind weaker than calls!
f x -1
f x (-1)
f(x, -1)
Raku-style: prefix operators without space bind stronger than calls!
f x- 1
f (x-) 1
f(x.postFixMinus(), 1)
Raku-style: postfix operators without space bind stronger than calls, so this is equivalent to f(x.postfix -, 1).

Examples

call2 is
f(n i32) => 100*n
f(x1, x2 i32) => 5*x1 + 7*x2
f => 10_000
y is
postfix - => 13
infix - (a i32) => 23*a
x(a i32) => 29*a
chk(expected, got i32) =>
say "{if expected = got then "PASS" else "*** FAIL ***"} expected $expected, got $got"
r0 := f -1
chk -100 r0
r1 := f - 1
chk 9_999 r1
r2 := f-1
chk 9_999 r2
x := 10
r3 := f x-1
chk 900 r3
r4 := f x - 1
chk 999 r4
r5 := f x -1
chk 43 r5
r6 := f y- 1
chk 72 r6
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Calls with parentheses:

Fuzion Haskell Java Comment
f(a b c)
f (a b c)
f(a(b, c))
Parentheses may go around all arguments and commas can be omitted, turning this into f(a(b, c)).
f(a, b, c)
(f a b c)
f(a, b, c)
Parentheses may go around all arguments, requiring commas to avoid turning argument list into a call. So this is equivalent to f a b c.
(f a b c)
(f a b c)
f(a,b,c)
Parentheses may go around a call

Examples

call3 is
f(x,y,z String) => say "f($x,$y,$z)"
f(s String) => say "f($s)"
f(x,s String) => say "f($x,$s)"
a(x String) => "a($x)"
a(x,y String) => "a($x,$y)"
b(x String) => "b($x)"
a := "a"
b := "b"
c := "c"
# calls with parentheses
f(a b c)
f(a b,c)
f(a,b c)
f(a,b,c)
(f a b c)
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Binding strength of calls and infix operators:

Fuzion Haskell Java Comment
a b * c d
a b * c d
a(b)*c(d)
Call has highest precedence, so this is equivalent to a(b) * c(d).
a b*c d
a (b * c) d
a(b*c, d)
infix operator without spaces has higher precedence than call. so this is equivalent to a(b*c,d).

Examples

call4 is
chk(expected, got i32) =>
say "{if expected = got then "PASS" else "*** FAIL ***"} expected $expected, got $got"
a(x i32) => 2*x
a(x,y i32) => x*y*13
b => 3
c(x i32) => 5*x
c => 11
d => 7
r0 := a b * c d
chk((2*3)*5*7, r0)
r1 := a b*c d
chk(3*11*7*13, r1)
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Function Composition

Fuzion Haskell Java Comment
f g x
f g x
f(g, x)
Even if f, g are both functions, g is not called here, but passed as argument to f. Function call binds to the left.
f(g x)
f (g x)
f(g(x))
Parentheses are required to pass the result of applying g to x to f.
NYI: Compose operator
(f . g) x)
int fg(int y) { return f(g(y)); }
fg(x);
Function composition via a dedicated operator is currently not supported. Need compelling use cases to justify this, could be realized with syntactic sugar.

Examples

call5 is
chk(expected, got i32) =>
say "{if expected = got then "PASS" else "*** FAIL ***"} expected $expected, got $got"
f (x i32) => call5.f.this.x*2
f (x1, x2 i32) => x1*11+x2*13
g => 17
g (x i32) => call5.g.this.x*3
x => 7
r0 := f g x
chk 17*11+7*13 r0
r1 := f(g, x)
chk 17*11+7*13 r1
r2 := f(g x)
chk 7*3*2 r2
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Currying

Fuzion Haskell Java Comment
f(i32 x, y) => x + y*y
g => f 3   # NYI! Currying
g 4
      
f x y = x + y*y
g = f 3
g 4
int f(int x, y) { return x + y*y; }
int g(int y) { return f(3, y); }
g(4);
NYI: Currying: Applying only a part of the arguments to a function results in a function that expects the remaining arguments.

Examples

call6 is
chk(expected, got i32) =>
say "{if expected = got then "PASS" else "*** FAIL ***"} expected $expected, got $got"
f(x, y i32) => x + y*y
g => f 3 # NYI! Currying
r := g 4
chk 3+4*4 r
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Tuples as arguments

Fuzion Haskell Java Comment
f((a, b))
f (a, b)
record Tuple(int v, int w) { }
f(new Tuple(a, b))
Passing a tuple in Fuzion requires double-parentheses to disambiguate passing a tuple from a call using parentheses.
f (a, b)
f (a, b)
record Tuple(int v, int w) { }
f(new Tuple(a, b))
Separating the argument from the name of the called feature turns the argument into a tuple.

Examples

call7 is
chk(expected, got i32) =>
say "{if expected = got then "PASS" else "*** FAIL ***"} expected $expected, got $got"
f(t tuple i32 i32) => t.0 + t.1 * t.1
a => 3
b => 5
r0 := f((a, b))
chk 3+5*5 r0
r1 := f (a, b)
chk 3+5*5 r1
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Object-oriented style calls

Fuzion Haskell Java Comment
obj.m x
--
obj.m(x)
Object-oriented dot notation for a call. Here, the scope to lookup m is different, m is searched for in the visible features of the static type of obj only.
obj m x     # not supported! useful?
--
obj.m(x)
Scala-like operator notation for a call. This would result in an ambiguity if m exists both in the local scope and in the static type of obj. Which m should be taken in this case?
m obj x     # not supported! useful?
--
obj.m(x)
Nim-style call syntax for object-oriented calls. If f64 declares sin, this would permit code like sin α for a f64 value α instead of α.sin. Does this justify extending the call syntax? An alternative with the same effect would be to declare sin within a different unit-type feature trigo and then either use trigo.sin α or to inherit trigo to make sin visible such that a call sin α is possible.

Examples

call8 is
chk(expected, got i32) =>
say "{if expected = got then "PASS" else "*** FAIL ***"} expected $expected, got $got"
my_class(f i32) is
m(a i32) => f*a
obj0 := my_class 2
x0 := 3
r0 := obj0.m x0
chk 2*3 r0
obj1 := my_class 5
x1 := 7
r1 := obj1.m x1
chk 5*7 r1
# No support for scala-like operator notation:
#
# r := obj m x
# No support for nim-like calls
#
# r := m obj x
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Type parameters

Fuzion Haskell Java Comment
myMap i32 String
myMap i32 String
myMap<i32,String>()
Fuzion syntax for type parameters in a call is the same as for value parameters, i.e., using either spaces or ( , ) to separate arguments.
myMap(i32, String)
myMap i32 String
myMap<i32,String>()

Examples

call9 is
my_map(K, V type) is
key := mut (option K nil)
val := mut (option V nil)
put(k K, v V) =>
key <- option k
val <- option v
m1 := my_map bool u64
say "{m1.key.get} => {m1.val.get}"
m1.put true 1_000_000_000_000
say "{m1.key.get} => {m1.val.get}"
m1.put false ((u64 1_000_000_000_000) - 1)
say "{m1.key.get} => {m1.val.get}"
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Dollar / left pipe / apply-to operator in calls

Haskell provides the $ operator, F# has <| to avoid parentheses in chained calls. Do we need this in Fuzion?

Fuzion Haskell F# Comment
draw (point (a (b x) (a (b y))))
draw $ point (a $ b x) (a $ b y)
draw <| point (a <| b x) (a <| b y)
Which of these is best?
last changed: 2025-05-12