Consider:
#include "share/atspre_staload.hats"
fun plus_int_int(x: int, y: int): int = x + y
symintr .plus
overload .plus with plus_int_int
implement main0() =
println!("4+4+4 = ", ((4).plus(4)).plus(4))
This works, and it's clear that it can't be 4.plus()
as the 4.
is taken as a float. What I'd like to know is, why doesn't (4).plus(4).plus(4)
work? ATS finds no valid overload for the second .plus
, which tells me that it's expecting some other type than (int, int) -> int
. What type is it expecting?
The current ATS2 parser interprets
(4).plus(4).plus(4)
as
((4).plus)((4).plus)(4)
I cannot easily fix the parser. I will think about it when implementing ATS3.