# Alternatives to operator overloading: infix functions

**URL:** <https://ziggit.dev/t/alternatives-to-operator-overloading-infix-functions/13457>\
**Category:** Brainstorming\
**Tags:** language-dev\
**Created:** [December 10, 2025, 9:35am UTC](https://ziggit.dev/t/alternatives-to-operator-overloading-infix-functions/13457 "2025-12-10T09:35:01Z")\
**Posts on this page:** 1\
**Showing post:** 33

<div class="post-metadata">

**Author:** ![Zambyte](https://ziggit.dev/user_avatar/ziggit.dev/zambyte/32/4977_2.png) [@Zambyte](https://ziggit.dev/u/Zambyte)\
**Post date:** [December 11, 2025, 1:18am UTC](https://ziggit.dev/t/alternatives-to-operator-overloading-infix-functions/13457/33 "2025-12-11T01:18:00Z")

</div>

Far from the main point of this thread, but @offset you have mentioned that `comptime for` is used for loop unrolling several times, but that is not true. `comptime` evaluates the given expression entirely at compile time. It does not unroll loops. The `inline` keyword is used to unroll loops. Consider this snippet:

```zig
comptime var x: comptime_int = 0;
comptime for (0..10) |i| {
    x = i + x * 2;
};
inline for (0..5) |_| {
    std.debug.print("x is {}\n", .{x});
}

```

For both kinds of loops, the number of iteration must be known at compile time. Both loops could loop over an array with a comptime known value, but an `inline for` can also loop over an array (note: comptime known length) with a runtime known value. The body of a `comptime` loop can only operate on `comptime` data, like I am demonstrating by mutating a `comptime var`. The body of an `inline for` loop can do runtime operations, which I am demonstrating by doing IO.

---

_[View the full topic](https://ziggit.dev/t/alternatives-to-operator-overloading-infix-functions/13457)._
