https://kotlinlang.org logo
Title
h

haining

11/20/2017, 2:40 AM
I'm looking to identify the term for something, what do you call it in kotlin when you invoke a method through the class while passing the
this
argument explicitly as in
(String::take)("hello", 3)
or even, what you call the
String::take
part?
f

ferc

11/20/2017, 3:08 AM
http://kotlinlang.org/docs/reference/reflection.html#function-references String::take is a function reference to the function take on the class String. The second parentheses ("hello", 3) is you actually invoking that function you are referencing. Not sure what you mean by passing this in this case.
h

haining

11/20/2017, 3:15 AM
for example, python would call this an "unbound method" with
str.upper
, c++ the closest would be "pointer-to-member" with
std::string::size
I'm just looking for the name you'd use for
String::take
in this example, is there not one more specific than it being a function reference?
c

Czar

11/20/2017, 11:26 AM
String::take
is function reference,
(String::take)("hello", 3)
is invoking function by reference (probably) 🙂