Hacker News new | past | comments | ask | show | jobs | submit login

But then you make built-in types special. One of the tenets of C++ is that user defined types have as much power as built-in types.



Built in types are special. The compiler needs to define operator precedence and certain semantics (commutativity, associativity, overflow, etc) that cannot be expressed in the type system or enforced by the interface.

The fact that it makes syntax "nicer" for user defined types is at best subjective and at worst an anti-pattern because it leads to bad compiled code and confused programmers. Function calls are unambiguous and follow the same rules as other function calls, while operator overloading does not.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: