News for hackers. Stuff that matters.
Re:Zig, the Small Language by WalterBright on Wednesday September 07, 2022 @01:17PM (#32753392)
D initially wasn't going to do operator overloading, mainly because C++ iostreams was a disaster (in my not-so-humble opinion) as well as the awfulness of overloading operators to create a DSL.

But I wound up being convinced that on balance it was a good thing. But I was able to inculcate a culture that operator overloading should be restricted to the creation of user arithmetic types.

Not allowing the overloading of unary *, &, and dot also help discourage non-arithmetic overloading.

Re:Zig, the Small Language by dfawcus on Wednesday September 07, 2022 @06:19PM (#32757838)
Well, there is always the limited form of arithmetic overloading which Ken Thompson added to his compiler:

https://marc.info/?l=9fans&m=111559034637840&w=2

Re:Zig, the Small Language by int_19h on Thursday September 08, 2022 @04:19AM (#32762804)
C# has had extensive operator overloading from day 1, and the only instance of (mild) abuse that I can think of is the use of implicit conversions from strings in XLINQ. It really is mostly down to culture, I think.
Re:Zig, the Small Language by 1980phipsi on Wednesday September 07, 2022 @01:36PM (#32753597)
What about something like R's custom infix operators? R has %*% for matrix multiplication (and a few other built-in ones), but you can define your own %op%. It lets users know that potentially "here be dragons".
Re:Zig, the Small Language by WalterBright on Wednesday September 07, 2022 @01:47PM (#32753760)
That has come up a few times. Frankly, %*% looks even worse. Using Unicode sounds like a good idea, until one discovers that the source code is not parseable without semantic analysis.