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:

   my @y = @x;
   @y does LookInside;

I didn't think there would be any difference between the two
though.  What am I not getting?

The full code looks like this:

trial_introspect.pl6:

  use v6;
  use Trial::Introspect;
  my @x = ;
  my @y = @x;
  @y does LookInside;
  say "Methods: ";
  say @y.methodical_methods;


.../Trial/Introspect.pm6:

  role LookInside {
method methodical_methods {
  self.^methods.map({ .gist }).sort.unique.map({ "$_\n" }).grep({
! /^Method/ });
}
  }


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ó:
>
>> 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:
>>
>>my @y = @x;
>>@y does LookInside;
>>
>> I didn't think there would be any difference between the two
>> though.  What am I not getting?
>>
>> The full code looks like this:
>>
>> trial_introspect.pl6:
>>
>>   use v6;
>>   use Trial::Introspect;
>>   my @x = ;
>>   my @y = @x;
>>   @y does LookInside;
>>   say "Methods: ";
>>   say @y.methodical_methods;
>>
>>
>> .../Trial/Introspect.pm6:
>>
>>   role LookInside {
>> method methodical_methods {
>>   self.^methods.map({ .gist }).sort.unique.map({ "$_\n" }).grep({
>> ! /^Method/ });
>> }
>>   }
>>
>
>
> --
> JJ
>


-- 
JJ


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;
>
> 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:
>
>my @y = @x;
>@y does LookInside;
>
> I didn't think there would be any difference between the two
> though.  What am I not getting?
>
> The full code looks like this:
>
> trial_introspect.pl6:
>
>   use v6;
>   use Trial::Introspect;
>   my @x = ;
>   my @y = @x;
>   @y does LookInside;
>   say "Methods: ";
>   say @y.methodical_methods;
>
>
> .../Trial/Introspect.pm6:
>
>   role LookInside {
> method methodical_methods {
>   self.^methods.map({ .gist }).sort.unique.map({ "$_\n" }).grep({
> ! /^Method/ });
> }
>   }
>


-- 
JJ


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 (Array+{LookInside}).

What you’re doing here, is assigning the elements of an Array but Lookinside to 
a normal Array.  The elements of the Array do not have any roles mixed in, so 
you wind up with a normal Array with normal elements in them.  Perhaps you 
meant:

my @y does LookInside = @x;

Here you create an Array @y with the role LookInside mixed in, and *then* 
assign the values from @x.



Also, what JJ Merelo said: StackOverflow is your friend  :-)



Liz

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ó:
>
>> 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;
>>>
>>> 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:
>>>
>>>my @y = @x;
>>>@y does LookInside;
>>>
>>> I didn't think there would be any difference between the two
>>> though.  What am I not getting?
>>>
>>> The full code looks like this:
>>>
>>> trial_introspect.pl6:
>>>
>>>   use v6;
>>>   use Trial::Introspect;
>>>   my @x = ;
>>>   my @y = @x;
>>>   @y does LookInside;
>>>   say "Methods: ";
>>>   say @y.methodical_methods;
>>>
>>>
>>> .../Trial/Introspect.pm6:
>>>
>>>   role LookInside {
>>> method methodical_methods {
>>>   self.^methods.map({ .gist }).sort.unique.map({ "$_\n" }).grep({
>>> ! /^Method/ });
>>> }
>>>   }
>>>
>>
>>
>> --
>> JJ
>>
>
>
> --
> JJ
>


-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


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 Perl6 language.

Cheers

JJ


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
questions in StackOverflow whenever possible :-) )" is doing exactly that.

On Tue, Jun 12, 2018 at 12:51 PM JJ Merelo  wrote:

>
>
> 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 Perl6 language.
>
> Cheers
>
> JJ
>
>

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


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 they're not
> wanted hereabouts? Because insisting all the time that "(also: ask
> questions in StackOverflow whenever possible :-) )" is doing exactly that.
>


Sorry, I don't understand what you mean here. We're very happy with
questions here, and I (and everyone else) answer them whenever I can. We
ask people to *also* post them in StackOverflow if they have an account,
and want, and have the time to do so, because I personally think it helps
expand Perl6's community. It's OK if they don't. I posted the rationale
after that here
http://blogs.perl.org/users/jj_merelo/2018/04/stackoverflow-that.html I'm
sorry if it sounds like kicking people out of here, because that wasn't
really the intention.

JJ


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 for
whatever reason, *they do not belong here*.

On Tue, Jun 12, 2018 at 1:01 PM JJ Merelo  wrote:

> 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 they're not
>> wanted hereabouts? Because insisting all the time that "(also: ask
>> questions in StackOverflow whenever possible :-) )" is doing exactly that.
>>
>
>
> Sorry, I don't understand what you mean here. We're very happy with
> questions here, and I (and everyone else) answer them whenever I can. We
> ask people to *also* post them in StackOverflow if they have an account,
> and want, and have the time to do so, because I personally think it helps
> expand Perl6's community. It's OK if they don't. I posted the rationale
> after that here
> http://blogs.perl.org/users/jj_merelo/2018/04/stackoverflow-that.html I'm
> sorry if it sounds like kicking people out of here, because that wasn't
> really the intention.
>
> JJ
>


-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


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
> wanted hereabouts? Because insisting all the time that "(also: ask
> questions in StackOverflow whenever possible :-) )" is doing exactly that.
>
> On Tue, Jun 12, 2018 at 12:51 PM JJ Merelo  wrote:
>
>>
>> Well, it really helps newcomers to find answers to their problems. It's
>> well indexed, and it also raises visibility of the Perl6 language.
>>
>
"must be willing", "insisting", etc. is a very different type of approach
from the gentle "whenever possible" with a smiley.

No one is "insisting" or telling people they aren't wanted hereabouts.

Use StackOverflow if possible (for the reasons expressed) If not (for
whatever reason, we won't pry), use perl6-users, that's ok too.


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
>> 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
>> questions in StackOverflow whenever possible :-) )" is doing exactly that.
>>
>> On Tue, Jun 12, 2018 at 12:51 PM JJ Merelo  wrote:
>>
>>>
>>> Well, it really helps newcomers to find answers to their problems. It's
>>> well indexed, and it also raises visibility of the Perl6 language.
>>>
>>
> "must be willing", "insisting", etc. is a very different type of approach
> from the gentle "whenever possible" with a smiley.
>
> No one is "insisting" or telling people they aren't wanted hereabouts.
>
> Use StackOverflow if possible (for the reasons expressed) If not (for
> whatever reason, we won't pry), use perl6-users, that's ok too.
>
>

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


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); # OUTPUT: «hidden!␤»

So, my mistake was thinking the form of that second line would work
with array variables?

Looking up "binding" in the docs, there's this material:

https://docs.perl6.org/language/list

  By default, when you assign a List to an @-sigiled variable, you
create an Array. Those are described below. If instead you want to
refer directly to a List object using an @-sigiled variable, you can
use binding with := instead.

 my @a := 1, 2, 3;

  One of the ways @-sigiled variables act like lists is by always
supporting positional subscripting. Anything bound to a @-sigiled
value must support the Positional role which guarantees that this is
going to fail:

 my @a := 1; # Type check failed in binding; expected Positional but got Int

And my first reaction to all this is "Seriously?!".  There are
multiple different things here that feel like syntactic glitches, and
you need to tell me about the Positional role now to have any hope of
convincing me this one makes sense on some level?

(One reason you don't want me on stackoverflow is that I'm a whiner
who is not likely to whole-heartedly promote the cause...)



On Tue, Jun 12, 2018 at 12:09 AM, JJ Merelo  wrote:
> 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;
>>
>> 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:
>>
>>my @y = @x;
>>@y does LookInside;
>>
>> I didn't think there would be any difference between the two
>> though.  What am I not getting?
>>
>> The full code looks like this:
>>
>> trial_introspect.pl6:
>>
>>   use v6;
>>   use Trial::Introspect;
>>   my @x = ;
>>   my @y = @x;
>>   @y does LookInside;
>>   say "Methods: ";
>>   say @y.methodical_methods;
>>
>>
>> .../Trial/Introspect.pm6:
>>
>>   role LookInside {
>> method methodical_methods {
>>   self.^methods.map({ .gist }).sort.unique.map({ "$_\n" }).grep({
>> ! /^Method/ });
>> }
>>   }
>
>
>
> --
> JJ


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
> discouraged.
>

Actually, there was an "also:" right before "Ask questions in StackOverflow
whenever possible". Maybe it should have been right after "StackOverflow".
Again, my mistake.

>
> It asserts that, for people who have difficulty using StackOverflow for
> whatever reason, *they do not belong here*.
>

Not my intention in the least way. They *very much* belong here.

JJ


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 objects docs to be
tremendously confusing at first:  it looks like some sort of
conditional check, like "unless".



On Tue, Jun 12, 2018 at 1:01 AM, Elizabeth Mattijsen  wrote:
>> 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 (Array+{LookInside}).
>
> What you’re doing here, is assigning the elements of an Array but Lookinside 
> to a normal Array.  The elements of the Array do not have any roles mixed in, 
> so you wind up with a normal Array with normal elements in them.  Perhaps you 
> meant:
>
> my @y does LookInside = @x;
>
> Here you create an Array @y with the role LookInside mixed in, and *then* 
> assign the values from @x.
>
>
>
> Also, what JJ Merelo said: StackOverflow is your friend  :-)
>
>
>
> Liz


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
https://docs.perl6.org/language/traits, but there's still a long way to go.

JJ


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 perl in
public where non-perl might see it (to help counter that "perl is
dead" impression that's floating around).  Getting more involved with
stackoverflow has been on my list for a long time... and yet I haven't
gotten to it.  Why not?

(1) The barrier at stackoverflow to a beginner is probably higher than
you think it is-- it's not at all obvious what you're allowed to do
and what you're not at the outset.

(2) Stackoverflow is centralized, I don't know really who's in control
of it (and early on I had the impression they were a bunch of
microsofties).  Email has the virtue of being federated-- or it would
be if we weren't all using gmail-- and if there's a web archive it's
also indexed.

(3) Stackoverflow may be "well indexed", but I haven't noticed this
being very helpful for perl6 where many things are huffmaned down
below the level where they can work as grep crumbs.  E.g. "does" vs.
"but" and perhaps worse "=" vs. ":=".

(4) I've seen some complaints about stackoverflow moderators that
seemed all-too-familiar-- power tripping for the sake of it.  They
seem to be a bit trigger-happy about shutting down interesting and
illuminating discussion ("this is all just matter of opinion!").
It's not at all unusual to do a web search on a question and end up at
a stackoverflow page that a moderator has marked as "Closed".

(5) I question how much it improves visibility to post perl6 material
at stackoverflow: there's so much stuff there very few people look at
the place as a whole: the only people likely to look at a perl6
discussion are the people who are already interested in perl6.


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.)

Which last part also applies to the topic that spawned this one, and is why
it is coming across as "you don't belong here".

On Tue, Jun 12, 2018 at 2:20 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 stackoverflow).
>
> I understand the argument that it's better to talk about perl in
> public where non-perl might see it (to help counter that "perl is
> dead" impression that's floating around).  Getting more involved with
> stackoverflow has been on my list for a long time... and yet I haven't
> gotten to it.  Why not?
>
> (1) The barrier at stackoverflow to a beginner is probably higher than
> you think it is-- it's not at all obvious what you're allowed to do
> and what you're not at the outset.
>
> (2) Stackoverflow is centralized, I don't know really who's in control
> of it (and early on I had the impression they were a bunch of
> microsofties).  Email has the virtue of being federated-- or it would
> be if we weren't all using gmail-- and if there's a web archive it's
> also indexed.
>
> (3) Stackoverflow may be "well indexed", but I haven't noticed this
> being very helpful for perl6 where many things are huffmaned down
> below the level where they can work as grep crumbs.  E.g. "does" vs.
> "but" and perhaps worse "=" vs. ":=".
>
> (4) I've seen some complaints about stackoverflow moderators that
> seemed all-too-familiar-- power tripping for the sake of it.  They
> seem to be a bit trigger-happy about shutting down interesting and
> illuminating discussion ("this is all just matter of opinion!").
> It's not at all unusual to do a web search on a question and end up at
> a stackoverflow page that a moderator has marked as "Closed".
>
> (5) I question how much it improves visibility to post perl6 material
> at stackoverflow: there's so much stuff there very few people look at
> the place as a whole: the only people likely to look at a perl6
> discussion are the people who are already interested in perl6.
>


-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


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 position
about talking about things in both places is interesting-- though a
little impractical for obvious reasons.

(Myself, I'm toying with the idea that I might start posting some
softball questions at stackoverflow, even if I already know the
answer to them.)


On Tue, Jun 12, 2018 at 11:25 AM, Brandon Allbery  wrote:
> 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.)
>
> Which last part also applies to the topic that spawned this one, and is why
> it is coming across as "you don't belong here".
>
> On Tue, Jun 12, 2018 at 2:20 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 stackoverflow).
>>
>> I understand the argument that it's better to talk about perl in
>> public where non-perl might see it (to help counter that "perl is
>> dead" impression that's floating around).  Getting more involved with
>> stackoverflow has been on my list for a long time... and yet I haven't
>> gotten to it.  Why not?
>>
>> (1) The barrier at stackoverflow to a beginner is probably higher than
>> you think it is-- it's not at all obvious what you're allowed to do
>> and what you're not at the outset.
>>
>> (2) Stackoverflow is centralized, I don't know really who's in control
>> of it (and early on I had the impression they were a bunch of
>> microsofties).  Email has the virtue of being federated-- or it would
>> be if we weren't all using gmail-- and if there's a web archive it's
>> also indexed.
>>
>> (3) Stackoverflow may be "well indexed", but I haven't noticed this
>> being very helpful for perl6 where many things are huffmaned down
>> below the level where they can work as grep crumbs.  E.g. "does" vs.
>> "but" and perhaps worse "=" vs. ":=".
>>
>> (4) I've seen some complaints about stackoverflow moderators that
>> seemed all-too-familiar-- power tripping for the sake of it.  They
>> seem to be a bit trigger-happy about shutting down interesting and
>> illuminating discussion ("this is all just matter of opinion!").
>> It's not at all unusual to do a web search on a question and end up at
>> a stackoverflow page that a moderator has marked as "Closed".
>>
>> (5) I question how much it improves visibility to post perl6 material
>> at stackoverflow: there's so much stuff there very few people look at
>> the place as a whole: the only people likely to look at a perl6
>> discussion are the people who are already interested in perl6.
>
>
>
> --
> brandon s allbery kf8nh   sine nomine associates
> allber...@gmail.com  ballb...@sinenomine.net
> unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


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
>   my @y does LookInside = @x;
>
> I actually found the use of "but" in the objects docs to be
> tremendously confusing at first:  it looks like some sort of
> conditional check, like "unless".

The reason `but` exists is basically for the following

my $v = 0 but True;

if $v { say $v } # prints 0

In Perl 5 it is common to return the string `"0 but true"` for a value that is
both 0 and true.

Since one of the design philosophies of Perl 6 is to reduce the number
of special cases this was made to be more generally useful.

Note that you should not do the following

my $v = 0;
$v does True;

say 'WTF!' if 0; # prints WTF!

Basically you can use `but` anywhere you like, but be careful with `does`.

> On Tue, Jun 12, 2018 at 1:01 AM, Elizabeth Mattijsen  wrote:
>>> 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.

That is effectively the same as:

my @y = (@x but LookInside).map: *.self;

That is @ sigiled variables tend to slurp in iterable values.

>>>  say @y.^WHAT

If you want to print the name use `.^name`.

If you want the type object for more advanced usages use `.WHAT`.

>>>
>>> Would just report (Array), not (Array+{LookInside}).
>>
>> What you’re doing here, is assigning the elements of an Array but Lookinside 
>> to a normal Array.  The elements of the Array do not have any roles mixed 
>> in, so you wind up with a normal Array with normal elements in them.  
>> Perhaps you meant:
>>
>> my @y does LookInside = @x;
>>
>> Here you create an Array @y with the role LookInside mixed in, and *then* 
>> assign the values from @x.
>>


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 wasn't my intention, and that the
main problem was a misplaced "also". Never, ever, would I want to do that.

>
> But then, JJ Merelo (and Elizabeth Mattijsen) really aren't even
> very bad offenders, as these things go.  The fall-back position
> about talking about things in both places is interesting-- though a
> little impractical for obvious reasons.
>

I hope it's clear by now, but that was _never_ the intention. Never "stop
asking here, go there". It was _always_ please go there _too_ if you want,
or like, or prefer. I mean, I've never refrained from helping anyone if I
could. I've helped and _then_ asked to please, if that's OK with everyone,
ask from time to time in SO.  Even the self same question.

>
> (Myself, I'm toying with the idea that I might start posting some
> softball questions at stackoverflow, even if I already know the
> answer to them.)
>

:-) I mean, that's really the thing. You look for other languages, it's
like "how to do print to STDOUT". I mean, I sometimes have to look on how
to print to STDOUT. I haven't seen that yet in Perl 6, but when it shows up
we'll be sure to answer like the welcoming, helpful and diverse community
we are.

Again, thanks for opening up the discussion and giving me the chance to
clarify my position.

JJ


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 := @x but LookInside;
> >
> >   # suggested by Elizabeth Mattijsen l...@dijkmat.nl
> >   my @y does LookInside = @x;
> >
> > I actually found the use of "but" in the objects docs to be
> > tremendously confusing at first:  it looks like some sort of
> > conditional check, like "unless".
>
> The reason `but` exists is basically for the following
>
> my $v = 0 but True;
>
> if $v { say $v } # prints 0
>
> In Perl 5 it is common to return the string `"0 but true"` for a value
> that is
> both 0 and true.
>
> Since one of the design philosophies of Perl 6 is to reduce the number
> of special cases this was made to be more generally useful.
>
> Note that you should not do the following
>
> my $v = 0;
> $v does True;
>
> say 'WTF!' if 0; # prints WTF!
>
> Basically you can use `but` anywhere you like, but be careful with `does`.
>

We *badly* need that trait page to make everything clear. I'll have to
speed that up. Any help is welcome.

JJ
PS: If you change the last 0 above to $v, it says: «Hey␤Some exceptions
were thrown in END blocks:␤»


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
list of all available methods, so I started trying some guesses:
".METHODS", ".METHOD", ".methods" But actually it's ".^methods".
Okay, the caret is used for introspection... but then why isn't it
".^what"?

(It also turns out that the list ".^methods" gives you is bizarre:
hard to read, has many duplicates, unsorted, full of odd entries that
look like internal use only widgets I don't care about just now...)




On Tue, Jun 12, 2018 at 11:34 AM, Brad Gilbert  wrote:
> 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
>>   my @y does LookInside = @x;
>>
>> I actually found the use of "but" in the objects docs to be
>> tremendously confusing at first:  it looks like some sort of
>> conditional check, like "unless".
>
> The reason `but` exists is basically for the following
>
> my $v = 0 but True;
>
> if $v { say $v } # prints 0
>
> In Perl 5 it is common to return the string `"0 but true"` for a value that is
> both 0 and true.
>
> Since one of the design philosophies of Perl 6 is to reduce the number
> of special cases this was made to be more generally useful.
>
> Note that you should not do the following
>
> my $v = 0;
> $v does True;
>
> say 'WTF!' if 0; # prints WTF!
>
> Basically you can use `but` anywhere you like, but be careful with `does`.
>
>> On Tue, Jun 12, 2018 at 1:01 AM, Elizabeth Mattijsen  wrote:
 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.
>
> That is effectively the same as:
>
> my @y = (@x but LookInside).map: *.self;
>
> That is @ sigiled variables tend to slurp in iterable values.
>
  say @y.^WHAT
>
> If you want to print the name use `.^name`.
>
> If you want the type object for more advanced usages use `.WHAT`.
>

 Would just report (Array), not (Array+{LookInside}).
>>>
>>> What you’re doing here, is assigning the elements of an Array but 
>>> Lookinside to a normal Array.  The elements of the Array do not have any 
>>> roles mixed in, so you wind up with a normal Array with normal elements in 
>>> them.  Perhaps you meant:
>>>
>>> my @y does LookInside = @x;
>>>
>>> Here you create an Array @y with the role LookInside mixed in, and *then* 
>>> assign the values from @x.
>>>


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 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
> list of all available methods, so I started trying some guesses:
> ".METHODS", ".METHOD", ".methods" But actually it's ".^methods".
> Okay, the caret is used for introspection... but then why isn't it
> ".^what"?
>
> (It also turns out that the list ".^methods" gives you is bizarre:
> hard to read, has many duplicates, unsorted, full of odd entries that
> look like internal use only widgets I don't care about just now...)
>
>
>
>
> On Tue, Jun 12, 2018 at 11:34 AM, Brad Gilbert  wrote:
> > 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
> >>   my @y does LookInside = @x;
> >>
> >> I actually found the use of "but" in the objects docs to be
> >> tremendously confusing at first:  it looks like some sort of
> >> conditional check, like "unless".
> >
> > The reason `but` exists is basically for the following
> >
> > my $v = 0 but True;
> >
> > if $v { say $v } # prints 0
> >
> > In Perl 5 it is common to return the string `"0 but true"` for a value
> that is
> > both 0 and true.
> >
> > Since one of the design philosophies of Perl 6 is to reduce the number
> > of special cases this was made to be more generally useful.
> >
> > Note that you should not do the following
> >
> > my $v = 0;
> > $v does True;
> >
> > say 'WTF!' if 0; # prints WTF!
> >
> > Basically you can use `but` anywhere you like, but be careful with
> `does`.
> >
> >> On Tue, Jun 12, 2018 at 1:01 AM, Elizabeth Mattijsen 
> wrote:
>  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.
> >
> > That is effectively the same as:
> >
> > my @y = (@x but LookInside).map: *.self;
> >
> > That is @ sigiled variables tend to slurp in iterable values.
> >
>   say @y.^WHAT
> >
> > If you want to print the name use `.^name`.
> >
> > If you want the type object for more advanced usages use `.WHAT`.
> >
> 
>  Would just report (Array), not (Array+{LookInside}).
> >>>
> >>> What you’re doing here, is assigning the elements of an Array but
> Lookinside to a normal Array.  The elements of the Array do not have any
> roles mixed in, so you wind up with a normal Array with normal elements in
> them.  Perhaps you meant:
> >>>
> >>> my @y does LookInside = @x;
> >>>
> >>> Here you create an Array @y with the role LookInside mixed in, and
> *then* assign the values from @x.
> >>>
>


-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


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 on $invocant's metaclass. It desugars to
$invocant.HOW.method($invocant,
...)

(HOW means Higher Order Workings and it effectively returns the metaclass
for every kind of object: ClassHOW and so on).

JJ


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 metaobject is the .HOW
> pseudo-method. If you do this for a normal class or object of that class,
> you get Perl6::Metamodel::ClassHOW back. This is what the .^method syntax
> is accessing; it's short for (thing).HOW.method((thing), ...). The
> metaclass doesn't magically know its children, so the object has to be used
> once to get at its metaclass and a second time to tell the metaclass what
> it is to introspect.
>
> I'm not seeing documentation for what .WHAT actually does; it (correctly)
> notes that it's implemented specially within the compiler (hence "macro")
> but not how you achieve it otherwise. Then again, .HOW has the same issue;
> there's a bit of a bootstrapping issue with getting at the metamodel, you
> need to have it first. Which is why it's wired into the compiler and gets
> those uppercase pseudo-method names.
>

All the metamodel is not exactly part of the language; it's part of the
compiler. So it's in the gray NOT-SPECCED zone regarding documentation of
"Perl 6" the language, as oposed to "Perl 6, the implementation by Rakudo".
But it's a gray zone and sometimes you fall short of documenting things
like WHAT. I'll see what we can in that area.

JJ


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 object of that class, you get
Perl6::Metamodel::ClassHOW back. This is what the .^method syntax is
accessing; it's short for (thing).HOW.method((thing), ...). The metaclass
doesn't magically know its children, so the object has to be used once to
get at its metaclass and a second time to tell the metaclass what it is to
introspect.

I'm not seeing documentation for what .WHAT actually does; it (correctly)
notes that it's implemented specially within the compiler (hence "macro")
but not how you achieve it otherwise. Then again, .HOW has the same issue;
there's a bit of a bootstrapping issue with getting at the metamodel, you
need to have it first. Which is why it's wired into the compiler and gets
those uppercase pseudo-method names.

On Tue, Jun 12, 2018 at 3:00 PM Brandon Allbery  wrote:

> .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 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
>> list of all available methods, so I started trying some guesses:
>> ".METHODS", ".METHOD", ".methods" But actually it's ".^methods".
>> Okay, the caret is used for introspection... but then why isn't it
>> ".^what"?
>>
>> (It also turns out that the list ".^methods" gives you is bizarre:
>> hard to read, has many duplicates, unsorted, full of odd entries that
>> look like internal use only widgets I don't care about just now...)
>>
>>
>>
>>
>> On Tue, Jun 12, 2018 at 11:34 AM, Brad Gilbert  wrote:
>> > 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
>> >>   my @y does LookInside = @x;
>> >>
>> >> I actually found the use of "but" in the objects docs to be
>> >> tremendously confusing at first:  it looks like some sort of
>> >> conditional check, like "unless".
>> >
>> > The reason `but` exists is basically for the following
>> >
>> > my $v = 0 but True;
>> >
>> > if $v { say $v } # prints 0
>> >
>> > In Perl 5 it is common to return the string `"0 but true"` for a value
>> that is
>> > both 0 and true.
>> >
>> > Since one of the design philosophies of Perl 6 is to reduce the number
>> > of special cases this was made to be more generally useful.
>> >
>> > Note that you should not do the following
>> >
>> > my $v = 0;
>> > $v does True;
>> >
>> > say 'WTF!' if 0; # prints WTF!
>> >
>> > Basically you can use `but` anywhere you like, but be careful with
>> `does`.
>> >
>> >> On Tue, Jun 12, 2018 at 1:01 AM, Elizabeth Mattijsen 
>> wrote:
>>  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.
>> >
>> > That is effectively the same as:
>> >
>> > my @y = (@x but LookInside).map: *.self;
>> >
>> > That is @ sigiled variables tend to slurp in iterable values.
>> >
>>   say @y.^WHAT
>> >
>> > If you want to print the name use `.^name`.
>> >
>> > If you want the type object for more advanced usages use `.WHAT`.
>> >
>> 
>>  Would just report (Array), not (Array+{LookInside}).
>> >>>
>> >>> What you’re doing here, is assigning the elements of an Array but
>> Lookinside to a normal Array.  The elements of the Array do not have any
>> roles mixed in, so you wind up with a normal Array with normal elements in
>> them.  Perhaps you meant:
>> >>>
>> >>> my @y does LookInside = @x;
>> >>>
>> >>> Here you create an Array @y with the role LookInside mixed in, and
>> *then* assign the values from @x.
>> >>>
>>
>
>
> --
> brandon s allbery kf8nh   sine nomine
> associates
> allber...@gmail.com
> ballb...@sinenomine.net
> unix, openafs, kerberos, infrastructure, xmonad
> http://sinenomine.net
>


-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


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 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 metaobject is the .HOW
>> pseudo-method. If you do this for a normal class or object of that class,
>> you get Perl6::Metamodel::ClassHOW back. This is what the .^method syntax
>> is accessing; it's short for (thing).HOW.method((thing), ...). The
>> metaclass doesn't magically know its children, so the object has to be used
>> once to get at its metaclass and a second time to tell the metaclass what
>> it is to introspect.
>>
>> I'm not seeing documentation for what .WHAT actually does; it (correctly)
>> notes that it's implemented specially within the compiler (hence "macro")
>> but not how you achieve it otherwise. Then again, .HOW has the same issue;
>> there's a bit of a bootstrapping issue with getting at the metamodel, you
>> need to have it first. Which is why it's wired into the compiler and gets
>> those uppercase pseudo-method names.
>>
>
> All the metamodel is not exactly part of the language; it's part of the
> compiler. So it's in the gray NOT-SPECCED zone regarding documentation of
> "Perl 6" the language, as oposed to "Perl 6, the implementation by Rakudo".
> But it's a gray zone and sometimes you fall short of documenting things
> like WHAT. I'll see what we can in that area.
>
> JJ
>
>

-- 
JJ


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 stackoverflow).
>
> I understand the argument that it's better to talk about perl in
> public where non-perl might see it (to help counter that "perl is
> dead" impression that's floating around).  Getting more involved with
> stackoverflow has been on my list for a long time... and yet I haven't
> gotten to it.  Why not?
>
> (1) The barrier at stackoverflow to a beginner is probably higher than
> you think it is-- it's not at all obvious what you're allowed to do
> and what you're not at the outset.

The barrier is non-existent.

You don't have to even create an account to post on it.
(You should if you want to be able to edit or delete your posts after
your cookie expires.)

If you have code that you can't get to work the way you think it should,
it is the right place to ask. All other questions are off topic.

On the ask question page they have a list of the rules.
I think they may even have a mini tutorial for first-time users.

> (2) Stackoverflow is centralized, I don't know really who's in control
> of it (and early on I had the impression they were a bunch of
> microsofties).  Email has the virtue of being federated-- or it would
> be if we weren't all using gmail-- and if there's a web archive it's
> also indexed.

Stack Overflow is from Fog Creek Software.
See https://stackoverflow.com/company

They also regularly provide bulk downloads of all the publically available data.

> (3) Stackoverflow may be "well indexed", but I haven't noticed this
> being very helpful for perl6 where many things are huffmaned down
> below the level where they can work as grep crumbs.  E.g. "does" vs.
> "but" and perhaps worse "=" vs. ":=".

That is fair, but other languages have the same problem.
Since a lot of them use Stack Overflow, they know they can search
there instead.

> (4) I've seen some complaints about stackoverflow moderators that
> seemed all-too-familiar-- power tripping for the sake of it.  They
> seem to be a bit trigger-happy about shutting down interesting and
> illuminating discussion ("this is all just matter of opinion!").
> It's not at all unusual to do a web search on a question and end up at
> a stackoverflow page that a moderator has marked as "Closed".

Very few questions are closed by moderators.
The vast majority are voted to be closed by users.
In fact some moderators refuse to vote to close iffy questions,
because their vote counts as 5 regular users.

If you ask what is the best module for doing X, that is considered
to broad.
If you are having trouble using a particular module, then it is not.

If you ask a homework question, then it is too broad.
If you ask what is wrong with my homework it isn't.
(it may be closed anyway if enough users think it shouldn't be there)

The reasoning for this is to prevent it from becoming another
Yahoo! answers. (They have said this many times on the podcast)

Also note that you are still allowed to edit it to follow the rules.
If enough people agree that you have sufficiently fixed it, they
can vote to reopen it.

If it is sufficiently bad, users will vote to delete it.

Moderators are also elected. So if one of them abuses their
power they risk losing their moderator privileges.

The main purpose of moderators is to fix problems the regular
system doesn't work sufficiently for.
(Spam, bulk voting, sock puppet accounts, abusive speech,
joining accounts, etc)

Basically your remark about mods power tripping is baseless.
The only real problem is that some people don't like the rules.
(Even though most rules have been added by user demand.)

> (5) I question how much it improves visibility to post perl6 material
> at stackoverflow: there's so much stuff there very few people look at
> the place as a whole: the only people likely to look at a perl6
> discussion are the people who are already interested in perl6.

Stack Overflow puts out data about how many questions get asked
for each language. So by putting it there we influence their stats.

This is the main reason JJ keeps saying to post there.

---

Note that I have been following the development of StackOverflow
since before they had a private beta. (podcasts)

I'm user number 1337 by the way.
I may be the only Perl programmer to receive the Beta badge.


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 questions here, or
> > at stackoverflow (or both here *and* at stackoverflow).
> >
> > I understand the argument that it's better to talk about perl in
> > public where non-perl might see it (to help counter that "perl is
> > dead" impression that's floating around).  Getting more involved with
> > stackoverflow has been on my list for a long time... and yet I haven't
> > gotten to it.  Why not?
> >
> > (1) The barrier at stackoverflow to a beginner is probably higher than
> > you think it is-- it's not at all obvious what you're allowed to do
> > and what you're not at the outset.
>
> The barrier is non-existent.
>


  Your failure of imagination does not make that barrier any less real.



Eirik


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 ) { Type }

say 42.&user-made-what; # says (Int)

>
> El mar., 12 jun. 2018 a las 21:14, JJ Merelo ()
> escribió:
>>
>>
>>
>> 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 metaobject is the .HOW
>>> pseudo-method. If you do this for a normal class or object of that class,
>>> you get Perl6::Metamodel::ClassHOW back. This is what the .^method syntax is
>>> accessing; it's short for (thing).HOW.method((thing), ...). The metaclass
>>> doesn't magically know its children, so the object has to be used once to
>>> get at its metaclass and a second time to tell the metaclass what it is to
>>> introspect.
>>>
>>> I'm not seeing documentation for what .WHAT actually does; it (correctly)
>>> notes that it's implemented specially within the compiler (hence "macro")
>>> but not how you achieve it otherwise. Then again, .HOW has the same issue;
>>> there's a bit of a bootstrapping issue with getting at the metamodel, you
>>> need to have it first. Which is why it's wired into the compiler and gets
>>> those uppercase pseudo-method names.
>>
>>
>> All the metamodel is not exactly part of the language; it's part of the
>> compiler. So it's in the gray NOT-SPECCED zone regarding documentation of
>> "Perl 6" the language, as oposed to "Perl 6, the implementation by Rakudo".
>> But it's a gray zone and sometimes you fall short of documenting things like
>> WHAT. I'll see what we can in that area.
>>
>> JJ
>>
>
>
> --
> JJ


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.
>> >
>> > 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 perl in
>> > public where non-perl might see it (to help counter that "perl is
>> > dead" impression that's floating around).  Getting more involved with
>> > stackoverflow has been on my list for a long time... and yet I haven't
>> > gotten to it.  Why not?
>> >
>> > (1) The barrier at stackoverflow to a beginner is probably higher than
>> > you think it is-- it's not at all obvious what you're allowed to do
>> > and what you're not at the outset.
>>
>> The barrier is non-existent.
>
>
>
>   Your failure of imagination does not make that barrier any less real.
>

I have only ever heard about speculated and imagined barriers.

Note that even being blind shouldn't be a barrier, as they try hard
to make it accessible.

As long as you follow the rules, there isn't much of anything slowing you down.

Basically I don't think I need to imagine them because I have already
heard/read them.


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
changed in a way that induced severe social anxiety. Again, this is not
something "fixable", not on my end.

You are not everyone. Don't assume what works for you necessarily works for
everyone. Or that there are quick and accessible workarounds for everyone.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


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 the publically available
> data.
>
>
They also have a query engine for that data, you can use it for free. It's
really amazing, and helps you see trends and associations.


> > (4) I've seen some complaints about stackoverflow moderators that
> > seemed all-too-familiar-- power tripping for the sake of it.  They
> > seem to be a bit trigger-happy about shutting down interesting and
> > illuminating discussion ("this is all just matter of opinion!").
> > It's not at all unusual to do a web search on a question and end up at
> > a stackoverflow page that a moderator has marked as "Closed".
>
> Very few questions are closed by moderators.
>

I don't know about that, but of course it can be checked using the
above-mentioned data query facility. But in the months I have been
following the tag, there's a single question that has been closed. It
didn't deserve it, in my opinion, and I did my best to try and keep it
open. In general, the community following the perl6 tag is as welcoming and
helpful as the perl6 community, in general.

> (5) I question how much it improves visibility to post perl6 material

> > at stackoverflow: there's so much stuff there very few people look at
> > the place as a whole: the only people likely to look at a perl6
> > discussion are the people who are already interested in perl6.
>
> Stack Overflow puts out data about how many questions get asked
> for each language. So by putting it there we influence their stats.
>
>
That's correct. And that goes also to the TIOBE rankings and somesuch. But
scaling those rankings is really, really, far away. I just want people to
find Perl6 questions easily, and for people in general who follow other,
related tags like regexes or unicode to see perl6 questions so that they
are interested in it.

JJ


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
> > 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 ) { Type }
>
> say 42.&user-made-what; # says (Int)
>
> >
> > El mar., 12 jun. 2018 a las 21:14, JJ Merelo ()
> > escribió:
> >>
> >>
> >>
> >> El mar., 12 jun. 2018 a las 21:11, Brandon Allbery (<
> allber...@gmail.com>)
> >> 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 metaobject is the .HOW
> >>> pseudo-method. If you do this for a normal class or object of that
> class,
> >>> you get Perl6::Metamodel::ClassHOW back. This is what the .^method
> syntax is
> >>> accessing; it's short for (thing).HOW.method((thing), ...). The
> metaclass
> >>> doesn't magically know its children, so the object has to be used once
> to
> >>> get at its metaclass and a second time to tell the metaclass what it
> is to
> >>> introspect.
> >>>
> >>> I'm not seeing documentation for what .WHAT actually does; it
> (correctly)
> >>> notes that it's implemented specially within the compiler (hence
> "macro")
> >>> but not how you achieve it otherwise. Then again, .HOW has the same
> issue;
> >>> there's a bit of a bootstrapping issue with getting at the metamodel,
> you
> >>> need to have it first. Which is why it's wired into the compiler and
> gets
> >>> those uppercase pseudo-method names.
> >>
> >>
> >> All the metamodel is not exactly part of the language; it's part of the
> >> compiler. So it's in the gray NOT-SPECCED zone regarding documentation
> of
> >> "Perl 6" the language, as oposed to "Perl 6, the implementation by
> Rakudo".
> >> But it's a gray zone and sometimes you fall short of documenting things
> like
> >> WHAT. I'll see what we can in that area.
> >>
> >> JJ
> >>
> >
> >
> > --
> > JJ
>


-- 
JJ


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 mark
> and lasted less than a week afterward because the rules suddenly changed in
> a way that induced severe social anxiety. Again, this is not something
> "fixable", not on my end.

The rules did not change.
It's just features that you didn't have before became available.
You are free to ignore them.

If you can't ignore them, you could try bringing it up on
meta.stackoverflow.com,
and maybe someone there could do something to improve it for you.

>
> You are not everyone. Don't assume what works for you necessarily works for
> everyone. Or that there are quick and accessible workarounds for everyone.
>

The barrier is not with Stack Overflow. (←What I obviously meant)
The barrier is within you.

I should know I have some myself.

For example, I have never gotten a job by myself.
(Well there is the one time where they called on the phone, but I didn't
pick it up because I didn't recognize the number.)

I have also never been on a date as it gives me too much anxiety to ask.
(There was one gal that I was absolutely smitten with, who I
was also absolutely sure wanted me to ask her out, but was unable to.)


Should I say that the barrier is with women (incel), or with myself?

---

That's not to say there isn't something that other people could do to reduce
the barrier. I don't think anybody can do that if they don't know it exists.

If you at least tell me what changes could help, I could bring it up on meta.


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 barrier is within
you" means it's a modifiable barrier. Or, for that matter, it should be.

For some of us, it's not. I was not overstating earlier when I made a
reference to the Nobel Prize.
And there are also those for whom it's not as modifiable as this attitude
assumes, or for whom modifying it is not the best of ideas.

Think about this one a bit next time you want to tell someone it's "all in
their head". Because it might just be literally true.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


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 you.
>
>
> There's an insidious assumption hidden in here: that "the barrier is within
> you" means it's a modifiable barrier. Or, for that matter, it should be.
>
> For some of us, it's not. I was not overstating earlier when I made a
> reference to the Nobel Prize.
> And there are also those for whom it's not as modifiable as this attitude
> assumes, or for whom modifying it is not the best of ideas.
>
> Think about this one a bit next time you want to tell someone it's "all in
> their head". Because it might just be literally true.
>

I absolutely knew it was literally true.

I then proceeded to point out the same in my own life.

I did not intend to imply that it was easy to deal with.

(Note for others reading this there have been messages off list about this)


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: 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 Rakudo version 2018.04.1 built on MoarVM version 2018.04.1
implementing Perl 6.c.


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


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-/"   &&   ".tar.gz " |  {say "yes"}⏏ else {say "no};
Missing block (apparently claimed by expression)
at -e:1
--> ging-/"   &&   ".tar.gz " |  {say "yes"}⏏ else {say "no};


:'(

-T


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 applies to.

On Tue, Jun 12, 2018 at 6:42 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 gobbling block
> at -e:1
> --> ging-/"   &&   ".tar.gz " |  {say "yes"}⏏ else {say "no};
> Missing block (apparently claimed by expression)
> at -e:1
> --> ging-/"   &&   ".tar.gz " |  {say "yes"}⏏ else {say "no};
>
>
> :'(
>
> -T
>


-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


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: 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 gobbling block
at -e:1
--> ging-/"   &&   ".tar.gz " |  {say "yes"}⏏ else {say "no};
Missing block (apparently claimed by expression)
at -e:1
--> ging-/"   &&   ".tar.gz " |  {say "yes"}⏏ else {say "no};


:'(

-T



This fixed it:

$ p6 'my $Line = "wine-patched/archive/staging-/x.tar.gz";if $Line 
~~ / "wine-patched\/archive\/staging\-\/" / & / ".tar.gz" /  {say "yes"} 
else {say "no"};'



How do I use "|" instead of "/"?  I am trying to rid myself of the
/\/\//\//\\/\/  tree


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
> > ~~ | "wine-patched/archive/staging-/"   &&   ".tar.gz " |  {say "yes"}
> > else {say "no};'
> >
> > ===SORRY!===
> > Expression needs parens to avoid gobbling block
> > at -e:1
> > --> ging-/"   &&   ".tar.gz " |  {say "yes"}⏏ else {say "no};
> > Missing block (apparently claimed by expression)
> > at -e:1
> > --> ging-/"   &&   ".tar.gz " |  {say "yes"}⏏ else {say "no};
> >
> >
> > :'(
> >
> > -T
>
>
> This fixed it:
>
> $ p6 'my $Line = "wine-patched/archive/staging-/x.tar.gz";if $Line
> ~~ / "wine-patched\/archive\/staging\-\/" / & / ".tar.gz" /  {say "yes"}
> else {say "no"};'
>
>
> How do I use "|" instead of "/"?  I am trying to rid myself of the
> /\/\//\//\\/\/  tree
>


-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


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
> $Line
>  > ~~ | "wine-patched/archive/staging-/"   &&   ".tar.gz " |  {say
> "yes"}
>  > else {say "no};'
>  >
>  > ===SORRY!===
>  > Expression needs parens to avoid gobbling block
>  > at -e:1
>  > --> ging-/"   &&   ".tar.gz " |  {say "yes"}⏏ else {say "no};
>  > Missing block (apparently claimed by expression)
>  > at -e:1
>  > --> ging-/"   &&   ".tar.gz " |  {say "yes"}⏏ else {say "no};
>  >
>  >
>  > :'(
>  >
>  > -T
>
>
> This fixed it:
>
> $ p6 'my $Line = "wine-patched/archive/staging-/x.tar.gz";if 
$Line

> ~~ / "wine-patched\/archive\/staging\-\/" / & / ".tar.gz" /  {say
> "yes"}
> else {say "no"};'
>
>
> How do I use "|" instead of "/"?  I am trying to rid myself of the
> /\/\//\//\\/\/  tree
> On 06/12/2018 04:37 PM, Brandon Allbery wrote:

Same as in perl 5:  m ... 

m|xxx|


so I have to include the m

Doesn't work


$ p6 'my $Line = "wine-patched/archive/staging-/x.tar.gz";if $Line 
~~ m| "wine-patched\/archive\/staging\-\/"  &  ".tar.gz" |  {say "yes"} 
else {say "no"};'

no


:'(


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
both.

Either use two different matches, or put something like  .*  in between
instead of trying to use & or &&.

On Tue, Jun 12, 2018 at 8:15 PM ToddAndMargo  wrote:

>  >
>  > 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
>  >  > ~~ | "wine-patched/archive/staging-/"   &&   ".tar.gz " |  {say
>  > "yes"}
>  >  > else {say "no};'
>  >  >
>  >  > ===SORRY!===
>  >  > Expression needs parens to avoid gobbling block
>  >  > at -e:1
>  >  > --> ging-/"   &&   ".tar.gz " |  {say "yes"}⏏ else {say "no};
>  >  > Missing block (apparently claimed by expression)
>  >  > at -e:1
>  >  > --> ging-/"   &&   ".tar.gz " |  {say "yes"}⏏ else {say "no};
>  >  >
>  >  >
>  >  > :'(
>  >  >
>  >  > -T
>  >
>  >
>  > This fixed it:
>  >
>  > $ p6 'my $Line = "wine-patched/archive/staging-/x.tar.gz";if
> $Line
>  > ~~ / "wine-patched\/archive\/staging\-\/" / & / ".tar.gz" /  {say
>  > "yes"}
>  > else {say "no"};'
>  >
>  >
>  > How do I use "|" instead of "/"?  I am trying to rid myself of the
>  > /\/\//\//\\/\/  tree
>  > On 06/12/2018 04:37 PM, Brandon Allbery wrote:
> > Same as in perl 5:  m ... 
> >
> > m|xxx|
>
> so I have to include the m
>
> Doesn't work
>
>
> $ p6 'my $Line = "wine-patched/archive/staging-/x.tar.gz";if $Line
> ~~ m| "wine-patched\/archive\/staging\-\/"  &  ".tar.gz" |  {say "yes"}
> else {say "no"};'
> no
>
>
> :'(
>


-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


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, the other, or neither, it 
can't simultaneously be both.


So I am stuck with using "/"

Thank you for the help.

-T


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:
> > 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 both.
>
> So I am stuck with using "/"
>
> Thank you for the help.
>
> -T
>


-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


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 $line.starts-with("wine-patched/archive/staging-/") &&
$line.ends-with(".tar.gz") { }

    if $line ~~ m{ "wine-patched/archive/staging-/" .* ".tar.gz" } { }

What do you think?
  - Timo


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 = "wine-patched/archive/staging-/x.tar.gz";if $Line 
~~ m| "wine-patched/archive/staging-/" .*? ".tar.gz" |  {say "yes"} else 
{say "no"};'


yes

Thank you!


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
     if $line.starts-with("wine-patched/archive/staging-/") &&
$line.ends-with(".tar.gz") { }

     if $line ~~ m{ "wine-patched/archive/staging-/" .* ".tar.gz" } { }

What do you think?
   - Timo



I like it.

I used

$ p6 'my $Line = "wine-patched/archive/staging-/x.tar.gz";if $Line 
~~ m| "wine-patched/archive/staging-/" .*? ".tar.gz" |  {say "yes"} else 
{say "no"};'

yes

as it insures the patterns are in sequence, not random.

Thank you!


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 a year now I have found that the answers given 
there provide me either a complete solution that I can cut and paste, or 
enough clues to work out what I need.


Some new software, such as GRAV, do not produce Stackoverflow responses, 
so I have to go to the forum and dig through stuff. But at least it is 
indexed.


With Perl6, the first place I go is the documentation, which has always 
been good and is getting better.


However, there are some practical questions that have been answered in 
this list with really very good explanations, not just about the 
problem, but also why. For a language, the 'why' can often be more 
important.


Stackoverflow is - I think - a great resource (I grant there are the 
normal human problems, but what human system is perfect?) because it 
provides answers.


I can therefore see why there is a drive by some to get Perl6 Q&A on 
Stackoverflow.


However, the portal to Stackoverflow is (for me) Google. And Google 
indexes much much more than Stackoverflow.


Some of the Q&A asked on this list are not indexed in a way that would 
bring them to the notice of someone looking for a similar question.


So the real question for me is not 'where to ask questions so that 
people can see them?', but 'how to make Perl6 questions indexable?'.


Richard

aka finanalyst

On 13/06/18 05:44, Brad Gilbert wrote:

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 you.


There's an insidious assumption hidden in here: that "the barrier is within
you" means it's a modifiable barrier. Or, for that matter, it should be.

For some of us, it's not. I was not overstating earlier when I made a
reference to the Nobel Prize.
And there are also those for whom it's not as modifiable as this attitude
assumes, or for whom modifying it is not the best of ideas.

Think about this one a bit next time you want to tell someone it's "all in
their head". Because it might just be literally true.


I absolutely knew it was literally true.

I then proceeded to point out the same in my own life.

I did not intend to imply that it was easy to deal with.

(Note for others reading this there have been messages off list about this)


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 /home/linuxutil/GetUpdates.pl6:416
-->   PrintRedErr "${Title}⏏::${IAm} debugging statement\n";


The actual error was that I forgot the "/" at the end of the ".".
Please fix.

-T


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 usually looking for an accomplice.
   --  Charles Varlet de La Grange
~


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 count), not a
regex (spaces ignored).

> my $x="01.02.03"; $x ~~ s:global/"0"(\d)/$0/; say "$x"
1.2.3

-- 
Norman Gaywood, Computer Systems Officer
School of Science and Technology
University of New England
Armidale NSW 2351, Australia

ngayw...@une.edu.au  http://turing.une.edu.au/~ngaywood
Phone: +61 (0)2 6773 2412  Mobile: +61 (0)4 7862 0062

Please avoid sending me Word or Power Point attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html


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 ($x.comb(/\d+/)>>.Int).join(".");'
1.0.3.6.10



--
~~
Computers are like air conditioners.
They malfunction when you open windows
~~