There's a talk for that too:

https://www.youtube.com/watch?v=7mkmZVIizFY 2016 - Basic OO in Perl 6‎ -
Dave Rolsky

On Tue, Sep 11, 2018 at 1:42 PM Brandon Allbery <allber...@gmail.com> wrote:

> I'd like to point out that Todd is from Perl 5, which doesn't distinguish
> between subs and methods because its built-in OO is a minimalist hack. An
> introduction to true objects might be in order.
>
> On Tue, Sep 11, 2018 at 8:34 AM Simon Proctor <simon.proc...@gmail.com>
> wrote:
>
>> Also Todd I gave a talk on signatures types and multi methods at The Perl
>> Conference this year.
>>
>> https://www.youtube.com/watch?v=Sy-qb5nXKyc&t=8606s
>>
>> That should be just before the start.
>>
>>
>> https://www.slideshare.net/SimonProctor8/perl6-signatures-types-and-multicall
>>
>> Slides are here.
>>
>> Hope this helps.
>>
>> Simon
>>
>> On Tue, 11 Sep 2018 at 13:05 Simon Proctor <simon.proc...@gmail.com>
>> wrote:
>>
>>> 1) why is it a "method" and not a "function"?
>>>
>>> methods are all on instance of a Class (or Role) they can locally access
>>> the instances data via self or $ or ... see below.
>>>
>>> 1-1/2) why is there a color after a$?  What happens to $a?
>>>
>>> You can as an extra option give your instance object a different name,
>>> you seperate that from the rest of the args with a :
>>>
>>> 2) What is an "invocant"?  Does it mean I can access it
>>>     by placing it after something with a dot?  Sort of
>>>     like
>>>          contains("abc", "b")
>>>          "abc".contians("b")
>>>
>>> The incovant is the object you invoke the method on. It's the thing that
>>> gets assigned to self, $ (and whatever else you want to call it)
>>>
>>> 3) What makes the "invocant" special over the other second
>>>     and third parameters?
>>>
>>> See about
>>>
>>>  > class Foo {
>>>
>>> 4) I see no class called "Foo" over on
>>>     https://docs.perl6.org/type.html
>>>
>>> That's a class being defined for this example
>>>
>>> 5) Are they creating a new class?  If so, why?
>>>
>>> To make an example
>>>
>>>  >    method whoami($me:) {
>>>
>>> 6) where is @b and %c?
>>>
>>> In this case thet aren't being passed.
>>>
>>>
>>>  >        "Well I'm class $me.^name(), of course!"
>>>
>>> 7) why is there a caret in front of "name"?
>>>
>>> There are certain Meta Object methods that are access with a ^ infront
>>> of the name. I'd need to check the exact definition though.
>>>
>>> Please note the Perl5 docs have had decades of people working on them
>>> the Perl6 ones.... less so. There's bound to be some difference in scope.
>>>
>>> On Tue, 11 Sep 2018 at 12:11 ToddAndMargo <toddandma...@zoho.com> wrote:
>>>
>>>> On 09/11/2018 03:30 AM, JJ Merelo wrote:
>>>> > Also, "is no help whatsoever" is no help whatsoever. Saying what part
>>>> of
>>>> > it is not clear enough, or could be explained better, is.
>>>> >
>>>>
>>>> Well now,
>>>>
>>>>  >  method ($a: @b, %c) {};       # first argument is the invocant
>>>>
>>>> 1) why is it a "method" and not a "function"?
>>>>
>>>> 1-1/2) why is there a color after a$?  What happens to $a?
>>>>
>>>> 2) What is an "invocant"?  Does it mean I can access it
>>>>     by placing it after something with a dot?  Sort of
>>>>     like
>>>>          contains("abc", "b")
>>>>          "abc".contians("b")
>>>>
>>>> 3) What makes the "invocant" special over the other second
>>>>     and third parameters?
>>>>
>>>>  > class Foo {
>>>>
>>>> 4) I see no class called "Foo" over on
>>>>     https://docs.perl6.org/type.html
>>>>
>>>> 5) Are they creating a new class?  If so, why?
>>>>
>>>>  >    method whoami($me:) {
>>>>
>>>> 6) where is @b and %c?
>>>>
>>>>  >        "Well I'm class $me.^name(), of course!"
>>>>
>>>> 7) why is there a caret in front of "name"?
>>>>
>>>>  >    }
>>>>  >  }
>>>>  >
>>>>  >
>>>>  >  say Foo.whoami; # OUTPUT: «Well I'm class Foo, of course!␤»
>>>>
>>>> 8) no clue how they got there
>>>>
>>>>
>>>> JJ, have you ever used Perl 5's perldocs?  They are a bazillion
>>>> times easier to understand than Perl 6's.
>>>>
>>>> Thank you for the help with this?
>>>>
>>>> -T
>>>>
>>> --
>>> Simon Proctor
>>> Cognoscite aliquid novum cotidie
>>>
>> --
>> Simon Proctor
>> Cognoscite aliquid novum cotidie
>>
>
>
> --
> brandon s allbery kf8nh
> allber...@gmail.com
>

Reply via email to