Equivalent term for 'receiver' in languages not Objective-C

时光毁灭记忆、已成空白 提交于 2020-01-14 12:42:27

问题


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



来源:https://stackoverflow.com/questions/4584578/equivalent-term-for-receiver-in-languages-not-objective-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!