>1) why is it "$needle" and not "$!needle" on line 338?
>    Is this because it is an internal variable and not
>    a variable from the class declaration?

It's a parameter from line 337. If that's what you mean by
"an internal variable", then yes. :)

>2) where is variable ".value" defined on line 338?
>    What kind of variable is .value?

I don't see a `.value`, only a `$!value`. But if I did, and had that
sort of name, it would typically be a method call that returns an
attribute of the same name -- like `$!value`.

>3) the first "Str:D" goes to what on line 337?  To .value?

No, to the invocant.

>4) Is .value the default, if there is no name given?

I don't see a `.value`, nor what you mean by "name".

On Sun, Dec 20, 2020 at 7:05 AM ToddAndMargo via perl6-users
<perl6-users@perl.org> wrote:
>
> Hi All,
>
> https://github.com/rakudo/rakudo/blob/master/src/core.c/Str.pm6
>
> 337:multi method contains(Str:D: Str:D $needle --> Bool:D) {
>
> 338:nqp::hllbool(nqp::isne_i(nqp::index($!value,$needle,0),-1))
> 339:}
>
> I "presume" in
>
>       "abcd".contains("bc")
>
> "abcd" is `$!value`, and
>
> "bc" is $needle.  Do I presume correctly?
>
>
> Questions:
>
> 1) why is it "$needle" and not "$!needle" on line 338?
>     Is this because it is an internal variable and not
>     a variable from the class declaration?
>
> 2) where is variable ".value" defined on line 338?
>     What kind of variable is .value?
>
> 3) the first "Str:D" goes to what on line 337?  To .value?
>
> 4) Is .value the default, if there is no name given?
>
> Many thanks,
> -T

Reply via email to