Equivalent term for 'receiver' in language

2019-06-27 12:32发布

问题:

In Objective-C when you have

[A something]

A is referred to as the 'receiver'. I am wondering what the equivalent term is in other object-orientated languages, particularly method calling ones as opposed to message passing ones.

Caller/Callee refers to the actual methods themselves I think, not the object. Also I'm not sure about 'instance' as in the language I'm working with, Vala, you can actually call methods on structs and namespaces, which you wouldn't classify as objects or instances.

What are people's thoughts?

回答1:

I think the most common term is just "the object". In Python it is traditionally called self.



回答2:

It's method-invoking rather than message-passing, so another common term, particularly among Perl hackers, is invocant.

When you call a method, you do so with an invocant. When you call new() on Cat, the name of the class, Cat, is new()'s invocant. [...] When you call a method on an object, that object is the invocant.

-- chromatic, Modern Perl