🦋 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.
guifa2 if using the EXPORT sub, how would one export a term? I tried just adding, e.g. 'foo+' as one of the export keys, but that bombs 03:52
Geth roast: 2800632eb0 | (Zoffix Znet)++ | S02-types/baghash.t
Can .grab() a BagHash key with weight larger than 64 bits

RT#132279: rt.perl.org/Ticket/Display.html?id=132279
04:26
tyil welp, Geth appears to work :D 04:27
db48x does anyone know how raku knows which punctuation characters are paired for use in a regex? 07:13
a few minutes searching reveals github.com/rakudo/rakudo/blob/mast...r.nqp#L260 07:15
the caller knows the goal character, but I can't find the caller 07:16
timotimo i think FAILGOAL is called from the a ~ b c construct 12:07
rindolf mniip: hi, there? 12:19
tbrowder hi, gang 14:03
if i have a class instance, how do i make it take certain actions if the caller exits the program prematurely? i am used to using the END block for non-class things, but i'm sure there are other considerations for a class instance. 14:07
the main action i'm thinking about is saving the current open file content, closing that file, and reporting status to stdout. 14:10
the class has an attribute for the open file handle and name. 14:11
guifa2 You can get the END phaser to work on a class level, but not on an instance level AFAIK 14:40
theoretically you have method DESTROY, but there's no guarantee that will be called
moritz yes, you'd have to do some magic to keep a list of all open instances 14:41
and then in the END phaser, close them all
XOR require your caller to call a .close or .finish method or so on each instance, and make it the caller's responsiblity
and then the caller can do something like my $instance = YourClass.new() will leave { $instance.close } # or however the "will" trait works 14:42
docs.raku.org/language/phasers#ind...will_trait
guifa2 this is probably the easiest, TBH: tio.run/##TY5BCsJADEX3c4pPcSldumgR...GHp3IZ0Yfw 14:43
And then add another method, if necessary, to remove stuff from thel ist as needed
dakkar one problem I see with that, is that all the instances will be kept alive throughout the life of the process… 14:44
(one of the few times where perl's weak refs are very useful) 14:45
tbrowder some caveats for now: one instance, one file 14:50
tbrowder so, given my caveats, it looks like the END should work. thanks, 14:55
guifa: thanks 14:56
moritz: thanks
dakkar: thanks
dakkar m: class Foo { submethod TWEAK() { END { say "would kill {self}" }}; my Foo $a .= new; my Foo $b .= new; say "foo $a $b";
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> 3 new; my Foo $b .= new; say "foo $a $b";7⏏5<EOL>
dakkar m: class Foo { submethod TWEAK() { END { say "would kill {self}" } } }; my Foo $a .= new; my Foo $b .= new; say "foo $a $b";
camelia foo Foo<65263536> Foo<65263568>
would kill Foo<65263568>
dakkar notice that each END in the source code gets installed / executed exactly once 14:57
guifa2 dakkar: indeed, that's what I meant to remove stuff from the list as available. Could probably fairly easily make a "register" and "deregister" class method that the instances call
tio.run/##ZZBBqsJAEET3c4pCslAIATcu...pBF@3lOD4B
dakkar guifa2: SetHash 😜 14:58
but yes
guifa2 dakkar: lol fair. I don't really use sethash that often, I probably should more often
lizmat SN9 launch in about 30 minutes: www.youtube.com/watch?v=NtGutb1R5cQ 15:28
[Coke] lizmat++ 15:33
lizmat looks like it's postponed by 30 mins 15:45
RaycatWhoDat Hey. Got a question about sequences. What are the nuances of making sequences? Any gotchas? 16:39
tbrowder the END in TWEAK works very well for my use case! 16:41
jmerelo RaycatWhoDat: they're lazy by default. 16:45
tellable6 2021-01-24T08:14:44Z #raku <guifa2> jmerelo I've got the talk down to 52 minutes, exporting the video but looks like my laptop will take a bit. Sleeping now but will upload it in the AM and see if I can cut down a few more minutes to do an afternoon upload
jmerelo .tell guifa2 OK 16:45
tellable6 jmerelo, I'll pass your message to guifa2
RaycatWhoDat jmerelo: Gotcha. 16:46
tbrowder oops, END in TWEAK fires even though no class object exists! and i get an exception for attempting a method on a null object. 16:56
trying a "tweak"... 16:57
RaycatWhoDat How do you specify a sequence with a constraint? 16:59
Something like 1, 1, * + * ... * where * is less than 13 17:00
Seems like I'm just getting (Nil)s
tbrowder i fixed it (so far) with "END { if self { self.meth }}" 17:01
MasterDuke m: .say for 1, 1, * + * ... * > 13
camelia 1
1
2
3
5
8
13
21
RaycatWhoDat Hmm
.say for 1, 1, * + * ... * >= 13 17:02
evalable6 1
1
2
3
5
8
13
RaycatWhoDat Ah
That's the problem
Thank you
MasterDuke np
dakkar tbrowder: reminder that, in the general case, you have no way of knowing which object that END block gets called on 17:29
tbrowder oh, ok, hm. any way around that? 17:31
dakkar what guifa2 suugested: keep a set of instances 17:35
dakkar m: class Foo { submethod TWEAK() { END { say "would kill {self}" } } }; my Foo $a .= new; my Foo $b .= new; say "foo $a $b"; 17:35
camelia foo Foo<77087728> Foo<77087760>
would kill Foo<77087760>
dakkar if you only ever create 1 instance, you may get away with that, but at least put a comment explaining the potential problem ☺ 17:36
dakkar disconnects
lizmat and another Rakudo Weekly News hits the Net: rakudoweekly.blog/2021/01/25/2021-...reporting/ 18:38
perry lizmat, where's that picture from? 18:39
lizmat If I remember correctly, it is near Kenso in Scotland 18:40
perry Ha! I was going to guess Scotland. Too bad I didn't ;p
lizmat sadly it was taken with our D800, which doesn't have geoloc hardware :-( 18:41
lizmat afk& 18:46
rba . 19:09
tellable6 2020-12-30T11:49:05Z #raku <patrickb> rba A new rakubrew release (v15) is ready for upload. The website itself can also be updated. (As always: rooster.uber.space/patcloud/index....JLQDZcjbf)
rba patrickb: The new release is (finaly) installed. The website did not work to update. The error is in the email I sent you. Let me know when we can trouble-shoot it. 19:11
tellable6 rba, I'll pass your message to patrickb
pilne so, i'm loving the zip download with the set-env.bat file, it's great for learning with raku wherever i can take my USB stick, i've just got a quick question about where zef will install modules to by default with that setup, will it dump them in the extracted file structure somewhere (good) or in userspace somewhere(bad)? thanks in advance! 19:37
El_Che lizmat: d800? you hipster. I have the D700 :)
tony-o pilne: zef defaults to site#, if you wish to force it you can use `zef install --install-to ...` 20:09
pilne ty 20:12
i don't want to be dumping raku modules and such all over my corporate box, even if i'm finding ways to use raku to make my job easier :D
guifa2 tony-o: as we transition to fez, would you recommend us continuing to post one of the other ecosystems for the near future? 20:20
tellable6 2021-01-25T16:45:46Z #raku <jmerelo> guifa2 OK
tony-o pilne: you can find that out via 20:25
m: say $*REPO.repo-chain.grep({($_.^can('name')//(sub {0})).first.($_) eq 'site'}).first.abspath
evalable6 Use of Nil in string context
/tmp/whateverable/rakudo-moar/a3c7d00d84d50a0951c8ac5340dcb3a365aae601/share/perl6/site
in block at /tmp/6FokvMEm4f line 1
tony-o hm, that works on my box
tony-o you can also just dump $*REPO.repo-chain and look for the one that says `site` 20:26
guifa2: i'm not opposed to it just for posterity - people using older versions of zef would benefit from them being on p6c but ultimately i'd like to see p6c deprecate 20:27
guifa2 tony-o: yeah, agreed on wanting to se p6c fall to the wayside. I've been aiming (since we're early in adoption right now) only about a year's worth of deprecation before tossing stuff in my modules. 20:30
In this case, I feel like the best practice would be for my extant modules to stay on p6c for about a year after 6.e, when presumably most people would starting getting fresh installs of Raku with an updated zef.
tony-o agreed, there's a ton of cruft in p6c that will likely clean itself up by way of deprecation 20:54
going through it i think there are still modules without author/version/etc 20:55
is there someone available who knows more about modules.raku.org's internals that can test this branch? github.com/Raku/modules.raku.org/tree/zef-eco - this should put zef-eco on the modules.raku.org page 20:56
tbrowder tony-o: when you refer to modules w/o author info, etc., are you talking about those adverbs being in the module? 21:00
tony-o in the META
they're just basic {"name": "XY::Z", "description": "test"} 21:01
tbrowder if so, that’s one of the reason’s i’ve come to love mi6
ok, meta, got it. another thing i’ve been voting for: some minimal and testable standards for acceptable modules. 21:03
before they can be accepted as “official” in the modules.raku.org. 21:05
tony-o digging through modules.raku.org, i'm kind of liking the raku code for raku.land 21:06
guifa2 tbrowder: I had mention to lizmat that I've thought about also creating a curated list of modules — not in an ecosystem per se, but just a website that might be more purpose driven than name driven (e.g. "modules for handle XML", and a list of each of those with the differences — bindings to native libs, pure raku, performance, etc— or similarities — compatible APIs— being discussed). 21:45
El_Che guifa2: isn't that a typical awsome repo? 21:50
guifa2 Perhaps, although I'm thinking of something a bit more detailed than what I tend to find there (and I'd still want to add in some search features) 21:53
JJAtria[m] tony-o: I saw a commit recently in zef that renamed the new ecosystem from "zef" to "fez". Does that have an impact on the correct auth to use? 21:55
Geth doc: 0a50ecb084 | (Stoned Elipot)++ | doc/Type/Str.pod6
Fix apparent paste error
22:19
linkable6 Link: docs.raku.org/type/Str 22:20
RaycatWhoDat Quick question because I think I'm doing it wrong. How can I return a running hash from an Action Object used by a Grammar? 22:34
glot.io/snippets/fv9pbgx61n 22:35
So, the above works but I want to do something like has %.all-flags inside of the class. 22:36
guifa2 RaycatWhoDat: what do you mean by a running hash? 23:20
tellable6 guifa2, I'll pass your message to RaycatWhoDat
RaycatWhoDat . 23:41
tellable6 2021-01-25T23:20:24Z #raku <guifa2> RaycatWhoDat: what do you mean by a running hash?
RaycatWhoDat guifa2: Like, I want to add the keys and values to a hash as I parse the input.
Then return that hash at the end. 23:42
guifa2 So you can do that — but make sure there's no way your regex can backtrack, or you might end up pushing multiple times for the same value (I maaaaaaybe made that mistake once back in the day haha) 23:48
in the TOP rule, define a dynamic variable
and 'make' it at the end 23:49
rule TOP { :my %*result; ^^ ('-' <flag-with-values>)+ %% <.ws> $$ { make %*result } }
in your flag-with-values token, after you've matched everything, you can insert a small code block to assign to that hash, e.g. 23:50
token flag-with-values { <flag-name> <.ws> <flag-value> { %*result{~$<flag-name>} = ~$<flag-value> } } 23:51
Then just do your parsing, %options := OptionsParser.parse( $string ).made 23:52
RaycatWhoDat What's that `:my` syntax? 23:54
guifa2 that's how you declare a new variable in a regex scope
RaycatWhoDat Oh neat
guifa2 code blocks are their own local scopes inside of regex
RaycatWhoDat and the `~$<...>`? 23:56