News for hackers. Stuff that matters.
Re:What =delete means by jcranmer on Monday October 18, 2021 @11:42AM (#28906646)
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).
Re:What =delete means by tialaramex on Monday October 18, 2021 @12:02PM (#28906967)
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.

Re:What =delete means by agent327 on Monday October 18, 2021 @02:18PM (#28909124)
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.