🦋 Welcome to Raku! raku.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: colabti.org/irclogger/irclogger_log/raku
Set by ChanServ on 14 October 2019.
00:54 nativecallable6 joined, committable6 joined, shareable6 joined 00:55 quotable6 joined, coverable6 joined, reportable6 joined, benchable6 joined, greppable6 joined, releasable6 joined, statisfiable6 joined, bloatable6 joined 00:56 notable6 joined, squashable6 joined, unicodable6 joined
ZzZombo m: ->(;;){} 01:47
camelia ( no output )
ZzZombo m: ->(;;;;;){}
camelia 5===SORRY!5=== Error while compiling <tmp>
Can only specify ';;' once in a signature
at <tmp>:1
------> 3->(;;;;7⏏5;){}
ZzZombo m: ->(;;$a){}
camelia ( no output )
ZzZombo m: ->(;;$a, $b){}
camelia ( no output )
01:47 hythm joined
ZzZombo m: ->(;;$a, $b){}().say 01:48
camelia Too few positionals passed to '<anon>'; expected 1 argument but got 0
in block <unit> at <tmp> line 1
ZzZombo m: ->(;;$a, $b){}(1).say
camelia Cannot unpack or Capture `1`.
To create a Capture, add parentheses: \(...)
If unpacking in a signature, perhaps you needlessly used parentheses? -> ($x) {} vs. -> $x {}
or missed `:` in signature unpacking? -> &c:(Int) {}
in block <unit> at …
ZzZombo What's `;;` in the signature?
01:59 Tirifto left 02:02 cpan-raku left, cpan-raku joined, cpan-raku left, cpan-raku joined 02:04 AlexDaniel joined, AlexDaniel left, AlexDaniel joined
vrurg ZzZombo: ;; impacts multi-dispatch. It doesn't make positionals optional. 02:36
ZzZombo: they would only be ignored by dispatcher when selecting a candidate. 02:37
ZzZombo Thanks! 02:38
03:24 Doc_Holliwood left 04:05 hythm left 05:05 benchable6 left, statisfiable6 left, bloatable6 left, committable6 left, unicodable6 left, coverable6 left, nativecallable6 left, greppable6 left, notable6 left, reportable6 left, releasable6 left, quotable6 left, squashable6 left, shareable6 left, committable6 joined, unicodable6 joined, nativecallable6 joined 05:06 shareable6 joined, quotable6 joined, releasable6 joined, bloatable6 joined, coverable6 joined, benchable6 joined 05:07 notable6 joined, greppable6 joined 05:08 reportable6 joined, statisfiable6 joined, squashable6 joined
ZzZombo m: given 'asdfgghj'.comb -> @c { @c.roll.say for @c } 05:35
camelia a
g
a
d
f
j
j
f
ZzZombo "If $count is supplied: Returns $count elements chosen at random and without repetition from the invocant."
What is wrong, the docs or the function? 05:36
Oops, I accidentally used `roll`, sorry. 05:37
m: given 'asdfgghj'.comb -> @c { @c.pick.say for @c }
camelia f
h
f
h
d
g
d
a
05:37 roit joined 05:54 stanleytam joined 07:00 veesh joined 08:02 kensanata joined 08:32 abraxxa joined 08:33 chloekek joined
chloekek I used to put distribution sources in PERL6LIB and I did need that for something, but I don't remember what I needed it for. 08:37
Now I only put the precompiled repository in PERL6LIB and it works just fine. I don't need both the precompiled and sources in PERL6LIB.
I also apparently don't need to put the sources in PERL6LIB when invoking install-dist.p6. 08:41
SmokeMachine Could you guy give your opinion on this, please? github.com/FCO/Red/issues/406 08:44
08:49 sena_kun joined
xkr47 my simple (first) calculator in raku: gist.github.com/xkr47/ed2ca66636c4...85b88c0e7e 08:53
chloekek Oh, I know why I got the issue yesterday with the install-dist.p6-generated executables using the wrong template. I was accidentally using Rakudo 2017.01.
08:54 El_Che joined
moritz that's, like, well matured :D 09:01
SmokeMachine moritz: yes, knowing where your code touches the database is a good thing about using .^all... 09:03
09:06 abraxxa left, abraxxa joined 09:07 Altai-man_ joined 09:10 sena_kun left
abraxxa can I use a module only when a specific multi MAIN is called? Grammar::Tracer in my case 09:18
lizmat use statements are lexical, so just use Grammar::Tracer inside the specific multi ? 09:21
or are you worried about the loading overhead ?
chloekek That would still cause the compilation to load the module. If you don't want that to happen you can use require instead of use. 09:22
09:22 sena_kun joined
chloekek E.g. if it is an optional dependency. 09:22
abraxxa lizmat: I tried that but it didn't work
require works, thanks 09:23
lizmat could you be more specific ? "it didn't work" is not really descriptive or helpful :-(
moritz the problem is likely that Grammar::Tracer does magic at import time 09:24
09:24 Altai-man_ left, roit left
lizmat if so, then I don't understand why "require" solves this 09:25
moritz so after the require, you likely need to trigger that magic somehow
wait
I think Grammar::Tracer modifies the meta class for the 'grammar' declarator
so it needs to be loaded at compile time
so the multi MAIN distinction is way too late 09:26
lizmat that's what I thought
chloekek p6: my $f = { 123; }; $f .= (); say $f
camelia No such method '' for invocant of type 'Block'. Did you mean any of these?
kv
of
so

in block <unit> at <tmp> line 1
lizmat that's looks worthy of an issue :-) 09:27
chloekek p6: my $f = { 123; }; $f .= CALL-ME; say $f 09:29
camelia No such method 'CALL-ME' for invocant of type 'Block'
in block <unit> at <tmp> line 1
lizmat that one feels like DIHWIDT 09:30
afk for a few hours&
09:31 xinming_ left 09:35 xinming_ joined 09:38 stanleytam left 10:03 xinming_ left, xinming_ joined 10:10 sena_kun left 10:23 scimon joined 10:24 MitarashiDango[m joined
scimon Morning all. I had a weird idea that actually worked : gist.github.com/Scimon/b589a25527b...87bcea8089 10:26
abraxxa lizmat: it was always loaded, also when running the other multi sub 10:35
moritz: but require in the multi MAIN does work for me 10:36
can I somehow exclude some tokens from being included in the match object of a grammar? 10:37
10:43 Doc_Holliwood joined
SmokeMachine scimon: what's weird on that? 11:00
jnthn abraxxa: Just do <.foo> instead of <foo>
abraxxa jnthn: to exclude a token from the match object? 11:01
jnthn Yes; <.foo> is non-capturing 11:02
abraxxa where can I find that in the docs? 11:07
jnthn: thanks, works nicely 11:10
MitarashiDango[m It's mentioned here, not sure where else: docs.raku.org/language/regexes#Subrules 11:11
abraxxa jnthn: I'd also need to implement an include feature in the grammar. I'm currently trying to rewrite a token into a method that load the included file and uses the whole grammar itself to parse it and return the match object. Does that sound sane?
jnthn abraxxa: Hm, you mane like calling a <.include($foo)> and then method include($foo) { MyGrammar.parsefile($foo) } ? Not sure that's going to go too well since the return value of something called as a token will be used to indicate how much was parsed, and so completely bizare things might happen :) 11:19
I'd attach it with `make` or some such
MasterDuke xkr47: cool. btw, if you wanted to, gist.github.com/xkr47/ed2ca66636c4...u-L97-L108 could be `my $mul = do given $<unit> { when 'w' { 60 * 60 * 24 * 7 } ... }` 11:46
11:49 joule joined 11:53 perlmaros joined 11:54 perlmaros left 11:56 perlmaros joined 11:59 ZzZombo joined
xkr47 MasterDuke, awesome, thanks! all tips appreciated! 12:02
one thing I couldn't figure out is why the `<numb> \h* $<unit> = ...` part would fail to parse if enter any spaces between the number and the unit.. 12:03
abraxxa jnthn: yes that's what I tried because I thought not parsing it somehow simpler to include the files before parsing it to the grammar 12:13
xkr47 how do I get the type of some expression 12:16
abraxxa jnthn: instead of rule include { '. ' <.value> } I tried method include (:$include) { $include ~~ rx/ '. ' <value> / } 12:35
MasterDuke m: say 5.WHAT; say "a".WHAT; say <1 a>.WHAT # xkr47 12:50
camelia (Int)
(Str)
(List)
chloekek p6: say 5.WHAT.WHAT 12:53
camelia (Int)
abraxxa jnthn: P6opaque: no such attribute '$!pos' on type Match in a Slip when trying to get a value 12:54
I have NO idea what that should mean
12:56 mensvaga joined
lizmat abraxxa: it is a roundabout way of saying you somehow had a Match type object, rather than am instance somewhere under the hood 12:56
jnthn abraxxa: Means the object you returned didn't meet the protocol that you have to if you're interacting with the grammar engine 12:57
13:01 MasterDuke left
abraxxa jnthn: paste.scsys.co.uk/587135 13:02
that's the code in question
jnthn And the Slip would be an Empty, when the `if` ends up False 13:03
abraxxa i thought so, but what do I need to return in this case? 13:07
I thought the return value of the last boolean op is sufficient
aka doesn't match, try the next one
jnthn No, it'd have to be a failed Match of some kind, maybe make a `token failed { <!> }` and then return self.failed 13:10
Though as noted, I'm still very skeptical about returning a Match object from a different parse as if it were part of this one
I'd really just attach it with `make`, like I suggested before 13:11
13:15 MasterDuke joined 13:19 sena_kun joined 13:22 Altai-man_ joined
abraxxa The Match type is documented as return on successful match 13:24
jnthn: can you please point me at an example as I haven't gotten my head around make/made examples in the docs 13:25
13:25 sena_kun left 13:26 HoboWithAShotgun joined 13:28 [Coke] joined, [Coke] left, [Coke] joined 13:29 Doc_Holliwood left 13:37 lucasb joined 13:40 abraxxa left 13:41 abraxxa joined 13:54 stoned75 joined
xkr47 MasterDuke, thx! 13:55
MasterDuke np
xkr47 it's not in docs.perl6.org/type/Mu ? 13:56
MasterDuke it's not a method of Mu. it's a special compiler thing 14:03
docs.perl6.org/language/typesystem...thod_names 14:04
chloekek I have an issue where precompiling a module that uses NativeCall can't find NativeCall, but requireing it at runtime succeeds. 14:17
With the command: perl6 install-dist.p6 --from=sourcedir --to=inst#targetdir 14:19
The error message says it can't find NativeCall in inst#targetdir, but does not mention anything else, even if I set PERL6LIB first to include inst#<rakudo>/share/perl6/core 14:20
scimon SmokeMachine: I just hadn't really thought about it (and not seen it done in a number of the frontend tools I've seen). 14:22
xkr47 ok, thx! 14:24
Ulti scimon: it might be nice to actually have a trait like "is main" that actually does that wiring
scimon Well you can just export as MANDATORY too. But I figured having it as an optional import means you can test your plugin code without pollution. 14:28
14:28 Geth joined
scimon Anyway going to do a little Advent calendar about it and command line tools with Raku in general. 14:28
chloekek Turns out adding inst#targetdir to PERL6LIB magically fixes it. 14:29
tyil chloekek: nice 14:34
japhb scimon: Why explicitly have a MAIN for --help in your gist? That's builtin. Or was it just because you wanted -h instead of -? for the short version? 14:36
chloekek tyil: Not really, I have no idea why this is necessary, and why it would cause the lookup to suddenly find NativeCall 14:38
japhb scimon: Also, I'm not sure what's the plugin case you're talking about ... just exporting MAIN multis from a module? If so, that's how doing an "app module" (so your bin script can just be "#!/usr/bin/env perl6\nuse App::Foo;") generally works. And yeah, making an optional MAIN export is a way to do testing -- that's an old Python trick IIRC. 14:39
scimon Basically yes. I generally always specify the help endpoint for completeness. 14:56
But the point with the plugin idea is if you look at something like Zef or App::Mi6 (two Raku CLI tools I use) both have all the MAIN sub's in a single file (one is the main script the other a CLI module). I was going to explain that you could split your MAIN code out allowing for easier additions of new functionality. 14:59
japhb scimon: Ah, I see. Yeah, that might be useful to point out. 15:08
xinming_ m: my $x = "hello.ext"; my $s = ($x ~~ S/".ext"$/ ~ ".new-ext"); $s.say; 15:09
camelia 5===SORRY!5=== Error while compiling <tmp>
Cannot use variable $s in declaration to initialize itself
at <tmp>:1
------> 3 $s = ($x ~~ S/".ext"$/ ~ ".new-ext"); $7⏏5s.say;
expecting any of:
double quotes
infix…
xinming_ m: my $x = "hello.ext"; my $s = (($x ~~ S/".ext"$/) ~ ".new-ext"); $s.say; 15:10
camelia 5===SORRY!5=== Error while compiling <tmp>
Cannot use variable $s in declaration to initialize itself
at <tmp>:1
------> 3s = (($x ~~ S/".ext"$/) ~ ".new-ext"); $7⏏5s.say;
expecting any of:
double quotes
infix…
xinming_ m: my $x = "hello.ext"; my $s = (($x ~~ S/".ext"$ /) ~ ".new-ext"); $s.say;
camelia 5===SORRY!5=== Error while compiling <tmp>
Cannot use variable $s in declaration to initialize itself
at <tmp>:1
------> 3 = (($x ~~ S/".ext"$ /) ~ ".new-ext"); $7⏏5s.say;
expecting any of:
infix stopper
term
xinming_ Anyway to fix this as a one liner?
japhb The bigger plugin thing that I need to get around to at some point is being able to determine all installed modules in a namespace and load them all at BEGIN time, without iterating over *all* installed modules (including those *not* in the namespace), because, well, that's slow.
xinming_ 3: my $x = "hello.ext"; my $s = ($x ~~ s/".ext"$/.new-ext/; $s.say; 15:11
m: my $x = "hello.ext"; my $s = ($x ~~ s/".ext"$/.new-ext/; $s.say;
camelia 5===SORRY!5=== Error while compiling <tmp>
Cannot use variable $s in declaration to initialize itself
at <tmp>:1
------> 3; my $s = ($x ~~ s/".ext"$/.new-ext/; $7⏏5s.say;
expecting any of:
term
xinming_ I know this worked, But I just want to use S//
m: my $x = "hello.ext"; $x ~~ s/".ext"$/.new-ext/; $x.say;
camelia hello.new-ext
xinming_ m: my $x = "hello.ext"; my $s = (($x ~~ S/ ".ext" $ /) ~ ".new-ext"); $s.say; # <-- Is this a bug? 15:12
camelia 5===SORRY!5=== Error while compiling <tmp>
Cannot use variable $s in declaration to initialize itself
at <tmp>:1
------> 3 (($x ~~ S/ ".ext" $ /) ~ ".new-ext"); $7⏏5s.say; # <-- Is this a bug?
expecting any of:
in…
xinming_ ignore me, I just realized that S/// also need the replace ment. 15:17
15:20 abraxxa left, abraxxa joined 15:22 abraxxa left 15:23 sena_kun joined
SmokeMachine scimon: so you prefer adding .^grep and .^map then not adding any alias? 15:23
15:23 sena_kun left 15:24 Altai-man_ left 15:32 robertle joined
ZzZombo m: say |$(1,2,3) 15:34
camelia 123
ZzZombo m: say $(1,2,3)
camelia (1 2 3)
ZzZombo m: say ^'1.0'
camelia 0..^1.0
ZzZombo m: say 1 .= 'Str' 15:35
camelia 5===SORRY!5=== Error while compiling <tmp>
Quoted method name requires parenthesized arguments. If you meant to concatenate two strings, use '~'.
at <tmp>:1
------> 3say 1 .= 'Str'7⏏5<EOL>
scimon Well as long as they are aliases then I don't see why not. If they simplify things that are done a lot it makes sense.
ZzZombo m: say 1 .= 'Str'()
camelia Cannot modify an immutable Int (1)
in block <unit> at <tmp> line 1
scimon SmokeMachine: ^
ZzZombo m: say my Int $a .= 'new'() 15:36
camelia 0
ZzZombo m: say 1 mod 0 15:38
camelia Attempt to divide 1 by zero using div
in block <unit> at <tmp> line 1
ZzZombo LTA message detected.
m: say 0x1 ~< 1 15:40
camelia Cannot resolve caller infix:«~<»(Int:D, Int:D); none of these signatures match:
(Str:D \a, Int:D \b --> Str:D)
(str $a, int $b)
in block <unit> at <tmp> line 1
ZzZombo m: say 0x1 +< 1
camelia 2
ZzZombo m: say 0x1 +< 1 xx 4 15:41
camelia (2 2 2 2)
SmokeMachine scimon: thanks 15:42
15:43 chloekek left
ZzZombo m: my $x = 1 | 2 | Inf;say ^Inf.pick ~~ $x 15:46
camelia True
ZzZombo m: my $x = 1 | 2 | Inf;say ^Inf.pick ~~ $x
camelia True
japhb ZzZombo: You can /msg the bot, so that you don't have to clutter the channel
15:53 pmurias joined
ZzZombo m: my $x = 1 | 2 | Inf;my $y = (-3..3).pick;say $y, ' ', $y ~~ $x # how can I know what case exactly is met in the junction? 15:53
camelia -3 False
stoned75 does anyone know if Pod-Utilities was initially written for Documentable ? 16:00
I found something strange in Documentable and I would fix it by modifying Pod::Utilities::textify-guts() :-} 16:02
SmokeMachine lizmat: Hi! thank you for your PR! Is ` ` `raku working on github already? 16:07
\`\`\`raku 16:08
AlexDaniel I don't think so
SmokeMachine sorry, I dont know how to scape that...
tadzik ```raku? :)
lizmat SmokeMachine: ah, maybe I was too eager... 16:11
16:12 perlmaros left
lizmat SmokeMachine: should I submit another PR that is less eager ? 16:12
16:13 perlmaros joined
SmokeMachine lizmat: could you, please? 16:19
lizmat sure, no pb
AlexDaniel squashable6: status 16:24
squashable6 AlexDaniel, ⚠🍕 Next SQUASHathon in 3 days and ≈11 hours (2019-11-16 UTC-12⌁UTC+20). See github.com/rakudo/rakudo/wiki/Mont...Squash-Day
AlexDaniel can somebody step in and figure out what we can do with the squashathon this month? :)
Geth problem-solving/master: 4 commits pushed by (Aleks-Daniel Jakimenko-Aleksejev)++ 16:25
lizmat SmokeMachine: done 16:30
16:49 cognomin_ joined 16:53 perlmaros left 16:54 perlmaros joined, perlmaros left 16:57 scimon left 17:00 joule left 17:14 pmurias left
stoned75 ok so I have a fix to solve the duplicate entries in docs.perl6.org/routine.html 17:15
so ones due to whitespace at least, a couple are due to typos 17:16
*the ones 17:17
17:24 sena_kun joined
stoned75 oh there are still some :} 17:28
lizmat and another Rakudo Weekly hits the Net: rakudoweekly.blog/2019/11/11/2019-45-red-alert/ 17:30
cpan-raku New module released to CPAN! Gnome::Glib (0.15.1) by 03MARTIMM 17:37
lizmat that'll be in next weeks :-) 17:38
dinner&
sena_kun SmokeMachine, o/ 17:43
are you around?
SmokeMachine sena_kun: hi!
sena_kun \o/
SmokeMachine lizmat: thank you! 17:44
sena_kun SmokeMachine, I am now writing an advent post involding Red, and wanted to ask what the solutions to "hash your password" problem. With raw postgresql (for example) I can use pgcrypt extension, but when it comes to what to _safely_ do using models, I am not sure. Any suggestions? 17:45
17:46 donaldh joined
SmokeMachine sena_kun: the way I was thinking of suggesting it was using `has $.password is column{ :deflate(&encript-it) }`... 17:46
sena_kun SmokeMachine, it is NYI, right? 17:48
SmokeMachine github.com/FCO/Red/issues/141
sena_kun: I dont think so...
sena_kun hmm, I probably want to use something like github.com/skinkade/p6-crypt-argon2 manually... 17:51
SmokeMachine yes... 17:52
with :deflate
sena_kun SmokeMachine, why do I need it? I mean, if I manually hash and save a pass and then manually hash things again to check 17:53
SmokeMachine sena_kun: if you use :deflate you will not need to hash it when save... (maybe not enough to use it...) 17:55
sena_kun: www.irccloud.com/pastebin/4ktGMRGc/ 17:57
sena_kun: www.irccloud.com/pastebin/NR5o6KvB/ 18:02
I think it should auto deflate... 18:03
sena_kun SmokeMachine, oh, I see what you mean, so it is partially implemented... I still think for an example it'd be easier to do it directly though.
SmokeMachine, a stupid question, but of course input data is escaped, right? 18:07
SmokeMachine sena_kun: it's binded if the container is rw... www.irccloud.com/pastebin/hpC4r7BN/ 18:10
sena_kun SmokeMachine, sorry, I meant the other thing, I mean, special characters are escaped in input data? 18:12
SmokeMachine sena_kun: what kind of special char?
sena_kun quotes 18:13
18:14 donaldh left
SmokeMachine sena_kun: I don't remember of doing that... I relly on binding for not being SQL injected 18:15
18:15 donaldh joined
SmokeMachine relie? 18:16
sena_kun *rely
18:20 donaldh left 18:22 newbie joined, newbie left 18:26 abraxxa joined, donaldh joined 18:29 abraxxa left 18:30 abraxxa joined 18:31 rindolf joined
rindolf hi all 18:31
18:31 donaldh left 18:34 abraxxa left 18:35 abraxxa joined 18:36 wildtrees joined
guifa sena_kun I think I found the bugs, I’ll should probably have an update for date formatting coming out tonight or tomorrow am 18:36
18:37 wildtrees left
sena_kun guifa, your efforts are awesome, but I used a simple hash, so don't hurry too much. 18:37
18:38 Kaiepi joined
guifa don’t tell me that lol. If I don’t have a reason to finish stuff it ends up going undone haha 18:38
sena_kun guifa, I'll gladly patch things to remove that one `# SUPER DIRTY WE WANT TO USE CLDR HERE` comment I left. :P 18:39
18:40 wildtrees joined 18:45 chloekek joined
guifa Eeeew okay yeah I’m going to help you get rid of it. 18:49
18:49 joule joined 19:00 donaldh joined 19:05 donaldh left 19:22 Altai-man_ joined
SmokeMachine sena_kun: isn't that enough? 19:24
19:24 sena_kun left
guifa Is there any way to allow subclasses access to private attributes of parent classes withouth allowing outside access? The “trust” model unfortunately only works if you know the classes in advance / defined in the same file. 19:35
Altai-man_ guifa, roles? 19:36
19:37 abraxxa left 19:38 abraxxa joined
guifa p6: role A { has $!a = 1 }; class B does A { method b { self!A::a } }; say B.new.b 19:39
camelia 5===SORRY!5=== Error while compiling <tmp>
Cannot call private method 'a' on package A because it does not trust B
at <tmp>:1
------> 3}; class B does A { method b { self!A::a7⏏5 } }; say B.new.b
expecting any of:
met…
El_Che releasable6: status
releasable6 El_Che, Next release will happen when it's ready. There are no known blockers. 248 out of 470 commits logged (⚠ 9 warnings)
El_Che, Details: gist.github.com/85ff4b080e28b29377...4fa0cb15a2
Altai-man_ guifa, you don't need fancy accessors with roles... 19:41
m: role A { has $!a = 1 }; class B does A { method b { $!a } }; say B.new.b
camelia 1
guifa I … did not realize private role attributes are accessible like that. I figured scope would be identical to subclasses 19:42
Altai-man_ no, roles are composed into classes, so privates and non-privates are available just as they'd be in a class itself
if you want some chunk of thing including privates to be pluggable, you stick it into a role. but classes are classes, they keep their stuff, so `protected` is not really necessary. 19:43
19:43 donaldh joined
guifa altai-man++ Makes sense, I think before hand the only time I had worried about stuff like that was dealing with overlapping method names, where the namespace reference was necessary 19:45
19:47 donaldh left 19:55 donaldh joined 19:59 donaldh left
xkr47 Altai-man_, could the error message be improved? 20:03
Altai-man_ xkr47, sorry, which one?
xkr47 the one guifa triggered
I'm a noob, just asking :) 20:04
Altai-man_ xkr47, improved how? I mean, technically it says truth: you can't call a private from A because it doesn't trust B its privates.
xkr47 could it recognize it's a role and give a tip on how to proceed? 20:05
Altai-man_ I suspect that "Maybe you want to compose a role" is a bit too much of a suggestion. And `trusts` syntax (`self!A::a`) is not that basic, I think in general people get to know roles earlier than trusts.
xkr47 but yeah don't want to harass, just thinking
ok thanks 20:06
Altai-man_ ah, you mean that A is a role already...
xkr47 yeah
Altai-man_ xkr47, you can try to suggest a patch and see what core devs think. :) 20:08
xkr47 sorry I'm way too noob for that
xkr47 bows gracefuly
+l
Altai-man_ let me see... 20:09
I must say I am really confused right now 20:12
oh, no 20:13
xkr47, I know how to patch that up, if you want, you can just clone / change a couple of lines in rakudo code under my guidance and send a PR. :) 20:18
stoned75 ok I think I removed all duplicate entries from doc's routines.html, due to incorrect processing, but I need a small patch to Pod-Utilities and another to Documentable 20:21
xkr47 Altai-man_, I'm nowhere close writing that kind of code myself, I'm a perl5 guy with a raku calculator :D 20:22
Altai-man_ xkr47, it does not look too different compared to normal raku code though. :) but it is up to you... the message is at github.com/rakudo/rakudo/blob/mast....pm6#L1312 and it is called at github.com/rakudo/rakudo/blob/mast....nqp#L5915 20:24
so I think in `message` method you can have a conditional depending on a new attribute, something like `has $.is-source-role`. 20:26
and then you add initialization code for the new attribute at caller 20:27
what I am not sure about is how to check that $methpkg is a role, but someone more knowlegeable than me knows that for sure 20:28
20:34 joule left 20:41 donaldh joined 20:44 kensanata left 20:55 rindolf left
MasterDuke somebody like vrurg would probably have a better answer, but maybe `!nqp::istype($methpkg.HOW, Perl6::Metamodel::ConcreteRoleHOW)`? 20:59
abraxxa jnthn: I can't get the Grammar actions to work, still 'Cannot assign to a readonly variable or a value' in the line I try to create a Match object from the contents of the included file contents 21:00
21:03 Altai-man_ left 21:17 wildtrees left
timotimo abraxxa: you probably need to "$/ is copy" in your signature 21:17
abraxxa timotimo: the problem was that I named the variable $/ like most of the examples, changing it to something else and using either it or $/ where appropriate made it work 21:18
now I have a solution that puts the code directly in the grammar like stackoverflow.com/questions/513540...r-in-perl6 and one that uses action objects 21:19
21:20 pmurias joined
abraxxa I can't find a good example of how to traverse a complex Match object, is there one? 21:24
guifa abraxxa: in generally you just treat it like hashes/positionals 21:27
Altreus is there a build that produces a raku yet? 21:31
Sorry for not keeping up :)
abraxxa Altreus: 2019.10.1 has a raku executable 21:32
WTF is ~$? 21:34
Altreus I see I see 21:35
21:37 lucasb left
tobs abraxxa: &prefix:<~> is stringification. A sole $ might be the anonymous state variable. 21:39
abraxxa tobs: the search on the docs page doesn't find it
Altreus 10.1 released?
cos it's not here: github.com/rakudo/rakudo/releases 21:40
wait that's rakudo
tobs ~$<something> is a common expression which takes a submatch for 'something' from the current match and stringifies it.
abraxxa: doesn't find what? The prefix tilde is there: docs.perl6.org/routine/~
21:43 donaldh left
abraxxa tobs: I searched for ~$ which returns nothing 21:47
~ alone returns three matches
tobs I know no interpretation of `~$` except as stringification of the variable called `$`. It's a compound expression, that's why it's not in the docs. 21:49
For the same reason, you will not find matches for `$counter++`, but for the ++ operator and for variables separately. 21:50
(I do wonder where ~$ would be useful, though.) 21:51
21:55 chloekek left
Altreus looks like the sort of thing that compiles but 99% of the time is a typo 21:56
abraxxa tobs the example was ~$<key> 21:59
tobs aha!
abraxxa tobs: but as you said searching for a specific variable name doesn't make sense
from here: tpm-regex.perl6.party/#/47 22:00
tobs docs.perl6.org/syntax/$$SOLIDUS#Na...attributes
abraxxa defining the signature as $/ but using $<> makes absolutely no sense to me
tobs that syntax $<key> is short for $/<key>, but I only found it just now via the docs index because I knew what to look for...
well, "short" 22:01
abraxxa the shortcut is only confusing, saving a single letter is not worth it, especially in tutorials!
Perl 6 makes the Perl mistakes again after 20 years and thinks renaming helps but it doesn't 22:02
and what the hell is $<row>».made.hash? 22:04
using 'cool' characters nobody can type is not saving time either
[Coke] Sorry you're having trouble with the Raku synta, abraxxa. 22:05
tobs takes the 'row' submatches (probably something repeated in the regex) and calls .made to each of them, then puts the list of results in a hash. ».&method is like a map which uses a method and is allowed to parallelize. 22:08
abraxxa tobs: and how should you type that? 22:14
tobs altgr+y on a German keyboard? 22:17
alternatively you can use >> instead of » 22:18
22:21 titsuki joined 22:22 wildtrees joined
abraxxa US keyboard here 22:22
tobs m: if "abc" ~~ / [ $<key>=. ]+ c $ / { say $<key>>>.from } 22:23
camelia [0 1]
tobs there is also a page with suggestions on how to type unicode, if you want to docs.perl6.org/language/unicode_entry 22:24
abraxxa I'm getting knowwhere which constructing something useful from the match object of the grammar... 22:30
22:33 Xliff joined
Xliff o/ 22:33
guifa With Pod6, there’s a way to link simple information about a class/method/etc using #| or #= I’ve been interleaving documentation via larger =begin pod / =end pod blocks, is there any sort of a shorthand to link that for the .WHY? I feel a bit repetitive/overkill with the information in #| or #= 22:35
AlexDaniel abraxxa: there's no raku executable yet 22:36
even in the next release 22:37
it seems that having one is a bit more difficult than it sounds
MasterDuke guifa: i'd suggest asking tbrowder
AlexDaniel but PRs welcome :)
abraxxa AlexDaniel: I have one 22:38
AlexDaniel: /opt/rakudo-pkg/bin/raku
AlexDaniel mm maybe that's because you're using rakudo packages by El_Che? :)
MasterDuke abraxxa: i think El_Che is doing that manually
AlexDaniel building rakudo from source won't give you that 22:39
guifa .tell tbrowder: anyway to link larger pod blocks to classes/subs for use in .WHY? I feel a bit repetitive using both for each class in some of my files
tellable6 guifa, I'll pass your message to tbrowder
abraxxa this one nxadm.github.io/rakudo-pkg/#os-repositories
tbrowder .guifa 22:41
guifa: i don't think so at the moment, but if you can give me an example of what you want as an issue that would be helpful 22:43
i have one PR ready to merge (after next release) that might help a bit 22:44
it prvides a way to keep your formatting in the leading declarator blocks instead of giving one giant string 22:45
22:47 wildtrees left
abraxxa Why do I get 'Too few positionals passed; expected 1 argument but got 0' for method inface ($/) { make foo => 'bar' } 22:48
TreyHarris abraxxa: the error is being thrown from the line where that method is defined? not some other line? 22:50
guifa tbrowder: take a look at gist.github.com/alabamenhu/b717925...b1c2d12ab1
abraxxa the make line
tobs it is because `make foo => 'bar'` passes a named argument foo with value 'bar' to make, instead of passing a pair as a positional argument. 22:52
abraxxa tobs: where is the difference to tpm-regex.perl6.party/#/47 ?
row
tobs the first fix that comes to mind is itemizing `make $(foo => 'bar')` 22:53
guifa tbwoder: not necessarily thinking that syntax, but maybe something similar to that one could even be expanded to allow explicit references to classes/methods, e.g. “the new-item method {{CLDR:Calendars.NEW-ITEM|makes a new calendar item}} and should only be used be used internally and not be end users”, which would link just the “makes a new calendar item” text to the NEW-ITEM method.
tobs abraxxa: you'll not like the answer. There `$<header>.made` is not a valid variable name, so the parser knows not to turn that into a named argument. 22:54
abraxxa tobs: there is a rule named header 22:55
tobs: the example in docs.perl6.org/language/grammars#Action_objects is not very different
method pair 22:56
TreyHarris putting just the parens around the make(...) args should be enough to fix it
22:56 mid_home left
tbrowder guifa: that hurts my brain! can you take your example and show results you would like to see for the .WHY 22:56
TreyHarris well, double parens, in this case, since you're using a bare `foo`
guifa tbrowder: sure. Lemme edit the gist 22:57
22:57 xinming_ left
abraxxa TreyHarris: nope, tried that already 22:58
TreyHarris the sub form of make() takes a Mu. A pair is a Mu (anything is, really). But it is exactly one thing. By doing `make foo => bar` you're either giving make two things or you're....
abraxxa doc examples that don't compile don't make much sense! 22:59
TreyHarris abraxxa: doubling the parens still gives you the `expected ` argument but got 0`?? How about `make($(foo => 'bar'))`?
tbrowder guifa: the PR is the first step in try to get more user-desired formatting in the declarator blocks, including the name of the object being attached to
abraxxa: is there a token for the method? 23:00
guifa tbrowder: my proposal is a bit different, but your current PR would definitely be relevant
tobs The difference is that `foo` is a valid variable name, whereas `$<header>.made` is not. So `foo => bar` in a call context becomes a named argument of the callee, whereas `$<header>.made => 'bar'` in the same situation becomes a positional Pair argument.
23:00 xinming_ joined
TreyHarris m: sub bleeb (Mu $x) { say $x.WHAT }; bleeb(3 => 4); bleeb(foo => 4) 23:00
camelia (Pair)
Too few positionals passed; expected 1 argument but got 0
in sub bleeb at <tmp> line 1
in block <unit> at <tmp> line 1
TreyHarris ^ 23:01
abraxxa I also tried make 'foo' => 'bar';
m: sub bleeb (Mu $x) { say $x.WHAT }; bleeb('foo' => 'bar') 23:02
camelia (Pair)
abraxxa so => in Perl 6 doesn't stringify the lhs? 23:03
TreyHarris abraxxa:no.
=> is the Pair constructor. Well, *a* Pair constructor. 23:04
abraxxa I want a hash 23:06
guifa tbrowder: I updated the gist: gist.github.com/alabamenhu/b717925...b1c2d12ab1
TreyHarris m: my $x = 'foo' => 'bar'; my $y = :foo('bar'); my $z = $(foo => 'bar'); say $x === $y; say $x === $z; 23:07
camelia True
True
TreyHarris m: my %g = %(foo => 'bar', bat => 'baz'); say %g<bat>; say %g<foo>; 23:08
camelia baz
bar