Ios' `interface` and allocators' `allocator` similarities

This thread, and especially this post, within, do a great job of fleshing out the differences between Io and Allocator patterns, in which we regularly use an &io.interface and, somewhat seemingly-similarly (to higher-level code), we use an allocator.allocator(). But I have a stupid follow-up question. I know there’s work planned to take away the footgun of forgetting the ‘&’ when referencing an io interface, but I’m curious about the reasons to not make an interface() function, instead, which returns the reference (and thus avoids accidental copies)… then the “usage symmetry” between allocator.allocator() and io.interface() would… maybe?… “feel” like intentional consistency? (though that may be a fallacious goal, of course.) Perhaps overhead is a consideration… are there others?

2 Likes