Re: mixin syntax: does vs but

2018-06-12 Thread Elizabeth Mattijsen
> On 12 Jun 2018, at 09:06, Joseph Brenner wrote: > > I thought this would work to make a copy of @x but with the role > "LookInside" attached to it: > > my @y = @x but LookInside; > > But that didn't add the role to @y. E.g. > > say @y.^WHAT > > Would just report (Array), not

mixin syntax: does vs but

2018-06-12 Thread Joseph Brenner
I thought this would work to make a copy of @x but with the role "LookInside" attached to it: my @y = @x but LookInside; But that didn't add the role to @y. E.g. say @y.^WHAT Would just report (Array), not (Array+{LookInside}). I found that this would do what I was trying to do though:

Re: mixin syntax: does vs but

2018-06-12 Thread JJ Merelo
(also: ask questions in StackOverflow whenever possible :-) ) El mar., 12 jun. 2018 a las 9:09, JJ Merelo () escribió: > Use binding: > > my @x= <1 2 3>; my @y := @x but Iterable; say @y.^name; # OUTPUT: > «Array+{Iterable}␤» > > El mar., 12 jun. 2018 a las 9:06, Joseph Brenner () > escribió: >

Re: mixin syntax: does vs but

2018-06-12 Thread JJ Merelo
Use binding: my @x= <1 2 3>; my @y := @x but Iterable; say @y.^name; # OUTPUT: «Array+{Iterable}␤» El mar., 12 jun. 2018 a las 9:06, Joseph Brenner () escribió: > I thought this would work to make a copy of @x but with the role > "LookInside" attached to it: > >my @y = @x but LookInside; >

Re: mixin syntax: does vs but

2018-06-12 Thread JJ Merelo
Hi, El mar., 12 jun. 2018 a las 20:35, Brad Gilbert () escribió: > On Tue, Jun 12, 2018 at 12:55 PM, Joseph Brenner > wrote: > > Thanks, both your suggestion and JJ Merelo's work, but I think I like > > yours for readability: > > > > # # using binding, suggested by JJ Merelo > > # my @y :=

Re: mixin syntax: does vs but

2018-06-12 Thread Brad Gilbert
On Tue, Jun 12, 2018 at 2:16 PM, JJ Merelo wrote: > This is what the documentation says: https://docs.perl6.org/syntax/WHAT > You can override it, but we'll pay no attention anyway, basically. So you > can't achieve it otherwise, I guess. It is easy to achieve. sub user-made-what ( ::Type )

Re: need second pair of eyes

2018-06-12 Thread Brandon Allbery
I don't expect if $Line ~~ | "wine-patched/archive/staging-/" && ".tar.gz " | does what you expect. In fact, I'm not sure what you expect there; those |-s are going to be taken as slip prefix operators, and the second one indeed will gobble the following block as the expression it

Re: need second pair of eyes

2018-06-12 Thread Brandon Allbery
No, you are stuck with $foo ~~ m|xxx| && $foo ~~ m|yyy| or $foo ~~ m|xxx .* yyy| (the latter assuming they always happen in that order; if they don't, you can only use the first.) On Tue, Jun 12, 2018 at 8:25 PM ToddAndMargo wrote: > On 06/12/2018 05:19 PM, Brandon Allbery wrote: >

Re: need second pair of eyes

2018-06-12 Thread ToddAndMargo
On 06/12/2018 03:41 PM, ToddAndMargo wrote: Hi Alk, What am I dong wrong here? $ p6 'my $Line = "wine-patched/archive/staging-/x.tar.gz"; if $Line ~~ | "wine-patched/archive/staging-/"   &&   ".tar.gz " |  {say "yes"} else {say "no};' ===SORRY!=== Expression needs parens to avoid

Re: need second pair of eyes

2018-06-12 Thread Brandon Allbery
You're trying to do it all in one regex. That doesn't work; what you tried will attempt to test that the same *substring* of the regex matches both of those, which is not possible because they're both literal. So any given substring has to be one, the other, or neither, it can't simultaneously be

Re: need second pair of eyes

2018-06-12 Thread Timo Paulssen
My recommendations:     if $line.contains(all("wine-patched/archive/staging-/", ".tar.gz")){ }     # if the path has to be at the beginning and the extension at the end,     # which your original regex doesn't require, but it's probably right     if

How do I remove leading zeros?

2018-06-12 Thread ToddAndMargo
Hi All, I am trying to turn 01.02.03 into 1.2.3 What am I doing wrong, this time? $ p6 'my $x="01.02.03"; $x ~~ s:global/"0"(\d)/ $0 /; say "$x"' 1 . 2 . 3 Many thanks, -T -- ~ When we ask for advice, we are

Re: need second pair of eyes

2018-06-12 Thread ToddAndMargo
On 06/12/2018 05:19 PM, Brandon Allbery wrote: You're trying to do it all in one regex. That doesn't work; what you tried will attempt to test that the same *substring* of the regex matches both of those, which is not possible because they're both literal. So any given substring has to be one,

Re: mixin syntax: does vs but

2018-06-12 Thread Timo Paulssen
You can override WHAT with a method, you just have to use a syntax that's not literally .WHAT, like this:     class Test { method WHAT() { say "i'm here" } }; Test."WHAT"();     # → i'm here

Re: stackoverflow vs the world (and perl6-users)

2018-06-12 Thread Richard Hainsworth
Here's my experience: when I'm learning a new language or software, eg., php or css or recently GRAV CMS, and I have a problem, my first action is google: . I'm sure everyone does something like this. Whenever I see a response that includes Stackoverflow, I look there first because for over

another checker bug to fix

2018-06-12 Thread ToddAndMargo
Hi All, Another "perl6 -c" bug to fix my $CleanOldRev = $OldRev ~~ s:global/ "-|_|:|u" / "."; $CleanOldRev ~=".0.0.0.0.0.0.0.0.0.0"; ===SORRY!=== Error while compiling /home/linuxutil/GetUpdates.pl6 Unsupported use of ${Title}; in Perl 6 please use {$Title} at

Re: need second pair of eyes

2018-06-12 Thread Brandon Allbery
Same as in perl 5: m ... m|xxx| On Tue, Jun 12, 2018 at 7:35 PM ToddAndMargo wrote: > On 06/12/2018 03:41 PM, ToddAndMargo wrote: > > Hi Alk, > > > > What am I dong wrong here? > > > > > > $ p6 'my $Line = "wine-patched/archive/staging-/x.tar.gz"; if $Line > > ~~ |

Re: need second pair of eyes

2018-06-12 Thread ToddAndMargo
On 06/12/2018 05:26 PM, Brandon Allbery wrote: No, you are stuck with     $foo ~~ m|xxx| && $foo ~~ m|yyy| or     $foo ~~ m|xxx .* yyy| Ah cool. And it insures that they are "in a row" now anywhere in the string, as with the double "if" $ p6 'my $Line =

Re: need second pair of eyes

2018-06-12 Thread ToddAndMargo
On 06/12/2018 03:46 PM, Brandon Allbery wrote: if $Line~~ | "wine-patched/archive/staging-/"   &&   ".tar.gz " | If wine-patched/archive/staging-/ AND .tar.gz both exist in $Line, then TRUE how do I clean this up?

Re: How do I remove leading zeros?

2018-06-12 Thread Norman Gaywood
On Wed, 13 Jun 2018 at 14:57, ToddAndMargo wrote: > I am trying to turn > > 01.02.03 > > into > > 1.2.3 > > What am I doing wrong, this time? > > $ p6 'my $x="01.02.03"; $x ~~ s:global/"0"(\d)/ $0 /; say "$x"' > 1 . 2 . 3 > > The second part of the s/// operator is a string (spaces

Re: need second pair of eyes

2018-06-12 Thread ToddAndMargo
> > On Tue, Jun 12, 2018 at 7:35 PM ToddAndMargo > wrote: > > On 06/12/2018 03:41 PM, ToddAndMargo wrote: > > Hi Alk, > > > > What am I dong wrong here? > > > > > > $ p6 'my $Line = "wine-patched/archive/staging-/x.tar.gz"; if >

need second pair of eyes

2018-06-12 Thread ToddAndMargo
Hi Alk, What am I dong wrong here? $ p6 'my $Line = "wine-patched/archive/staging-/x.tar.gz"; if $Line ~~ | "wine-patched/archive/staging-/" && ".tar.gz " | {say "yes"} else {say "no};' ===SORRY!=== Expression needs parens to avoid gobbling block at -e:1 --> ging-/" &&

Re: need second pair of eyes

2018-06-12 Thread ToddAndMargo
On 06/12/2018 05:47 PM, Timo Paulssen wrote: My recommendations:     if $line.contains(all("wine-patched/archive/staging-/", ".tar.gz")){ }     # if the path has to be at the beginning and the extension at the end,     # which your original regex doesn't require, but it's probably right    

Re: How do I remove leading zeros?

2018-06-12 Thread ToddAndMargo
On 06/12/2018 09:56 PM, ToddAndMargo wrote: Hi All, I am trying to turn     01.02.03 into     1.2.3 What am I doing wrong, this time? $ p6 'my $x="01.02.03"; $x ~~ s:global/"0"(\d)/ $0 /; say "$x"'  1 . 2 . 3 Many thanks, -T Got it: $ p6 'my $x = "01.0.3.06.10"; say

Re: checker bug to fix

2018-06-12 Thread ToddAndMargo
On 06/12/2018 03:04 PM, ToddAndMargo wrote: Hi All, perl6 -c $Line ~~ m| "\/\"\>" (.*?) "\" ||; my $Rev = $1; produces Variable '$Rev' is not declared The actual error is too many pipe signs at the end of the first line. Many thanks, -T This would help. Sorry. $ perl6 -v This is

checker bug to fix

2018-06-12 Thread ToddAndMargo
Hi All, perl6 -c $Line ~~ m| "\/\"\>" (.*?) "\" ||; my $Rev = $1; produces Variable '$Rev' is not declared The actual error is too many pipe signs at the end of the first line. Many thanks, -T

Re: mixin syntax: does vs but

2018-06-12 Thread Brad Gilbert
On Tue, Jun 12, 2018 at 12:55 PM, Joseph Brenner wrote: > Thanks, both your suggestion and JJ Merelo's work, but I think I like > yours for readability: > > # # using binding, suggested by JJ Merelo > # my @y := @x but LookInside; > > # suggested by Elizabeth Mattijsen l...@dijkmat.nl >

Re: mixin syntax: does vs but

2018-06-12 Thread JJ Merelo
This is what the documentation says: https://docs.perl6.org/syntax/WHAT You can override it, but we'll pay no attention anyway, basically. So you can't achieve it otherwise, I guess. El mar., 12 jun. 2018 a las 21:14, JJ Merelo () escribió: > > > El mar., 12 jun. 2018 a las 21:11, Brandon

Re: checker bug to fix

2018-06-12 Thread ToddAndMargo
On 06/12/2018 03:04 PM, ToddAndMargo wrote: $Line ~~ m| "\/\"\>" (.*?) "\" ||; There is actually two errors: 1 too many "|" at the end of the line 2) "\" should be "/". The "my $Rev" was caused by escaping the quote, resulting in the weird error message to be fixed

stackoverflow vs the world (and perl6-users)

2018-06-12 Thread Joseph Brenner
Attention conservation: it's unlikely I'm going to say something interesting you haven't thought of already. A side-discussion that came up here: should you ask questions here, or at stackoverflow (or both here *and* at stackoverflow). I understand the argument that it's better to talk about

Re: stackoverflow vs the world (and perl6-users)

2018-06-12 Thread The Sidhekin
On Tue, Jun 12, 2018 at 9:18 PM, Brad Gilbert wrote: > On Tue, Jun 12, 2018 at 1:19 PM, Joseph Brenner wrote: > > Attention conservation: it's unlikely I'm going to say something > > interesting you haven't thought of already. > > > > A side-discussion that came up here: should you ask

Re: stackoverflow vs the world (and perl6-users)

2018-06-12 Thread Brad Gilbert
On Tue, Jun 12, 2018 at 3:57 PM, Brandon Allbery wrote: > I replied to this one in private, but I want to make a point in public as > well. > > On Tue, Jun 12, 2018 at 4:24 PM Brad Gilbert wrote: >> >> The barrier is not with Stack Overflow. (←What I obviously meant) >> The barrier is within

Re: mixin syntax: does vs but

2018-06-12 Thread JJ Merelo
El mar., 12 jun. 2018 a las 21:01, Brandon Allbery () escribió: > .WHAT is a "macro"/shorthand, which is why it's uppercase. There's a > metamodel (the real meaning of the ^) version of it as well. > Right. From here: https://docs.perl6.org/language/operators#postfix_.^ ^method calls method

Re: stackoverflow vs the world (and perl6-users)

2018-06-12 Thread Brad Gilbert
On Tue, Jun 12, 2018 at 2:29 PM, The Sidhekin wrote: > > > On Tue, Jun 12, 2018 at 9:18 PM, Brad Gilbert wrote: >> >> On Tue, Jun 12, 2018 at 1:19 PM, Joseph Brenner wrote: >> > Attention conservation: it's unlikely I'm going to say something >> > interesting you haven't thought of already. >>

Re: mixin syntax: does vs but

2018-06-12 Thread JJ Merelo
Ah, OK, you didn't mean override WHAT itself, but get an ersatz what in some other way. Got it. Thanks. El mar., 12 jun. 2018 a las 21:32, Brad Gilbert () escribió: > On Tue, Jun 12, 2018 at 2:16 PM, JJ Merelo wrote: > > This is what the documentation says: https://docs.perl6.org/syntax/WHAT >

Re: stackoverflow vs the world (and perl6-users)

2018-06-12 Thread JJ Merelo
As I said, all and any reason to not post in StackOverflow are valid. Just add a few points here El mar., 12 jun. 2018 a las 21:19, Brad Gilbert () escribió: > Stack Overflow is from Fog Creek Software. > See https://stackoverflow.com/company > > They also regularly provide bulk downloads of all

Re: stackoverflow vs the world (and perl6-users)

2018-06-12 Thread Brandon Allbery
I replied to this one in private, but I want to make a point in public as well. On Tue, Jun 12, 2018 at 4:24 PM Brad Gilbert wrote: > The barrier is not with Stack Overflow. (←What I obviously meant) > The barrier is within you. > There's an insidious assumption hidden in here: that "the

Re: stackoverflow vs the world (and perl6-users)

2018-06-12 Thread Brandon Allbery
I'm going to stay out of this one, except to the point that my problem with stackoverflow is none of these. It's more fundamental than that. And it's not something that can be "fixed" on my side. (Suffice it that there might be a Nobel Prize in medicine for someone who figures out how to do that.)

Re: stackoverflow vs the world (and perl6-users)

2018-06-12 Thread Brad Gilbert
On Tue, Jun 12, 2018 at 2:42 PM, Brandon Allbery wrote: > On Tue, Jun 12, 2018 at 3:38 PM Brad Gilbert wrote: >> >> > The barrier is non-existent. >> >> I have only ever heard about speculated and imagined barriers. > > > This is not proof that such barriers don't exist. I hit the magic 2

Re: stackoverflow vs the world (and perl6-users)

2018-06-12 Thread Joseph Brenner
Right, that's still another issue: it really does invariably come off as rude if you camp out at one discussion site and try to redirect the traffic to your own favorite one. But then, JJ Merelo (and Elizabeth Mattijsen) really aren't even very bad offenders, as these things go. The fall-back

Re: stackoverflow vs the world (and perl6-users)

2018-06-12 Thread JJ Merelo
Hi El mar., 12 jun. 2018 a las 20:33, Joseph Brenner () escribió: > Right, that's still another issue: it really does invariably come off > as rude if you camp out at one discussion site and try to redirect > the traffic to your own favorite one. > I think that by now it's quite clear that

Re: mixin syntax: does vs but

2018-06-12 Thread Joseph Brenner
>> say @y.^WHAT > If you want to print the name use `.^name`. > If you want the type object for more advanced usages use `.WHAT`. Sorry, typo on my part. Though that raises another syntactic oddity I might whine about: perl6 code examples frequently use ".WHAT". I was interested in getting a

Re: mixin syntax: does vs but

2018-06-12 Thread Brandon Allbery
I should clarify this, but I'm not recalling full details at the moment which is why I didn't originally. Perl uses a metaobject protocol (MOP, which you'll see in various places in the docs). The "macro" to access the metaobject is the .HOW pseudo-method. If you do this for a normal class or

Re: mixin syntax: does vs but

2018-06-12 Thread JJ Merelo
El mar., 12 jun. 2018 a las 21:11, Brandon Allbery () escribió: > I should clarify this, but I'm not recalling full details at the moment > which is why I didn't originally. > > Perl uses a metaobject protocol (MOP, which you'll see in various places > in the docs). The "macro" to access the

Re: stackoverflow vs the world (and perl6-users)

2018-06-12 Thread Brandon Allbery
On Tue, Jun 12, 2018 at 3:38 PM Brad Gilbert wrote: > > The barrier is non-existent. > > I have only ever heard about speculated and imagined barriers. > This is not proof that such barriers don't exist. I hit the magic 2 mark and lasted less than a week afterward because the rules suddenly

Re: mixin syntax: does vs but

2018-06-12 Thread Brandon Allbery
.WHAT is a "macro"/shorthand, which is why it's uppercase. There's a metamodel (the real meaning of the ^) version of it as well. On Tue, Jun 12, 2018 at 2:59 PM Joseph Brenner wrote: > >> say @y.^WHAT > > > If you want to print the name use `.^name`. > > > If you want the type object for more

Re: stackoverflow vs the world (and perl6-users)

2018-06-12 Thread Brad Gilbert
On Tue, Jun 12, 2018 at 1:19 PM, Joseph Brenner wrote: > Attention conservation: it's unlikely I'm going to say something > interesting you haven't thought of already. > > A side-discussion that came up here: should you ask questions here, or > at stackoverflow (or both here *and* at

Re: mixin syntax: does vs but

2018-06-12 Thread Joseph Brenner
> Use binding: > > my @x= <1 2 3>; my @y := @x but Iterable; say @y.^name; # OUTPUT: > «Array+{Iterable}␤» Hm... the docs on objects has this example: https://docs.perl6.org/language/objects role R { method Str() {'hidden!'} }; my $i = 2 but R; sub f(\bound){ put bound }; f($i); #

Re: mixin syntax: does vs but

2018-06-12 Thread JJ Merelo
El mar., 12 jun. 2018 a las 19:07, Brandon Allbery () escribió: > That was not "also", that was "this is the right way". "Ask questions in > StackOverflow whenever possible" does not leave room for "this is also a > good venue", it asserts that there is one proper venue and others are >

Re: mixin syntax: does vs but

2018-06-12 Thread Joseph Brenner
Thanks, both your suggestion and JJ Merelo's work, but I think I like yours for readability: # # using binding, suggested by JJ Merelo # my @y := @x but LookInside; # suggested by Elizabeth Mattijsen l...@dijkmat.nl my @y does LookInside = @x; I actually found the use of "but" in the

Re: mixin syntax: does vs but

2018-06-12 Thread JJ Merelo
I have added this to the documentation: https://github.com/perl6/doc/commit/ddd101b089 I'll add also Liz's example to make it even clearer. Or maybe a link if it does not belong in that section. I'll see what's best. JJ

Re: mixin syntax: does vs but

2018-06-12 Thread JJ Merelo
Please check this https://github.com/perl6/doc/commit/f6df30a8fc It's going to be soon in the docs (they are updated every 5 minutes if there are changes), however a general discussion of when to use "but" and when to use "does" is still missing. I'm working towards it in this page

Re: mixin syntax: does vs but

2018-06-12 Thread Brandon Allbery
Smileys do not change "use … whenever possible". It;s still asserting there is one correct way to contribute. On Tue, Jun 12, 2018 at 1:07 PM Curt Tilmes wrote: > > On Tue, Jun 12, 2018 at 12:56 PM Brandon Allbery > wrote: > >> Which doesn't change the fact that there's what amounts to an >>

Re: mixin syntax: does vs but

2018-06-12 Thread Brandon Allbery
You really do want to be exclusionary, don't you? yada yada stackoverflow is the one truth yada yada. Enough. On Tue, Jun 12, 2018 at 3:12 AM JJ Merelo wrote: > (also: ask questions in StackOverflow whenever possible :-) ) > > El mar., 12 jun. 2018 a las 9:09, JJ Merelo () > escribió: > >>

Re: mixin syntax: does vs but

2018-06-12 Thread JJ Merelo
El mar., 12 jun. 2018 a las 18:34, Brandon Allbery () escribió: > You really do want to be exclusionary, don't you? > > yada yada stackoverflow is the one truth yada yada. > Well, it really helps newcomers to find answers to their problems. It's well indexed, and it also raises visibility of the

Re: mixin syntax: does vs but

2018-06-12 Thread Brandon Allbery
Which doesn't change the fact that there's what amounts to an accessibility issue. Do you *really* want to tell some percentage of people that they must be willing to use the One True Web Site, or else go away because they're not wanted hereabouts? Because insisting all the time that "(also: ask

Re: mixin syntax: does vs but

2018-06-12 Thread JJ Merelo
Hi El mar., 12 jun. 2018 a las 18:56, Brandon Allbery () escribió: > Which doesn't change the fact that there's what amounts to an > accessibility issue. > > Do you *really* want to tell some percentage of people that they must be > willing to use the One True Web Site, or else go away because

Re: mixin syntax: does vs but

2018-06-12 Thread Brandon Allbery
That was not "also", that was "this is the right way". "Ask questions in StackOverflow whenever possible" does not leave room for "this is also a good venue", it asserts that there is one proper venue and others are discouraged. It asserts that, for people who have difficulty using StackOverflow

Re: mixin syntax: does vs but

2018-06-12 Thread Curt Tilmes
On Tue, Jun 12, 2018 at 12:56 PM Brandon Allbery wrote: > Which doesn't change the fact that there's what amounts to an > accessibility issue. > > Do you *really* want to tell some percentage of people that they must be > willing to use the One True Web Site, or else go away because they're not