"Definition of invoke
transitive verb
1a : to petition for help or support
b : to appeal to or cite as authority
2 : to call forth by incantation : conjure
3 : to make an earnest request for : solicit
4 : to put into effect or operation : implement
5 : bring about, cause"
2,3,4 and possibly even #5 relate to methods.
Simply referring to a method by name, like .rand invokes it directly.
Giving it a value (24.cos) is closer to #3 ("please give me this
value"), and it doesn't matter whether that's a literal or generated
from a variable of some sort.
" invocant n. One who calls upon or invokes."
It could be argued that the calling program is the invocant, but if a
process snoozes until something arrives in its in-box, then does an
action in response, it's a reasonable extension to call the
"something" an invocant. Think of dropping a coin into a soft-drink
machine; the coin invokes the can, even if the former owner of the
coin started the process.
On 12/28/20, ToddAndMargo via perl6-users <[email protected]> wrote:
> On 12/26/20 2:50 PM, Ralph Mellor wrote:
>>> Is this .self with a better name?
>> No.
>>
>> I know you've been progressing in your understanding of
>> OO in general, and Raku's in particular, since you wrote
>> this email. So I won't explain it for now, but rather just try
>> to confirm you now know what that bit of code is doing.
>>
>> So, would you say you now understand that `.value` is a
>> method call on an "invocant" that is either explicitly written
>> to the left of the `.` or is implicitly whatever the current topic
>> is where the `.value` appears?
>
> No idea since you hinted to a newbie like myself.
>
> I do know that .value comes from the class definition
>
> https://github.com/rakudo/rakudo/blob/5df809e29cd2e7ae496a33013b27d2f7b52c7f7d/src/Perl6/bootstrap.c/BOOTSTRAP.nqp#L3427
>
> 3427: Str.HOW.add_attribute(Str, BOOTSTRAPATTR.new(:name<$!value>,
> :type(str), :box_target(1), :package(Str)));
>
> And I would not say it was a method call. I would say
> it is a "class" from
>
> https://github.com/rakudo/rakudo/blob/5df809e29cd2e7ae496a33013b27d2f7b52c7f7d/src/Perl6/bootstrap.c/BOOTSTRAP.nqp#L19
>
> 19: my class BOOTSTRAPATTR {
>
>
> So I still find the word "invocant" a bit bizarre.
>
> https://www.merriam-webster.com/dictionary/invocant
> Definition of invocant
> : one that invokes
>
> https://www.merriam-webster.com/dictionary/invokes
> Definition of invoke
>
> transitive verb
> 1a : to petition for help or support
> b : to appeal to or cite as authority
> 2 : to call forth by incantation : conjure
> 3 : to make an earnest request for : solicit
> 4 : to put into effect or operation : implement
> 5 : bring about, cause
>
> So from "context", what I pick up is that
>
> 1. it is an awful term to have used
>
> 2. that
> 24.cos
> either the 24 appeals/requests to cos to do something
> making the 24 the invocant,
> or
> .cos is the invocant and takes the 24 and appeals to
> the code inside the method to "bring about" something.
> The 24 may or may not be needed for the appeal, as
> in ".rand"
>
> So it is better to just tell me and not hint around.
> I do appreciate your efforts a lot though. Who
> "executes what" who be a better tactic.
>
> -T
>
>
>
>