Re: "our" methods?
I understand. Thank you. This ought to be mentioned in S12. Perhaps after the treatment on "my", explain that "our" is the default, but saying it explicitly allows the return type to be first. --John Audrey Tang audreyt-at-audreyt.org |Perl 6| wrote: > John M. Dlugosz 提到: > >> In S29, there are definitions like >>our Capture method shape (@array: ) is export >> But in S12 there is no mention as to what an "our" method is. It states >> that "my" is used to make private methods, and "^" to make class methods. >> I think this is a doc relic and should be fixed globally in that file. >> > > S02/"Return types": > > " > If a subroutine is not explicitly scoped, it belongs to the current > namespace (module, class, grammar, or package), as if it's scoped with > the C scope modifier. Any return type must go after the name: > " > > So this line: > > our Capture method shape (@array: ) is export > > is really the same as: > > method shape (@array: ) of Capture is export > > The prefixing of "our" is there to make the return ("of") type stand out. > > Cheers, > Audrey > > >
Re: "our" methods?
John M. Dlugosz 提到: > In S29, there are definitions like >our Capture method shape (@array: ) is export > But in S12 there is no mention as to what an "our" method is. It states that > "my" is used to make private methods, and "^" to make class methods. > I think this is a doc relic and should be fixed globally in that file. S02/"Return types": " If a subroutine is not explicitly scoped, it belongs to the current namespace (module, class, grammar, or package), as if it's scoped with the C scope modifier. Any return type must go after the name: " So this line: our Capture method shape (@array: ) is export is really the same as: method shape (@array: ) of Capture is export The prefixing of "our" is there to make the return ("of") type stand out. Cheers, Audrey
"our" methods?
In S29, there are definitions like our Capture method shape (@array: ) is export But in S12 there is no mention as to what an "our" method is. It states that "my" is used to make private methods, and "^" to make class methods. I think this is a doc relic and should be fixed globally in that file.