And looking at questions in other threads- there are subroutines declared
with "sub", those get called without an invocant.
sub i-am-a-sub() { say "Hi from subroutine land!" }
i-am-a-sub; # says "Hi from subroutine land!"
and methods are declared inside a class, and are called with an invocant of
that class type.
class sample-class {
method speak-to-me {say "We are classy"}
}
my sample-class $object;
$object. speak-to-me; # Guess what it says
... subroutines and methods, in the perl6 class hierarchy, are both
subclasses "Routine"
maybe that's the word your looking for!
-y
On Tue, Sep 11, 2018 at 8:12 AM, yary <[email protected]> wrote:
> I would call them subroutines, since that's the long form of "sub"
>
> -y
>
> On Tue, Sep 11, 2018 at 3:47 AM, ToddAndMargo <[email protected]>
> wrote:
>
>> Hi All,
>>
>> I use subs like ducks use water. It is about time
>> I learned what to properly call them.
>>
>> I come from Modula2 and Pascal (as well as bash), "functions"
>> return a value outside the declared parameters and "(sub)routines"
>> only can modify values through the declarations parameters.
>>
>> Sort of like
>> function: sub add($a, $b){return $a+$b}
>> routine: sub add($a, $b, rw $c){$c = $a+$b}
>>
>> In Perl, what is the proper terminology?
>>
>> Many thanks,
>> -T
>>
>> I no longer use "rw $c". I always use "return".
>> The guys told me this was the best way on the
>> chat line, so I adopted it.
>>
>
>