Strict syntax expression behavior

In this code:

let f(a,b,c) = a * b + c - (d())
let g(a,b,c) = a * b + c -(d())

      

f

- (int*int*int) -> int

, a g

- (int*int*(int*int)) -> int

.

Removing the parentheses around d()

in g

results in "Consecutive arguments must be separated by spaces or an error."

What's happening?

+3


source to share


1 answer


@bytebuster is perfectly right in his comment, but to put it in non-professional terms; -] is parsed as a binary subtraction operator and the other is parsed as a unary negation operator - you're just fighting operator precedence here.



+2


source







All Articles