Re: How to use WHY on a object's method?

2022-01-17 Thread David Emanuel da Costa Santiago
Super! That's what i was looking for. Thanks! David Santiago Às 18:43 de 17/01/22, Clifton Wood escreveu: You need the method object, and you can't get that from $a.test  -- Try using the following: when X::AdHoc { say $a.^lookup('test').WHY; # TODO: This is wrong :-( } I've tested

Re: How to use WHY on a object's method?

2022-01-17 Thread Clifton Wood
You need the method object, and you can't get that from $a.test -- Try using the following: when X::AdHoc { say $a.^lookup('test').WHY; # TODO: This is wrong :-( } I've tested it here ( https://replit.com/@Xliff/ThinDutifulExtensions#main.raku) and it works! :) -X On Mon, Jan 17, 2022 at 12

How to use WHY on a object's method?

2022-01-17 Thread David Emanuel da Costa Santiago
Hello Rakuns, How do i access the declarator block of my object method? I'm trying to do this, but it's not working: class A { #|( This is just a test with 3 parameters: * p1 - parameter 1 * p2 - parameter 1 * p2 - parameter 1 ) method test($p1, $p2, $p3

Re: A problem case for the site documentation search: the "^methods" method.

2021-03-11 Thread Richard Hainsworth
Jo, For what its worth, the search page on http://raku.finanalyst.org now takes you to ^methods Previously, a search on '^methods' found the reference, but hide the location, so the link could not be clicked. That is fixed now. Regards, Richard On 10/03/2021 15:42, Joseph Brenner wrote:

Re: A problem case for the site documentation search: the "^methods" method.

2021-03-10 Thread Joseph Brenner
JJ Merelo wrote: > This is a bug in Documentable. Generated an issue there > https://github.com/Raku/Documentable/issues/149 Thanks for the report. And thanks for opening the issue.

Re: A problem case for the site documentation search: the "^methods" method.

2021-03-10 Thread JJ Merelo
This is a bug in Documentable. Generated an issue there https://github.com/Raku/Documentable/issues/149 Thanks for the report.

Re: A problem case for the site documentation search: the "^methods" method.

2021-03-10 Thread JJ Merelo
t; On Tue, Mar 2, 2021 at 8:12 PM Joseph Brenner wrote: > > > > If you go to docs.raku.org and type "^methods" into the search > > window, you get a drop down looking something like this: > > > > class > > Method > > Submeth

Re: A problem case for the site documentation search: the "^methods" method.

2021-03-09 Thread Will Coleda
Please open an issue for this at github.com/Raku/doc/issues On Tue, Mar 2, 2021 at 8:12 PM Joseph Brenner wrote: > > If you go to docs.raku.org and type "^methods" into the search > window, you get a drop down looking something like this: > > class >

A problem case for the site documentation search: the "^methods" method.

2021-03-02 Thread Joseph Brenner
If you go to docs.raku.org and type "^methods" into the search window, you get a drop down looking something like this: class Method Submethod method methods Reference ^methods methods Submethods Routine method S

Re: I need help understanding ".contains" method construction

2020-12-28 Thread ToddAndMargo via perl6-users
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 do

Re: I need help understanding ".contains" method construction

2020-12-28 Thread Parrot Raiser
ement 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 gener

Re: I need help understanding ".contains" method construction

2020-12-27 Thread ToddAndMargo via perl6-users
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.

Re: I need help understanding ".contains" method construction

2020-12-27 Thread ToddAndMargo via perl6-users
On 12/19/20 11:04 PM, ToddAndMargo via perl6-users 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

Re: I need help understanding ".contains" method construction

2020-12-26 Thread Ralph Mellor
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 i

Re: I need help understanding ".contains" method construction

2020-12-23 Thread Todd Chester via perl6-users
e 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`. Is this .self with a better name? 3) the first "Str:D" goes to what on line 337? To .value? No, to the invocant

Re: I need help understanding ".contains" method construction

2020-12-23 Thread Ralph Mellor
>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`. >

Re: I am having trouble declaring a method

2020-12-20 Thread ToddAndMargo via perl6-users
On 12/20/20 5:01 AM, ToddAndMargo via perl6-users wrote: On 12/20/20 2:24 AM, ToddAndMargo via perl6-users wrote: Hi All, Now what am I doing wrong? -T    class Angle {     # has num64 $.degrees;     method AngleCosine( Rat:D: --> Rat:D )  {    my Numeric $radians = sel

Re: I am having trouble declaring a method

2020-12-20 Thread ToddAndMargo via perl6-users
On 12/20/20 2:24 AM, ToddAndMargo via perl6-users wrote: Hi All, Now what am I doing wrong? -T   class Angle {    # has num64 $.degrees;    method AngleCosine( Rat:D: --> Rat:D )  {   my Numeric $radians = self*π/180;   print "self   = <&qu

Re: I need help setting up a method

2020-12-19 Thread ToddAndMargo via perl6-users
On 12/19/20 8:21 PM, Bruce Gray wrote: With a custom `new` method, that could be shortened further to: say BadMath.new(2, 2).BadAdd; print BadMath.new(2, 2).BadAdd ~ "\n"; Default constructor for 'BadMath' only takes named arguments in block at line 1 What am I missing?

I need help understanding ".contains" method construction

2020-12-19 Thread ToddAndMargo via perl6-users
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&qu

Re: I need help setting up a method

2020-12-19 Thread ToddAndMargo via perl6-users
On 12/19/20 8:21 PM, Bruce Gray wrote: On Dec 19, 2020, at 6:40 PM, ToddAndMargo via perl6-users wrote: Hi All, I have so far: class BadMath { has Int $.A; has Int $.B; method BadAdd() { my $Clinker = (-5..5).rand.truncate; return $!A + $!B

Re: I need help setting up a method

2020-12-19 Thread Bruce Gray
> On Dec 19, 2020, at 6:40 PM, ToddAndMargo via perl6-users > wrote: > > Hi All, > > I have so far: > > > class BadMath { > has Int $.A; > has Int $.B; > > method BadAdd() { > my $Clinker = (-5..5).rand.trunca

I need help setting up a method

2020-12-19 Thread ToddAndMargo via perl6-users
Hi All, I have so far: class BadMath { has Int $.A; has Int $.B; method BadAdd() { my $Clinker = (-5..5).rand.truncate; return $!A + $!B + $Clinker; } } my $TwoPlusTwo = BadMath.new( A => 2, B=> 2 ); print $TwoPlusTwo.BadAdd

Re: I need help finding a class for a method

2020-06-08 Thread ToddAndMargo via perl6-users
On 2020-06-08 16:08, Peter Pentchev wrote: Yes, I know. Git does take some getting used to; any program does. With time, you may find it useful. The things you do all the time, you remember. Since I am IT support to small business and do EVERYTHING, except the wiring, which I have guys that

Re: I need help finding a class for a method

2020-06-08 Thread Peter Pentchev
On Mon, Jun 08, 2020 at 04:01:41PM -0700, ToddAndMargo via perl6-users wrote: > On 2020-06-08 15:35, Peter Pentchev wrote: > > On Mon, Jun 08, 2020 at 03:15:36PM -0700, ToddAndMargo via perl6-users > > wrote: > > > On 2020-06-08 15:02, Peter Pentchev wrote: > > > > On Mon, Jun 08, 2020 at

Re: I need help finding a class for a method

2020-06-08 Thread ToddAndMargo via perl6-users
On 2020-06-08 15:35, Peter Pentchev wrote: On Mon, Jun 08, 2020 at 03:15:36PM -0700, ToddAndMargo via perl6-users wrote: On 2020-06-08 15:02, Peter Pentchev wrote: On Mon, Jun 08, 2020 at 02:57:58PM -0700, ToddAndMargo via perl6-users wrote: On 2020-06-08 14:54, Peter Pentchev wrote: On Mon,

Re: I need help finding a class for a method

2020-06-08 Thread Peter Pentchev
On Mon, Jun 08, 2020 at 03:15:36PM -0700, ToddAndMargo via perl6-users wrote: > On 2020-06-08 15:02, Peter Pentchev wrote: > > On Mon, Jun 08, 2020 at 02:57:58PM -0700, ToddAndMargo via perl6-users > > wrote: > > > On 2020-06-08 14:54, Peter Pentchev wrote: > > > > On Mon, Jun 08, 2020 at

Re: I need help finding a class for a method

2020-06-08 Thread ToddAndMargo via perl6-users
On 2020-06-08 15:02, Peter Pentchev wrote: On Mon, Jun 08, 2020 at 02:57:58PM -0700, ToddAndMargo via perl6-users wrote: On 2020-06-08 14:54, Peter Pentchev wrote: On Mon, Jun 08, 2020 at 02:48:48PM -0700, ToddAndMargo via perl6-users wrote: On 2020-06-08 13:55, Richard Hainsworth wrote:

Re: I need help finding a class for a method

2020-06-08 Thread Peter Pentchev
On Mon, Jun 08, 2020 at 02:57:58PM -0700, ToddAndMargo via perl6-users wrote: > On 2020-06-08 14:54, Peter Pentchev wrote: > > On Mon, Jun 08, 2020 at 02:48:48PM -0700, ToddAndMargo via perl6-users > > wrote: > > > On 2020-06-08 13:55, Richard Hainsworth wrote: > > [snip] > > > > The opening

Re: I need help finding a class for a method

2020-06-08 Thread ToddAndMargo via perl6-users
On 2020-06-08 14:57, ToddAndMargo via perl6-users wrote: On 2020-06-08 14:54, Peter Pentchev wrote: On Mon, Jun 08, 2020 at 02:48:48PM -0700, ToddAndMargo via perl6-users wrote: On 2020-06-08 13:55, Richard Hainsworth wrote: [snip] The opening bracket for class Informing is on (or about) line

Re: I need help finding a class for a method

2020-06-08 Thread ToddAndMargo via perl6-users
On 2020-06-08 14:54, Peter Pentchev wrote: On Mon, Jun 08, 2020 at 02:48:48PM -0700, ToddAndMargo via perl6-users wrote: On 2020-06-08 13:55, Richard Hainsworth wrote: [snip] The opening bracket for class Informing is on (or about) line 10 and the closing in at about line 630, with a comment

Re: I need help finding a class for a method

2020-06-08 Thread Peter Pentchev
On Mon, Jun 08, 2020 at 02:48:48PM -0700, ToddAndMargo via perl6-users wrote: > On 2020-06-08 13:55, Richard Hainsworth wrote: [snip] > > The opening bracket for class Informing is on (or about) line 10 and the > > closing in at about line 630, with a comment 'end of Informing class' > > > >

Re: question about the multi in method

2020-06-08 Thread ToddAndMargo via perl6-users
On 2020-06-08 14:43, Mark Devine wrote: Peter, I applaud your excellent assistance with Raku. Et. al. (you know the names)... Outstanding community! Mark He is a force of nature, as are many on this list.

Re: I need help finding a class for a method

2020-06-08 Thread ToddAndMargo via perl6-users
On 2020-06-08 13:55, Richard Hainsworth wrote: Todd, The 'unit' in line 3 means something like 'this whole file is the Module' so there are no Begins/Ends/brackets. Poop. I spaced on that. I start all my moduels with 1: unit module ; The opening bracket for class Informing is on (or

Re: question about the multi in method

2020-06-08 Thread Peter Pentchev
 allowed to use. > > > > > > > > In Raku, if you develop a new type, for example say a quodion, and you > > > > want to 'add' quodions, then you CAN use + because it can be overloaded. > > > > It is defined as a multi. > > > > > >

RE: question about the multi in method

2020-06-08 Thread Mark Devine
Peter, I applaud your excellent assistance with Raku. Et. al. (you know the names)... Outstanding community! Mark -Original Message- From: Peter Pentchev Sent: Monday, June 8, 2020 17:13 To: perl6-us...@perl.org Subject: Re: question about the multi in method On Mon, Jun 08, 2020

Re: question about the multi in method

2020-06-08 Thread ToddAndMargo via perl6-users
most overused example 'needle' can be rewritten to take a quodion, which may yield a spectrum of results because that's what quodions are for. Since needle is defined as a 'multi', if you write a 'needle' method for quodions, the needle for strings STILL exists, and Raku will correctly call

Re: question about the multi in method

2020-06-08 Thread Peter Pentchev
evelop a new type, for example say a quodion, and you > > want to 'add' quodions, then you CAN use + because it can be overloaded. > > It is defined as a multi. > > > > Or in your most overused example 'needle' can be rewritten to take a > > quodion, which may yield

Re: I need help finding a class for a method

2020-06-08 Thread Richard Hainsworth
he module you mentioned are methods of the Informative::Informing class. You can check it by matching the '{' at the beginning of the class declaration with the corresponding '}'; method show() is inside the class. OTOH there's a "sub inform" in the "Informative" namespace whi

Re: I need help finding a class for a method

2020-06-08 Thread ToddAndMargo via perl6-users
entioned are methods of the Informative::Informing class. You can check it by matching the '{' at the beginning of the class declaration with the corresponding '}'; method show() is inside the class. OTOH there's a "sub inform" in the "Informative" namespace which is not inside a class

Re: question about the multi in method

2020-06-08 Thread ToddAndMargo
On 2020-06-08 08:05, Peter Pentchev wrote: On Mon, Jun 08, 2020 at 10:45:21AM +0100, Richard Hainsworth wrote: Ok Todd, let me have a go at this issue. Thank you, Richard, for your help. I apologize to Todd and to everyone on the list for my outburst in my last e-mail. G'luck, Peter Hi

Re: question about the multi in method

2020-06-08 Thread ToddAndMargo via perl6-users
because that's what quodions are for. Since needle is defined as a 'multi', if you write a 'needle' method for quodions, the needle for strings STILL exists, and Raku will correctly call the method you wrote for quodions if a quodion is implied, but call the default needle if a string (or any other

Re: question about the multi in method

2020-06-08 Thread Peter Pentchev
On Mon, Jun 08, 2020 at 10:45:21AM +0100, Richard Hainsworth wrote: > Ok Todd, let me have a go at this issue. Thank you, Richard, for your help. I apologize to Todd and to everyone on the list for my outburst in my last e-mail. G'luck, Peter -- Peter Pentchev r...@ringlet.net r...@debian.org

Re: I need help finding a class for a method

2020-06-08 Thread Fernando Santagata
ods in the module. > > I am confused. Methods are just subroutines which take an implicit first argument: the object they are operating on. All the methods in the module you mentioned are methods of the Informative::Informing class. You can check it by matching the '{' at the beginning of the cla

Re: I need help finding a class for a method

2020-06-08 Thread ToddAndMargo via perl6-users
On 2020-06-08 04:32, Fernando Santagata wrote: On Mon, Jun 8, 2020 at 1:20 PM ToddAndMargo via perl6-users mailto:perl6-us...@perl.org>> wrote: On 2020-06-08 03:38, Fernando Santagata wrote:  > …and line 3:  >  > unit module Informative;  > 3: unit module

Re: I need help finding a class for a method

2020-06-08 Thread Fernando Santagata
On Mon, Jun 8, 2020 at 1:20 PM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > On 2020-06-08 03:38, Fernando Santagata wrote: > > …and line 3: > > > > unit module Informative; > > > > > 3: unit module Informative; > > Does not look like a class to me. What am I missing? > It's

Re: I need help finding a class for a method

2020-06-08 Thread ToddAndMargo via perl6-users
er/lib/Informative.pm6 Line 144:     method show(     Str $str?,     Int :$timer,     Bool :$show-countdown     ) { where is the class that is linked to that method? Many thanks, -T On 2020-06-08 03:38, Fernando Santagata wrote: > …a

Re: I need help finding a class for a method

2020-06-08 Thread ToddAndMargo via perl6-users
>> Hi All, >> >> Over on >> >> https://github.com/finanalyst/p6-inform/blob/master/lib/Informative.pm6 >> >> Line 144: >> >> method show( >> Str $str?, >> Int :$timer, >> Bool

Re: I need help finding a class for a method

2020-06-08 Thread Fernando Santagata
finanalyst/p6-inform/blob/master/lib/Informative.pm6 > > Line 144: > > method show( > Str $str?, > Int :$timer, > Bool :$show-countdown > ) { > > where is the class that is linked to that method? > > Many thanks, > -T > > -- Fernando Santagata

Re: I need help finding a class for a method

2020-06-08 Thread Richard Hainsworth
Look at line 10 class Informing { On 08/06/2020 11:31, ToddAndMargo via perl6-users wrote: Hi All, Over on https://github.com/finanalyst/p6-inform/blob/master/lib/Informative.pm6 Line 144:     method show(     Str $str?,     Int :$timer,     Bool :$show

I need help finding a class for a method

2020-06-08 Thread ToddAndMargo via perl6-users
Hi All, Over on https://github.com/finanalyst/p6-inform/blob/master/lib/Informative.pm6 Line 144: method show( Str $str?, Int :$timer, Bool :$show-countdown ) { where is the class that is linked to that method? Many thanks, -T

Re: question about the multi in method

2020-06-08 Thread Richard Hainsworth
is defined as a 'multi', if you write a 'needle' method for quodions, the needle for strings STILL exists, and Raku will correctly call the method you wrote for quodions if a quodion is implied, but call the default needle if a string (or any other type) is used. Since you have developed

Re: question about the multi in method

2020-06-08 Thread Fernando Santagata
On Mon, Jun 8, 2020 at 10:15 AM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > On 2020-06-08 00:48, Fernando Santagata wrote: > > On Mon, Jun 8, 2020 at 9:12 AM ToddAndMargo via perl6-users > > mailto:perl6-us...@perl.org>> wrote: > > > > On 2020-06-07 22:39, Peter Pentchev wrote:

Re: question about the multi in method

2020-06-08 Thread Peter Pentchev
ameters? Was that not written in > > the documentation? Or that you may call .starts-with() with a $needle > > being Cool and not Str? Again, was that not written in the > > documentation? So what did you learn from going to Github that was not > > in the documentation?

Re: question about the multi in method

2020-06-08 Thread ToddAndMargo via perl6-users
On 2020-06-08 00:48, Fernando Santagata wrote: On Mon, Jun 8, 2020 at 9:12 AM ToddAndMargo via perl6-users mailto:perl6-us...@perl.org>> wrote: On 2020-06-07 22:39, Peter Pentchev wrote: I addressed this in my original e-mail: the documentation is currently: 1. a reference manual Targets

Re: question about the multi in method

2020-06-08 Thread Fernando Santagata
On Mon, Jun 8, 2020 at 9:12 AM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > On 2020-06-07 22:39, Peter Pentchev wrote: > > I addressed this in my original e-mail: the documentation is currently: > > 1. a reference manual > > Targets at what audience? > I think that that point

Re: question about the multi in method

2020-06-08 Thread ToddAndMargo via perl6-users
On 2020-06-07 22:39, Peter Pentchev wrote: I thought I explained that. The Rakudo developers are*never* finished with the development of some methods. Somebody*will* want to extend them in their own module. The Rakudo developers*want* to declare some methods as "multi" to allow the Rakudo

Re: question about the multi in method

2020-06-07 Thread Peter Pentchev
; > On Sun, Jun 07, 2020 at 09:04:45AM -0500, Brad Gilbert wrote: > > > > > On Sun, Jun 7, 2020 at 3:15 AM ToddAndMargo via perl6-users < > > > > > perl6-us...@perl.org> wrote: > > > > > > > > > > > Hi All,

Re: question about the multi in method

2020-06-07 Thread ToddAndMargo via perl6-users
rl6-us...@perl.org> wrote: Hi All, Dumb question: Does the "multi" in "multi method" mean there is more than one way to address a method? Or, are the all methods "multi methods". If not and the method is a multi, should not the documentation show all (more than

Re: question about the multi in method

2020-06-07 Thread Peter Pentchev
On Sun, Jun 7, 2020 at 3:15 AM ToddAndMargo via perl6-users < > > > > perl6-us...@perl.org> wrote: > > > > > > > > > Hi All, > > > > > > > > > > Dumb question: > > > > > > > > > > Does th

Re: question about the multi in method

2020-06-07 Thread Peter Pentchev
t; perl6-us...@perl.org> wrote: > > > > > > > Hi All, > > > > > > > > Dumb question: > > > > > > > > Does the "multi" in "multi method" mean there > > > > is more than one way to

Re: question about the multi in method

2020-06-07 Thread ToddAndMargo via perl6-users
On 2020-06-07 08:29, Veesh Goldman wrote: I imagine they called it cool because it, indeed, is cool. The Raku developers do have a sense of humor. Cool, needle, slurp, spurt: someone had a good laugh. :-)

Re: question about the multi in method

2020-06-07 Thread ToddAndMargo via perl6-users
On 2020-06-07 08:19, Peter Pentchev wrote: On Sun, Jun 07, 2020 at 09:04:45AM -0500, Brad Gilbert wrote: On Sun, Jun 7, 2020 at 3:15 AM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: Hi All, Dumb question: Does the "multi" in "multi method" mean

Re: question about the multi in method

2020-06-07 Thread Veesh Goldman
M ToddAndMargo via perl6-users < > > > perl6-us...@perl.org> wrote: > > > > > > > Hi All, > > > > > > > > Dumb question: > > > > > > > > Does the "multi" in "multi method

Re: question about the multi in method

2020-06-07 Thread Peter Pentchev
t; > > > > Dumb question: > > > > > > Does the "multi" in "multi method" mean there > > > is more than one way to address a method? > > > > > > Or, are the all methods "multi methods". > > > >

Re: question about the multi in method

2020-06-07 Thread Peter Pentchev
On Sun, Jun 07, 2020 at 09:04:45AM -0500, Brad Gilbert wrote: > On Sun, Jun 7, 2020 at 3:15 AM ToddAndMargo via perl6-users < > perl6-us...@perl.org> wrote: > > > Hi All, > > > > Dumb question: > > > > Does the "multi" in "multi met

Re: question about the multi in method

2020-06-07 Thread Brad Gilbert
There are four different types of a function. (both method and sub) - `multi` - `proto` - `only` - `anon` A `proto` function is mainly just to declare there will be multiple functions with same name. `multi` is short for "multiple", meaning more than one. `only` is the default

question about the multi in method

2020-06-07 Thread ToddAndMargo via perl6-users
Hi All, Dumb question: Does the "multi" in "multi method" mean there is more than one way to address a method? Or, are the all methods "multi methods". If not and the method is a multi, should not the documentation show all (more than one) the ways of addressin

Re: I do not understand method":"

2020-05-26 Thread ToddAndMargo via perl6-users
On 2020-05-25 14:00, Brad Gilbert wrote: In the following the 「:」 makes it so you don't need parenthesis You have created a monster! > my $s="a:c"; say $s.index: ":" 1 :-)

Re: I do not understand method":"

2020-05-25 Thread Brad Gilbert
Version <5 2 1 33 22>.sort( ).Version( ) Which sorts using the default sort. The result is a Seq. Then it tries to call a method named Version on that Seq. On Mon, May 25, 2020 at 4:41 PM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > >> On Mon, May 25,

Re: I do not understand method":"

2020-05-25 Thread ToddAndMargo via perl6-users
pace? 3) What does the `*` do? 4) Is the dot before Version mean something other than .Version being a method? Yours in confusion, -T On 2020-05-25 14:00, Brad Gilbert wrote: In the following the 「:」 makes it so you don't need parenthesis     (…).sort: …     (…).

Re: I do not understand method":"

2020-05-25 Thread Brad Gilbert
In the following the 「:」 makes it so you don't need parenthesis (…).sort: … (…).sort(…) The reason there needs to be a space is so it isn't confused for an adverb. 「*.Version」 is a method call turned into a lambda. Basically it creates a lambda where the only thing it does is call

I do not understand method":"

2020-05-25 Thread ToddAndMargo via perl6-users
getting the alpha, beta, and release candidate thing down, I do not understand: .sort: *.Version 1) What does the `:` do? 2) Why the space? 3) What does the `*` do? 4) Is the dot before Version mean something other than .Version being a method? Yours in confusion, -T

No such method 'prefix' for invocant of type 'Capture' when trying to patch a new library include path

2020-05-10 Thread Konrad Bucheli via perl6-users
cat foo.rakumod unit module foo; use Test; $ raku -I . -e "use foo" ===SORRY!=== Error while compiling -e ===SORRY!=== Error while compiling /home/kb/foo.rakumod (foo) No such method 'prefix' for invocant of type 'Capture' at /home/kb/foo.rakumod (foo):2 at -e:1 $ Interestingly

Re: Question about "colon syntax" for calling other methods on 'self' inside a method

2019-11-19 Thread Brad Gilbert
$ by itself is a an anonymous state variable. So these two lines would be exactly the same. $.foo (state $).foo A feature was added where $.foo would instead be used for public attributes. Since a public attribute just adds a method, it was allowed to use it to call any method. Which

Re: Question about "colon syntax" for calling other methods on 'self' inside a method

2019-11-18 Thread Raymond Dresens
Hello Vadim, Yary, Thanks for your feedback, I've filed an issue: https://github.com/rakudo/rakudo/issues/3306 Yary, about the dollar sign, The snippet of code in the issue shows that expression "$.attribute" inside a method 'just works' for accessing individual attributes

Re: Question about "colon syntax" for calling other methods on 'self' inside a method

2019-11-18 Thread Vadim Belman
I would say filing an issue might make sense in this case. Here is a related comment from Jonathan: https://github.com/rakudo/rakudo/issues/3222#issuecomment-539915286 – and it explicitly states that $. is a shortcut for method calling. Therefore, use of colon instead of braces should

Re: Question about "colon syntax" for calling other methods on 'self' inside a method

2019-11-18 Thread yary
o GitHub > > On Sat, Nov 16, 2019 at 5:29 AM Raymond Dresens > wrote: > >> Hello, >> >> I have a question related to the 'colon syntax' of Raku, which allows >> you to call methods without parenthesis like this: >> >> class Foo >> { >>

Re: Question about "colon syntax" for calling other methods on 'self' inside a method

2019-11-18 Thread yary
looks like a bug to me-file an issue on the rakudo GitHub On Sat, Nov 16, 2019 at 5:29 AM Raymond Dresens wrote: > Hello, > > I have a question related to the 'colon syntax' of Raku, which allows > you to call methods without parenthesis like this: > > class Foo >

Question about "colon syntax" for calling other methods on 'self' inside a method

2019-11-16 Thread Raymond Dresens
Hello, I have a question related to the 'colon syntax' of Raku, which allows you to call methods without parenthesis like this: class Foo { method print($x, $y) { say "bar: {$x}, {$y}" } } my $a = Foo.new; $a.p

RE: Wrap an attribute’s ^get_value method in TWEAK

2019-09-08 Thread Mark Devine
Easy for you to say... (haha) Nice! Many thanks. Mark From: Vadim Belman Sent: Sunday, September 8, 2019 21:32 To: Mark Devine Cc: perl6-users Subject: Re: Wrap an attribute’s ^get_value method in TWEAK Here is a quickly hacked together example: multi trait_mod: (Attribute:D

Re: Wrap an attribute’s ^get_value method in TWEAK

2019-09-08 Thread Vadim Belman
Here is a quickly hacked together example: multi trait_mod: (Attribute:D $a, :$xmlattr!) { my $mname = $a.name.substr(2); my = my method { say "ATTR($mname):", my \val = $a.get_value(self); val }; _name($mname); $a.package.^add_method($mname, ); } class Foo {

RE: Wrap an attribute’s ^get_value method in TWEAK

2019-09-08 Thread Mark Devine
intuition has expired. my role XML-attribute { has $attr; method get_value () { say 'in XML-attribute method get_value with ' ~ $.name; $attr; } method set_value ($) { say 'in XML-attribute method set_value with ' ~ $.name; $attr = $; } } multi sub

Re: Wrap an attribute’s ^get_value method in TWEAK

2019-09-08 Thread Vadim Belman
Hi Mark, get_value won't give you what you expect. It's use is narrowly limited to trait 'is handles' and method .perl. Besides, are you sure all of your attributes will be considered as belonging to XML? I mean, won't there be need for utility attributes serving exclusively internal needs

Wrap an attribute’s ^get_value method in TWEAK

2019-09-08 Thread Mark Devine
Perl6 Community, How do I properly wrap an attribute’s ^get_value method in TWEAK? If a condition exists, I’d like to wrap all (:local) attributes so that they can do some extra work. The module that I’m working on has classes/attributes for hundreds of fields in dozens of different, big XML

Re: so as a method: Is this expected or a bug?

2018-12-21 Thread Brad Gilbert
You got the order of operations wrong. Method calls happen before prefix operators These are identical +@a.so +(@a.so) @a.so.Numeric @a.Bool.Numeric +?@a As are these +«@a».so +«(@a».so) @a».so».Numeric @a».Bool».Numeric +«?«@a Postfix operators also

Re: so as a method: Is this expected or a bug?

2018-12-21 Thread Laurent Rosenfeld via perl6-users
Hi Richard, I don't think it's a bug. In: put +@a.so; the @a array is coerced into a Boolean value (True) by the so method, and the resulting Boolean value is then coerced into an integer by the + operator. Cheers, Laurent. Le ven. 21 déc. 2018 à 09:28, Richard Hainsworth a écrit

so as a method: Is this expected or a bug?

2018-12-21 Thread Richard Hainsworth
A snippet:     my @a = 1..10;     put +@a.so; # output 1     put so(+@a); # output True     put (+@a).so; # output True This caught me because I used +@s.so when I tried to do something like:     # in a class with 'has Bool $.pass;'     return unless ( $!pass = +@a.so );     # fails with a

Re: How to use sub/method 'dir'

2018-11-27 Thread Brad Gilbert
like you expect >>> is that it is passed strings. >> >> >> Thank you! >> I could have inferred that from the declaration of the 'test' argument here >> https://docs.perl6.org/routine/dir where the test is being done against '.' >> and '..', two strings: >>

Re: How to use sub/method 'dir'

2018-11-27 Thread Fernando Santagata
.org/routine/dir where the test is being done >>> against '.' and '..', two strings: >>> >>> subdir(Cool $path = '.', Mu :$test = none('.', '..')) >>>> method dir(IO::Path:D: Mu :$test = none('.', '..')) >>>> >>> >>> but I guess i

Re: How to use sub/method 'dir'

2018-11-26 Thread Trey Harris
> { .IO.d })` doesn't work like you expect >>> is that it is passed strings. >>> >> >> Thank you! >> I could have inferred that from the declaration of the 'test' argument >> here https://docs.perl6.org/routine/dir where the test is being done >> against '.' and '..'

Re: How to use sub/method 'dir'

2018-11-26 Thread Trey Harris
e inferred that from the declaration of the 'test' argument > here https://docs.perl6.org/routine/dir where the test is being done > against '.' and '..', two strings: > > subdir(Cool $path = '.', Mu :$test = none('.', '..')) >> method dir(IO::Path:D: Mu :$test = none('.', '..'))

Re: How to use sub/method 'dir'

2018-11-26 Thread Fernando Santagata
ere the test is being done against '.' and '..', two strings: subdir(Cool $path = '.', Mu :$test = none('.', '..')) > method dir(IO::Path:D: Mu :$test = none('.', '..')) > but I guess it's a long stretch. Maybe a note in the docs would be useful to others. > I would argue tha

Re: How to use sub/method 'dir'

2018-11-25 Thread Brad Gilbert
The reason `dir('a', test => { .IO.d })` doesn't work like you expect is that it is passed strings. > dir('a', test => {.say}); . c b .. ("a/.".IO "a/c".IO "a/b".IO "a/..".IO) So `.IO.d` is looking to see if the CWD directory had a directory of that name, not the `a`

Re: How to use sub/method 'dir'

2018-11-25 Thread Fernando Santagata
, Nov 25, 2018 at 1:52 AM Timo Paulssen wrote: > >> The dir method gives you entries in the directory you pass. If you don't >> pass a test it'll use the default test which is none(".", ".."), i.e. >> "anything except . and ..". >> >> I'm

Re: How to use sub/method 'dir'

2018-11-25 Thread Fernando Santagata
Here's output of 'a/b'.IO.d from the REPL: > 'a/b'.IO.d True On Sun, Nov 25, 2018 at 1:52 AM Timo Paulssen wrote: > The dir method gives you entries in the directory you pass. If you don't > pass a test it'll use the default test which is none(".", "..&qu

Re: How to use sub/method 'dir'

2018-11-24 Thread Timo Paulssen
The dir method gives you entries in the directory you pass. If you don't pass a test it'll use the default test which is none(".", ".."), i.e. "anything except . and ..". I'm not sure why using { .IO.d } as the test would not give you b, though. Can you check

How to use sub/method 'dir'

2018-11-24 Thread Fernando Santagata
Hello, I think that I don't understand how the 'test' argument of 'dir' works. I have a directory 'a', which contains a subdirectory 'b' and a file 'c'; I want to select only the subdirectories of 'a'. Using the REPL I tried to ask the content of the directory 'a': > my @dirs = dir('a')

Re: method vs multi method

2018-09-14 Thread ToddAndMargo
On 09/14/2018 04:33 PM, Ralph Mellor wrote:      multi method kv ... Use of `multi` means there *may* be more than one *declaration* using the same declared routine name (`kv` in this case). There usually *will* be more than one. (Otherwise, why was it declared `multi`?) The normal

Re: method vs multi method

2018-09-14 Thread Ralph Mellor
> multi method kv ... Use of `multi` means there *may* be more than one *declaration* using the same declared routine name (`kv` in this case). There usually *will* be more than one. (Otherwise, why was it declared `multi`?) The normal way to *use* a routine is to call it. If you decl

  1   2   3   4   5   6   7   8   9   10   >