On Tue, 12 Dec 2023 at 21:00, Robert Landers <landers.rob...@gmail.com> wrote:
> On Tue, Dec 12, 2023 at 2:04 PM G. P. B. <george.bany...@gmail.com> wrote: > > GMP supports operator overloading > > GMP kinda-sorta-most-of-the-time supports operator overloading. > Sometimes ... it doesn't. I implemented a field library in PHP (for > work a couple of years ago) and occasionally, overloading would cast > things back to float/int and break the math. I don't have access to > that code, so I don't have any examples readily available (and the > fact that an extension can do overloading but we can't in user-land is > a whole different can of worms which made this library ridiculously > hard to work with -- we rewrote everything in Scala and never looked > back). Needless to say, if I were to go into a project that required > GMP, I wouldn't trust the overloading. > I have no idea how _this_ is possible considering GMP will happily throw type errors left and right even in cases when it shouldn't. If you encountered this, you should have submitted a bug report. Because, using a potential bug as an excuse for not doing this is... weird? I have come around userland operator overloading with the proposal from Jordan, but considering this hasn't passed it might take a while before someone gives it a crack at it again. And it has _always_ been a thing that the engine, and internal extensions, can do more things than userland. Especially nonsensical stuff like variadic parameters not at the end... Gina P. Banyard