Stream: ideas

Topic: infix functions


view this post on Zulip Luke Boswell (Oct 23 2023 at 01:42):

I was wondering if all infix operations are always exactly two args, lhs and rhs?

If so would it be possible to have a way to say this function is infix and therefore can only be called in that way.

So maybe,

times: F32, F32 -> F32 is infix
# e.g. (1 times 2) == mul 1 2
# or (1 times 2 times 3) == (mul 1 (mul 2 3))

x : Num.mul is infix
# make another function infix using an alias

I suspect this breaks everything else, but I wonder if this counts as sugar?

view this post on Zulip Brendan Hansknecht (Oct 23 2023 at 01:43):

That wouldn't have precedence which would be problematic

view this post on Zulip Brendan Hansknecht (Oct 23 2023 at 01:44):

Also there was already discussion around allowing functions in general to be infix. Seemed to not really go anywhere. I'm not sure it is a wanted feature.


Last updated: Jun 16 2026 at 16:19 UTC