问题
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()
onCat
, the name of the class,Cat
, isnew()
's invocant. [...] When you call a method on an object, that object is the invocant.
-- chromatic, Modern Perl
来源:https://stackoverflow.com/questions/4584578/equivalent-term-for-receiver-in-languages-not-objective-c