Assuming that there's even support for expr pointers in Tractor, there's a potential ambiguity between invoking a struct's expr pointer and a freestanding function using UFCS.
Add :: expr(a : Vec2, b) -> Vec2
Vec2 :: struct
X : f32
Y : f32
Add : expr (a : f32, b) -> f32
val := v1.Add(v2) //Do we access v1's Add field and call it or do we call the freestanding Add expr?
In my opinion, this presents two issues:
A: You don't exactly know if the dot operator in this case is accessing the variable or not
B: There is a chance of a collision as demonstrated in the snippet above.
When solving the same problem myself, I've decided to steal F#'s/JS' pipe operator which makes UFCS very explicit and makes the dot operator exclusively access fields.
Assuming that there's even support for expr pointers in Tractor, there's a potential ambiguity between invoking a struct's expr pointer and a freestanding function using UFCS.
In my opinion, this presents two issues: A: You don't exactly know if the dot operator in this case is accessing the variable or not B: There is a chance of a collision as demonstrated in the snippet above.
When solving the same problem myself, I've decided to steal F#'s/JS' pipe operator which makes UFCS very explicit and makes the dot operator exclusively access fields.