🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). This channel is logged for the purpose of keeping a history about its development | evalbot usage: 'm: say 3;' or /msg camelia m: ... | Log inspection is getting closer to beta. If you're a beginner, you can also check out the #raku-beginner channel! Set by lizmat on 25 August 2021. |
|||
tonyo | new keyboard just got here, maybe this cro post will have enough time to make it into RKW | 00:01 | |
00:08
reportable6 left
00:09
reportable6 joined
00:13
Darkcoal left
01:07
benchable6 joined
01:43
lainon joined
01:45
lainon left
01:50
jjido left
02:10
tetramelly joined
02:30
tetramelly left
|
|||
guifa | I'll be posting a return to the "What's everyone working on" on reddit tomorrow | 03:23 | |
03:30
evalable6 left,
linkable6 left
03:31
evalable6 joined
|
|||
Xliff | tonyo: Got a URL for that blog? | 04:34 | |
guifa: For me? GDA/GDA-UI bindings for Raku | |||
www.gnome-db.org/ | 04:35 | ||
05:02
evalable6 left
|
|||
guifa | Xliff: I look forward to a post on it | 05:15 | |
I think codesections had the right idea. Weekly is probably too much, but maybe a stickied monthly one will be the right trick. It'll also draw attention for casual viewers of new cool stuff happening | |||
05:25
Xliff left
06:08
reportable6 left
06:31
linkable6 joined
06:35
alfonsox joined
06:52
abraxxa joined
06:57
abraxxa left,
abraxxa joined
07:05
evalable6 joined
07:11
reportable6 joined
07:34
Sgeo left
07:53
ShaneC joined
08:18
jjido joined
08:39
ShaneC left
08:48
lizmat_ joined,
TempIRCLogger__ joined
08:49
Geth left,
RakuIRCLogger__ joined
08:50
TempIRCLogger left
08:51
lizmat left,
RakuIRCLogger left
08:53
RakuIRCLogger__ left,
RakuIRCLogger joined
08:59
dakkar joined
09:00
lizmat_ left
09:01
lizmat joined,
RakuIRCLogger left,
Geth joined
09:04
jjido left
|
|||
El_Che | morning | 09:05 | |
09:05
Geth left,
Geth joined
|
|||
Nemokosch | ^^ | 09:05 | |
okay, this explains why I didn't notice the weekly challenge | 09:10 | ||
09:32
p6steve_1 joined
|
|||
p6steve_1 | hi - is there a neat way to get back the sort order indices from .sort on a List (I can imagine some map that uses kv somehow, but is there just a methos I have missed? | 09:34 | |
) | |||
(ah I see I am now 3 people ... soz, will fix after this) | 09:35 | ||
09:35
Oshawott joined
09:37
archenoth left
|
|||
Nemokosch | I don't think I could help but still it would be good to understand the question... | 09:41 | |
MasterDuke | something like `[2, 6, 4].sort(:indices)` to return `[0, 2, 1]`? | 09:44 | |
m: `say [2, 6, 4].pairs.sort(*.value).map(*.key)` | 09:49 | ||
camelia | ===SORRY!=== Error while compiling <tmp> Bogus statement at <tmp>:1 ------> <BOL>⏏`say [2, 6, 4].pairs.sort(*.value).map(* expecting any of: prefix statement list term |
||
MasterDuke | m: say [2, 6, 4].pairs.sort(*.value).map(*.key) | ||
camelia | (0 2 1) | ||
MasterDuke | but i don't know of a single pre-existing method/sub to do that | 09:50 | |
Nemokosch | oh | 09:57 | |
p6steve_1 | yes MasterDuke, that's the correct interpretation of the question | 10:08 | |
and the kind of thing I meant when I was imagining a map of kv (or Pairs) | |||
CIAvash | m: say [2, 6, 4].antipairs.sort».value; say [2, 6, 4].antipairs.sort.hash.values; | 10:16 | |
camelia | (0 2 1) (2 0 1) |
||
CIAvash | m: say [2, 6, 4].antipairs.sort».value; say [2, 6, 4].antipairs.sort.hash.values; | ||
camelia | (0 2 1) (0 2 1) |
||
p6steve_1 | thanks - some neat options! | 10:23 | |
10:32
p6steve_1 left
10:42
p6steve_1 joined,
p6steve_1 left
10:44
Kaiepi left,
Kaiepi joined
10:48
p6steve_1 joined
10:49
p6steve_1 left
10:53
jjido joined
10:55
p6steve left
10:57
p6steve joined
|
|||
p6steve | back to my true self (rather than p6steve_1) ... thanks to the magic of screen -r | 11:06 | |
11:39
frost left
11:59
jjido left
12:07
reportable6 left
12:08
reportable6 joined
12:23
jjido joined
12:55
tejr_ joined
12:57
tejr left,
tejr_ is now known as tejr
12:59
jjido left
13:15
alfonsox left
|
|||
lizmat | PSA: the next Rakudo Weekly will be posted on 7 March, unless someone pressed a red button somewhere | 13:27 | |
perryprog | drat, no red button emoji | 13:28 | |
dakkar | 🈲 (U+1F232 japanese "prohibited sign") maybe? | 13:31 | |
13:33
p6steve left
13:36
p6steve joined,
p6steve left
13:39
p6steve joined
13:56
Kaiepi left
13:57
Kaiepi joined
14:55
epony left
15:07
frost joined
15:31
Sgeo joined
15:36
frost left
16:58
epony joined
16:59
jjido joined
17:17
abraxxa left
17:29
[Coke] joined
17:30
jjido left
17:40
dakkar left
18:07
Hello16 joined
18:08
Hello16 left,
reportable6 left
|
|||
guifa was thinking about adding flairs on the reddit page | 18:16 | ||
User flairs could help nwecomers see that vrurg and lizmat work on core that way, and some the regular posts could be flaired like weekly challenges, weekly editions, new release, etc. | 18:17 | ||
Thoughts? | |||
18:28
Xliff joined
|
|||
Xliff | \o | 18:28 | |
Given the signature for a method, the first parameter should always be the invocant, correct? If said invocant is class A, how can I turn that parameter from A:D to A:U ? | 18:29 | ||
18:30
simcop2387 left,
perlbot_ joined,
perlbot left,
simcop2387 joined,
jjido joined
|
|||
japhb | Xliff: I'm not sure what you mean. Do you want to know the type object of the invocant? Like 'self.WHAT' or so? | 18:32 | |
18:32
perlbot_ is now known as perlbot
|
|||
Xliff | japhb: See here - replit.com/@Xliff/DeadExoticRecords#main.raku | 18:32 | |
Is there a way to turn the first so that it is like the second? | 18:33 | ||
18:35
ShaneC joined
|
|||
japhb | I'm now *more* confused. I get two identical lines output. What do you get? | 18:39 | |
Xliff | Oh. Sorry. I was doing more debugging. One sec. | 18:41 | |
OK, If you run it now, you will get two different type constraints. | 18:42 | ||
I'm trying to figure out how I can turn a signature like the first, into the second. | |||
tonyo | m: class A { method a(A:U: Str $a) { say $a; }; }; A.a("hello"); | 18:43 | |
camelia | hello | ||
tonyo | m: class A { method a(A:U: Str $a) { say $a; }; }; A.a("hello"); A.new.a('test') | ||
camelia | hello Invocant of method 'a' must be a type object of type 'A', not an object instance of type 'A'. Did you forget a 'multi'? in method a at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
Xliff | tonyo: So if I want, at compile time, to change method A from A:U to A:D -- how would that work? | 18:44 | |
japhb | Oh, wait, are you trying to figure out how to change the signature *during* the compile? As in, at BEGIN time? | 18:45 | |
Xliff | Yep | ||
japhb | I mean, I suppose you could go wrap the method with something with a different signature. Seems a little odd, and feels like an XY question. | 18:46 | |
*Why* do you want to do this? | |||
Xliff | I'd like to try something. | ||
So you can't change the signature on the method directly, I suppose? | 18:47 | ||
I mean. I've always disliked the whole type-smiley mechanism. I want to see if I can do it one better via traits. | |||
Have the trait pun the method, which alters the signature. | 18:48 | ||
japhb | Huh. | ||
Interesting idea. | |||
Xliff | so -- class A { method a (Str $a) is static { 1 } }; | ||
Same as -- class A ( method a (A:U: Str $aA) { 1 } } | 18:49 | ||
Same as -- class A ( method a (A:U: Str $a) { 1 } } # oops | |||
And my syntax is all a mess, but you should be able to get the idea. | 18:50 | ||
guifa | Xliff: I think you could wrap the method and accomplish that pretty easily | ||
Xliff | guifa: But I'd have to wrap the method.... | ||
Please illustrate! | 18:51 | ||
japhb | m: class B {}; B.say; B:U.say; my $bu = B:U; $bu.say; | 18:53 | |
camelia | (B) (B:U) (B:U) |
||
japhb | (Just thinking that might allow you to replace the type of the method, or at least programmatically create a :U version of a class) | 18:54 | |
m: class B {}; my $b = B; my $bu = $b:U; $bu.say; | |||
camelia | ===SORRY!=== Error while compiling <tmp> Variable '$b:U' is not declared. Did you mean '$bu'? at <tmp>:1 ------> class B {}; my $b = B; my $bu = ⏏$b:U; $bu.say; |
||
japhb | Sadly, it doesn't like that. | ||
m: class B {}; my $b = B; my $bu = ::($b):U; $bu.say; | 18:55 | ||
camelia | Use of uninitialized value element of type B in string context. Methods .^name, .raku, .gist, or .say can be used to stringify it to something meaningful. in block <unit> at <tmp> line 1 No such symbol '' in block <unit> at <tmp> line 1 |
||
japhb | m: class B {}; my $b = B; my $bu = ::($b.^name):U; $bu.say; | ||
camelia | (B) | ||
japhb | AH, and there's the rub. | ||
guifa | m: multi sub trait_mod:<is>(Method \m, :$static!) { m.wrap: anon method (|) { say "nope" and exit if self.defined; callsame } }; class F { method f is static { say "yay" } }; F.f; F.new.f | 18:56 | |
camelia | yay nope |
||
guifa | You won't be able to have a static and non-static version with the same signature though. With RakuAST / macros / etc I think it'll be possible to actually manipulate the signature | 19:03 | |
Xliff | guifa: That's what I'm hoping | 19:04 | |
guifa - Nice! For my purposes, that limitation is fine, I can always fall back on the original method in that case. | 19:05 | ||
Hmm... would nice to keep the defined check at the dispatch level though. | 19:06 | ||
RakuAST is going to have some large shoes t o fill. | |||
tonyo | you should be able to do that with nqp to set the $!flags attribute in the Parameter | 19:07 | |
19:08
reportable6 joined
|
|||
guifa | an open question is to what degree a trait will be able to mianipulate stuff. if it received (and returned) a RAST::Node, tere's some amazing cool stuff you could do BUT it would probably break backwards compatibility where traits expect compiled objects instead. maybe there will be a different trait_mod keyword that gets the RAST (it's not like it shouldn't be possible to add in more trait_mods besides handles, is, and does) | 19:09 | |
tonyo | update, you can. Xliff | 19:14 | |
m: use nqp; class A { method a (A: Str $a) { }; method b (A:U: Str $b) { }; }; my $param := A.^lookup("a").signature.params[0]; dd $param.modifier; my int $flags = nqp::getattr($param, $param.WHAT, "\$!flags"); my int $f = 1 +< 16; $flags = $flags +$f; nqp::bindattr_i($param, $param.WHAT, "\$!flags", $flags); dd $param.modifier | |||
camelia | "" ":U" |
||
tonyo | that 1+<16 should be replaced with the CONST in src/Parameter | 19:15 | |
github.com/rakudo/rakudo/blob/mast...er.pm6#L30 | |||
guifa | lol @ slurpy-lol | 19:16 | |
tonyo | ? | 19:17 | |
guifa | github.com/rakudo/rakudo/blob/0288...er.pm6#L19 | ||
my constant $SIG_ELEM_SLURPY_LOL = 1 +< 5; | |||
ugexe | didnt there use to be an lol method or sub? | ||
tonyo | oh haha | ||
ugexe | pre 6.c | ||
guifa | I'm guessing it was "list of lists"? | ||
ugexe | yeah | ||
tonyo | also used to be a dragon with a gold tooth in zef | 19:18 | |
guifa | I'm guessing | ||
slurpy_pos = *@foo | |||
slurpy_lol = **@foo | |||
and slurpy_onearg = +@foo | |||
(or maybe * and ** are flipped, I literally wrote a blog post on it and I still get them mixd up ) | 19:19 | ||
Xliff | tonyo: Yeah... looked at that. Not exposed, so I can't use it. | 19:31 | |
tonyo | you can use it. | ||
Xliff | But thanks for the idea! My brain should have twigged on to it. I am still getting used to nqp. | ||
tonyo | you have to use nqp to get at it | ||
Xliff | Not $!flags... the constant. | 19:32 | |
tonyo | i know. you could also do something funky like determining which bit it is by comparing A:U and A: so that it doesn't break if that constant changes | 19:34 | |
Xliff | Um. That would need a known A:U for it to work. | 19:35 | |
But thanks for the ideas! # tonyo++ | |||
tonyo | the flag is the same regardless of type | 19:38 | |
19:44
jjido left
19:58
Sgeo_ joined
20:00
Sgeo left
|
|||
Xliff | japhb / tonyo / giufa--replit.com/@Xliff/DeadExoticRecords#main.raku | 20:00 | |
tonyo | does that site take ~15s to show you the files @Xliff? | 20:01 | |
Xliff | It should't. Hold on, I'll stick a version on tio. | ||
tio.run/##hZBBa4NAEIXv/oqXIESJXeIl...hIursDcMvw | 20:02 | ||
tonyo | not too shabby | ||
Xliff | Dispatch doesn't catch it though, so.... | 20:04 | |
vtio.run/##hZDBSsNAEIbveYq/JdCEpqG9...jvv9oXXNN8 | |||
guifa went ahead and added flairs to Reddit. so all you redditors, go choose one! | |||
Xliff | Hmmm... the changes should be bound to .signature.params[0], but it looks like the changes just don't take affect. | 20:06 | |
20:07
[Coke] left
20:11
Summer left,
Juerd left,
Summer_ joined,
Summer_ is now known as Summer,
vodkra left
20:12
Juerd joined,
vodkra joined
|
|||
Xliff | Any new blogs this week? | 20:18 | |
20:23
renormalist left,
renormalist joined
20:32
Darkcoal joined
|
|||
gfldex | Xliff: as long as there is already a multi, you can use add_dispatchee to transform arguments: gist.github.com/gfldex/0df500d560d...2a3a3bad6a | 20:33 | |
MasterDuke | moritz: when could/would `$/` be readonly? | 20:38 | |
guifa | MasterDuke seems when it's a parameter | 20:40 | |
MasterDuke | github.com/Raku/old-issue-tracker/issues/3012 is the original bug report, i'm going to experiment with it's examples | 20:41 | |
hm, they give `Nil` now | 20:43 | ||
and on all releases (from 6.c on) | 20:44 | ||
guifa: but if you can come up with an example that would be much appreciated | 20:45 | ||
guifa | MasterDuke this seems quite different from that bug report but | 20:46 | |
m: grammar G { token TOP { . } }; class A { method TOP ($/) { 'a' ~~ /a/ } }; G.parse: 'b', :actions(A) | |||
camelia | Cannot assign to a readonly variable or a value in method TOP at <tmp> line 1 in regex TOP at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
guifa | $/ = always gives a perlisms error, and $/ := gives bad LHA | 20:47 | |
20:47
jjido joined
|
|||
MasterDuke | i need to test it with s///, but afk for a bit | 20:48 | |
guifa | MasterDuke same here, afk for probably the day, but this causes the same issue with s/// | 20:49 | |
grammar G { token TOP { . } }; class A { method TOP ($/) { 'a' ~~ s/a/b/ } }; G.parse: 'b', :actions(A) | |||
m: grammar G { token TOP { . } }; class A { method TOP ($/) { 'a' ~~ s/a/b/ } }; G.parse: 'b', :actions(A) | |||
camelia | Cannot assign to a readonly variable or a value in method TOP at <tmp> line 1 in regex TOP at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
20:56
tejr left,
tejr joined
21:53
jjido left
21:56
jjido joined
22:00
jjido left
22:08
p6steve__ left
22:14
Darkcoal left
|
|||
ShaneC | is it feasible to compile raku on windows without using the same toolchain that compiled perl? | 22:20 | |
compile rakudo* | 22:22 | ||
MasterDuke | should be, yeah | 22:24 | |
tonyo | this cro post turned out to be a monster | ||
tbrowder: Xliff: deathbykeystroke.com/articles/2022...art-1.html | 22:26 | ||
22:48
codesections5 joined
22:50
kjp left,
maettu left,
perlmaros left,
ilogger2 left,
codesections left,
codesections5 is now known as codesections
|
|||
Xliff | tonyo++ # Thanks! | 22:50 | |
22:51
kjp joined
22:52
maettu joined
22:54
perlmaros joined
23:03
ilogger2 joined
|
|||
tbrowder | tonyo++ you da man!!! | 23:11 | |
23:31
Xliff left
|