Hacker News new | ask | show | jobs
by jstimpfle 16 days ago
> Also one separate function being different than the operator is not a language level feature, it is how that one library data structure is made.

That's not so much the point: the point is that even when calling a regular method conveniently as ptr->methodname(), you are calling the method name not on a pointer expression but on a value expression. ptr->methodname() is effectively (*ptr).methodname().

1 comments

That's not so much the point:

It is the point since you compared two things that have different uses, then said you can't call an operator on a pointer, which is wrong.

You don't get it. That's because you still don't understand some basic things about the language. There is no method call here on a pointer expression. There is only a call on a value expression.