Search code examples
ooplanguage-agnosticnomenclature

What's the left-hand side of a method invocation called?


Given the following line

cat.meow(10, x);
  • "meow" is the "function" or "method" being called
  • 10 is the "first argument"
  • x is the "second argument"

What is cat called?

I'm dissatisfied with the answer, cat is called "the object". I want to say I've heard it called the "receiver", but I don't remember where I've heard that.

Considering both 10 and x can be objects, calling cat "the object" doesn't help me distinguish this component from the argument components.

This makes it difficult to discuss the various components that makeup a function call.


Solution

  • It is called the “subject” following the subject-verb-object sentence structure that object-oriented programming mimics:

    cat.meow(10, x);
    |_||___||_____|
     |   |     |
     |   |     +--> object (the arguments list is a tuple object)
     |   |
     |   +--> verb (the verb is the method name with the dot)
     |
     +--> subject (quite self explanatory)
    

    I should clarify that I call it the “subject” because it makes sense to me. However, there's no consensus on this nomenclature. Everyone has their own opinions on what it should be called.