Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Do you also complain that the operator named '*' is overloaded? As a binary operator, it means to perform a multiplication operator. As an unary operator, it means to load the value located at that memory address, which has nothing to do with anything close to multiplication. That is a more gross alteration of semantics than the use of a keyword in completely different slots (as an expression versus as a declarator).


I'm not a fan of your example with the asterisk or of the reference operator sharing a symbol with the binary AND operator.

I don't like the use of + for concatenation much either, even though it's overloaded to do that in some languages I really like, and it's even special cased despite the lack of overloading in one language I think is fairly good (Java) and some others I've used but think are garbage.

But I'm willing to cut some more slack for symbols because they're short.

I think erase for example would have been a better choice here (I haven't spent long thinking about this, the committee had months), but C++ had to worry about the backwards compatibility penalty and that's... sad.


Actually it would have been a contextual keyword, meaning it could be any word the committee wanted it to be, and it is only recognized as such in this particular context (i.e. at the end of a function declaration). They could have chosen anything they wanted, but decided that '=delete' was fine.

Other examples of contextual keywords are 'final' and 'override', which may also occur on function declarations.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

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

Search: