🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). Log available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 6 September 2022.
_elcaro_ re: RAKU_REPL_OUTPUT_METHOD, it's not that recent. Release notes say it was added mid-2020. 00:12
but the use of a method is fairly limiting. It would be nice if we could specify a function, then pretty-printers could be made pluggable with the repl 00:13
nemokosch perhaps it needed some tinkering, I don't remember exactly
_elcaro_ As is stands... I have a custom repl.raku that formats output with a little pretty printer I wrote (with color!) 00:15
screenshot comparison: 0racle.info/dump/raku-pp.png 00:23
My formatter maintains the brevity of gist, but removes ambiguity around what is string, how many of them are in a list, etc. 00:24
SmokeMachine Hi there! I've been playing with rcron and things are starting to get big (I mean this signature: github.com/FCO/RakuCron/blob/main/...#L17-L78). I'm trying to find a way to split it into multiple places but in a way the used signature would be the same. One possible way I'm thinking would be having a file (or many) listing the parameters and create the function with EVAL and maybe use the same 09:54
file to generate documentation, but I don't really like that way. Does anyone have any suggestion?
lizmat SmokeMachine: when the number of named args becomes that big, I usually just check %_ and write the logic using the hash 10:17
siavash SmokeMachine: Maybe replace Sundays,... with `Day @day_names` and month names with `Month @month_names`, Day and Month can be enums. Also if some options are incompatible, maybe create separate multi methods for each of them 10:18
lizmat SmokeMachine: especially since you need to do a lot of post-processing anyway
SmokeMachine lizmat: but then I'll need to validate then my self, right? And I'm still holding to use the signature for helping on ide's autocomplete... 10:19
lizmat or, if it is a CLI, walk the @*ARGS "manually" :-)
it's what I did in App::Rak
yes, you would lose that 10:20
SmokeMachine it isn't... :(
lizmat anyways, in App::Rak there are 200+ options... so that's a bit extreme :-)
SmokeMachine just a small part have posprocessing...
siavash: but that way the user wouldn't be able to pass :Sun, for example... 10:22
like on: `rcron -e '.run-at: :5hours, :Mon, :Wed, :Fri, { say "running a job" }'` 10:24
another way I'm thinking now would be create many small subs and a new sub that would consume all those, and generate the `run-at` method with the signature of all those subs combined and it would call all of those subs, one by one to build the hash to be used on `App::RakuCron::Rule.new` but for building the signature it would also use EVAL... :( 10:29
lizmat that's an approach similar to the one I used in App::Rak 10:30
SmokeMachine and an .^add_method, I think...
lizmat basically, each option has a sub with the method name encoded in it
SmokeMachine so you do almost what I described just not creating the method with the unified signature? 10:31
lizmat indeed... problem in Rak is that some options need to load additional modules 10:32
and do other stuff I forget at the moment
but creating a signature turned out to be very slow and cumbersome, is what I remember atm 10:33
people tend to call "rak" a lot... speed for the rcron interface is less of an issue, I'd say :-)
SmokeMachine even for doing that only once on compile time (if that's possible)?
yes, I agree 10:34
SmokeMachine sometimes think if he's giving too much alternatives adding all those aliases on parameters... 10:36
*too many? 10:37
lizmat well, there's that. 10:47
with App::Rak I made it possible for people to generate their own argument names for a given functionality
SmokeMachine m: multi m(:$a) { %(:$a) }; multi m(:$b) { %(:c($b)) }; say %( |&m.candidates.map: { .( |%( %(:1a, :2b){ .signature.params.grep(*.named).map: *.name.substr: 1 }:p ) ) } ) # maybe something like this would work for the generated function... 10:57
camelia {a => 1, c => 2}
SmokeMachine m: multi m(:$a) { %(:$a) }; multi m(:d(:$b)) { %(:c($b)) }; say %( |&m.candidates.map: { .( |%( %(:1a, :2d){ .signature.params.grep(*.named).map: |*.named_names }:p ) ) } ) # better 11:02
camelia {a => 1, c => 2}
siavash SmokeMachine: Another thing you can do is capture all parameters and call those separate subs with the capture; and each sub takes all params as capture but only operates only on parameters related to it, an example: codeberg.org/CIAvash/Pod-Contents/...#L234-L239
SmokeMachine siavash: yes, good point. But I would still need to declare all the possible parameters there... :( 11:03
siavash no, the main sub would only need `|c` 11:04
SmokeMachine if I only do the |c, I'll loose the autocompletion for the parameters... 11:05
siavash Well, I don't use an IDE 😀 11:07
SmokeMachine I don't want that for me... but for the users... :)
one of the points on doing something configured by a programming language is to get help on auto-completion and highlight... 11:08
siavash Yeah, good point. If Raku's signatures were reuseabe, it would be great. 11:12
tbrowder__ .tell ugexe i installed zef from local zef clone of yr master br and it reported “ver 0.11.5, 1 occurence of deprecatef code: Method path (from Cool) seen at: t/utils-system.t, line 43; Please use IO instead”. installed ok, then upgraded to ver 0.18.3 ok 18:02
tellable6 tbrowder__, I'll pass your message to ugexe
ugexe tbrowder__: zef is on version 0.18.3 18:26
tellable6 hey ugexe, you have a message: gist.github.com/b5bbc2488b8b3ba367...2462141ca4
ugexe zef also uses the main branch (not master) 18:27
gfldex tbrowder__: you are asking for advice, but are not providing much context. Do you want to run Rakudo in the classroom, at $work or do you intend to build a base on the moon? 18:48
please say it's the moonbase! :->
teatwo what's a nice minimal low-barrier pastebin these days pls 18:51
gfldex If you got a github account already, gist.github.com/ works fine. There are CLI interfaces too. 19:02
SmokeMachine now rcron can make stuff like pomodoro! you can start and stop rules and run the rule based on the time it's running. 20:10
raku -I. bin/rcron -e '
my $interval = .run-at: :5secs-running, :off, -> :$rule, :$time { $rule.stop; say "$time.hh-mm-ss(): interval has finished" }
.run-at: :25secs-running, -> :$rule, :$time { $rule.stop; say "$time.hh-mm-ss(): Time to relax"; $interval.start }
'
tbrowder__ ugexe: yes, my clone of zef still had master branch, all was cured after i checked out "main" (pain) branch 21:01
gfldex: my probable use case would be classroom or shared host at a library or similar setting 21:02
gfldex tbrowder__: In that case I would use central Rakudo but per-user Zef. Keeping the Compiler central can reduce the bugs that hit the users and you can't stop them from using a local Zef repo anyway. Also, not all users will need to install all modules. Easier to clean up that way. 21:05
I found a poem that can be translated to Raku: allpoetry.com/The-Road-to-Wisdom 21:06
m: $*ERR and $*ERR and $*ERR but Less and Less and Less
camelia WARNINGS for <tmp>:
Useless use of constant integer Less in sink context (line 1)
gfldex m: say „The Road to Wisdom“; $*ERR and $*ERR and $*ERR but Less and Less and Less 21:07
camelia WARNINGS for <tmp>:
The Road to Wisdom
Useless use of constant integer Less in sink context (line 1)
tbrowder__ gfldex: thanks for advice && nice poetry! 21:21
ugexe: i am having trouble with zef on one debian host. in my cloned zef repo i excute "raku -I. bin/zef install ." and i get in response <Invalid JSON: at 0: expected a json object, but got '""'> 21:43
tbrowder__ .ask ugexe ^^^ any questions or suggestions? 23:18
tellable6 tbrowder__, I'll pass your message to ugexe