Chapter 12. Operator Overloading

We programmers tend to dislike excessive separation between built-in types and user-defined types. Endowing built-in types with magic properties works against the openness and extensibility of any language because user-defined types are forever condemned to second-class status. Yet language designers have legitimate reasons to give built-in types the red carpet treatment. One such reason is that a language that’s too configurable becomes difficult to teach and also difficult to parse both by the human and by the machine. Each language tries to strike a good balance between the built-in and the configurable, some making it a point to get close to one of the two extremes.

D’s take on the matter is pragmatic: it ...

Get The D Programming Language now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.