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: 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: 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: 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: 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: 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: 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: 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 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 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
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 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 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
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
> 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 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 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

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

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; >