🦋 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.
sampersand Hi. When specifying return types, if it's returning the same class as its declared in, should i return `::?CLASS`? 04:45
for example, should I do this, or replace `::?CLASS` with `MyString` : `method add(Value $r, --> ::?CLASS) { ::?CLASS.new: ... }`
sortiz Using ::?CLASS is safer if you ever change the class name. 04:46
sampersand Yeah, same wieth Rust and `Self`. It just looks a bit ugly here, especially with `::?CLASS.new`
What's the cleanest way to have strings behave like perl strings? eg `"1a" + 3` should give me 4 04:47
I've done `$thing ~~ /^ <[\d]>* /; $<>.Int` , but im wondering if there's something cleaner 04:48
sortiz For your method you can use $.new(... or self.new(..., that works too because self is the invocant. 04:56
sampersand oh right 05:03
taht makes sense @soritz
sortiz m: sub toint(Str $a) { my $res = 0; for $a.ords { given $_.unival { when $_ === NaN { last }; default { $res = $res * 10 + $_ } }}; $res }; say toint('321foo') + 20; 05:29
camelia 341
guifa2 m: say IntStr.new('1a') + 3 05:44
camelia Too few positionals passed; expected 3 arguments but got 2
in block <unit> at <tmp> line 1
guifa2 say "1a".comb(/d/).join.Int 05:45
evalable6 0
guifa2 err
m: say "1a".comb(/\d/).join.Int 05:46
camelia 1
guifa2 sampersand: ^^
tellable6 guifa2, I'll pass your message to sampersand
sampersand is there a way i can set the program name so my `$*USAGE` doesn't give the full path? 05:50
tellable6 2021-02-15T05:46:27Z #raku <guifa2> sampersand: ^^
sampersand whoops i have no idea what that was in reference to
guifa2 sampersand: getting a string value perl style-ish 05:52
m: say "1a".comb(/d/).join.Int
camelia 0
guifa2 err
m: say "1a".comb(/\d/).join.Int
camelia 1
sampersand but something like `"1a2"` will give me 12, not 1 05:53
sortiz m: sub toint(Str $a) { my $res = 0; for $a.ords { given $_.unival { when $_ === NaN { last }; default { $res = $res * 10 + $_ } }}; $res }; say toint('321foo') + 20;
camelia 341
guifa2 ah I didn't realize perl stops at the first alpa. it's been a while since i've tried doing stuff like that
sortiz Try mine sampersand.
sampersand that seems like a lot more trouble than my regex solution soritz 05:54
`$!value ~~ /^ \d* /; $<>.Int`
is there a way to get `MAIN` to accept arguments in the form `-e foo` not `-e=foo` ? 05:57
sortiz Your regex fails to give zero for "foo" ;-) 05:59
sampersand how so I have `\d*` ? 06:00
sortiz For your other question, see github.com/nxadm/SuperMAIN
sampersand oh cool, also disappointing its not builtin 06:02
Froogal Hello! I'm having a problem with the raku site.  I keep getting an error "SSL_ERROR_RX_RECORD_TOO_LONG" does anyone else get this while trying to access the site?  It's really annoying while trying to read docs. loll 06:03
sampersand I GOT THAT TOO 06:04
i have no idea the cause, and one day it just started working again. i used the wayback machine as a stopgap though 06:05
sortiz I don't have problems accessing raku.org nor docs.raku.org. (tested with chrome and firefox in linux) 06:08
sampersand when i had the problem, i tried curling the website and still got the ssl error
sampersand so to resolve my circrular imports, ive resorted to this. is there a better solution: `our &run = sub { require Knight::Parser '&parse-and-run'; ::('&parse-and-run').($^a) };` 06:12
`Knight::Parser` depends on `Knight::Function` , which has a function called `eval` , which then needs to run that `&run` function, and thus circular import 06:13
guifa2 is currently also able to get to raku.org sites, testing on Chrome on macOS 06:14
summerisle same heer
guifa2 sampersand: that is your best bet if you want to keep them in different files
sampersand really? requiring it _every time_ the function is run? 06:15
guifa2 it's not like it's calling the export code again multiple times
it'll call it once during compilation
sampersand oh 06:16
well, if i move it outside the sub, it no longer works
guifa2 in fact, it's often seen as good practice in Raku to limit your use/require statements to the specific block you need them. I only hoist things to the top of a module file if I'm going to use it all over the place
sampersand hm ok
how can i import methods with this? 06:17
guifa2 you should just use "use" instead of "require". REquire just gives you access to the package's namespace (via its our-scoped stuff) 06:22
I'd probably write it as 06:23
sub run ($code) { use ::('Knight::Parser'); parse-and-run $code }
sub foo { … } is functionally identical to our &foo = sub { … }
Froogal Does Raku have something equal to system() in perl? 06:32
sortiz Froogal, see docs.raku.org/type/Proc::Async 06:36
Froogal sweet, thanks!  Wow so I'm feeling a lot of javascript vibes from raku lol 06:37
Not a bad thing tho
sortiz In raku almost everything is an object, even more than in JS. 06:38
sampersand raku has `qqx<...>` 06:39
i tried the `sub foo` thing guifa2 but i was getting errors for some reason
yeah, when i replace the `our &foo` with a `sub foo` , i get `Could not find symbol '&run' in 'Knight'` 06:40
and doing that `use` gives me circular imports guifa2 06:41
guifa2 Froogal: note a small difference between Proc::Async and Perl's system 06:42
> raku -e 'Proc::Async.new("sleep 5"); print "foo"'
will immediately print foo, while the sleep is still going on in the background 06:43
> perl -e 'system "sleep 5"; print "foo"'
Will wait five seconds, and then print foo
Froogal Because of Async?
sortiz Yes, there is also the simple Proc (see docs.raku.org/type/Proc ) and 'run' sub. 06:45
docs.raku.org/routine/run 06:46
Froogal nice!  so many options 06:47
guifa2 sets up a new CLDR compile and heads to bed. At least there will be an update in time for the weekly 06:50
guifa2 coughs in the direction of lizmat, but from a pandemic safe distance
sampersand is there a way to tell raku to tell me where it waas when i hit ctrl+c. i presume i have an infinite loop somewhere but idk where 07:00
guifa2 perhaps you could do signal(SIGINT).tap( { say Backtrace.new.XXXXX; exit 0 } ); 07:05
or something of that sort
where XXXXX is the degree oft race you want
e.g. summary, concise, full, nice, gist 07:06
errr
whoa, that never exits!
even after control Cing
sampersand: Actually, what I have there works just fine. Just don't test it with loop { }; my guess is something gets really mucked up with the stack there. WheN I retried with loop { sleep 2 } it worked perfectly 07:11
sampersand ok cool
yup, just as i suspected. things arent workign as they should ;p 07:12
summerisle is there any good literature on rakudo design philosophy, nqp, architecture, etc...? 07:20
guifa2 look up stuff by jnthn, he's probably written the more recent stuff 07:23
guifa2 Rakudo doesn't have the same degree of design docs as Raku does though 07:23
sortiz summerisle, see github.com/edumentab/rakudo-and-nq...ls-course, IMHO the best entry point available. 07:48
sortiz Discipulus: I finally got to the end of the rabbit hole. 07:59
Discipulus sortiz: me too! did you have seen my perlmonks post? 08:00
sortiz No yet. Let me see...
Discipulus www.perlmonks.org/index.pl?node_id=11128365 08:01
it's about perl but very related
sortiz Okay, but do you know where that _CRT_glob goes? 08:07
Discipulus for raku? no idea :)
I know nothing about raku
Discipulus I suppose there are some .c files to modify for raku too 08:08
sortiz In all cases it is handled by an internal MS CRT function! 08:09
Discipulus this sounds opposite to the observed beahviour of MinGW built rakus, no? 08:13
sortiz No, MinGW32 ang MinGW64 uses different mechanisms but deep inside both depends of msvcrt, in it the handling is done by __getmainargs 08:17
In mingw64 you can control it linking CRT_glob.a or CRT_noglob.a that simply set its 'extern int _dowildcard' (the mingw _CRT_glob analogous) 08:20
sortiz And results that raku don't touch _CRT_glob (nor _dowildcard) so, if linked with mingw64 uses the default and expands. 08:32
Discipulus sortiz: nice found.Did you plan to open an issue? 08:49
sortiz Can be. I think that for moarvm is only a matter of call Configure.pl with the proper arguments. You do not need to modify the code. 09:00
sortiz Discipulus: Confirmed, I can build raku with mingw64's gcc and the proper LDFLAGS to avoid the expansion. 10:10
Discipulus sortiz: ++ so you are elegible to produce a patch too :) 10:11
sortiz I made a post in the original perlmonks thread. 10:24
sortiz o/ Time for bed. 10:30
sortiz Discipulus: Btw, for MS tools see docs.microsoft.com/en-us/cpp/cpp/m...-expansion 10:40
g'night 10:41
RaycatWhoDat Ah, it's that time again. 16:00
That time where I feel just enough pain from speed and general libraries to be tempted to the Racket side. 16:01
But I have a love-hate relationship with parens so, I weep 16:02
RaycatWhoDat I forgot that `quit` kills all of your channels 16:05
lizmat and yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2021/02/15/2021-07-easy-hard/ 16:17
tyil lizmat++
tonyo hat general libs are you looking for RaycatWhoDat 16:35
RaycatWhoDat tonyo: GUI, mostly. Not for this use case but in comparison to Racket. 16:36
Or perhaps, this is all a perception issue and I should be treating Raku more like Haxe where the language consumes APIs/libraries from other places? 16:37
tonyo raku is more of the consume libs style than having everything built into it 16:42
if you need examples of it Nativecall docs are pretty decent to get started 16:43
and then you have DB::Pg, libcurl, etc all use it 16:44
sjn lizmat: about CCR; is there room for old videos in the project? (I know of two which still may have some value) 17:02
lizmat hmmm... you mean, copy into the repo ? 17:17
sjn: not sure how Github (dis)likes that 17:18
codesections sjn: one option for videos (which we might want to look into anyway if we do a RakuConf) is setting up a Raku peertube instance. Then the CCR could link to that. 17:34
but it seems like a bigger discussion than just uploading a blog post. Maybe you could open an issue in CCR? 17:35
db48x avoid putting large binary files in a git repository 17:57
instead, make sure the videos are archived on archive.org 17:58
and put an index in the repository
codesections huh, I didn't realize that archive.org handled arbitrary video. I guess they do, but it sounds like they don't try to be particularly comprehensive and still sometimes have playback issues? ~www.reddit.com/r/DataHoarder/comme...s_used_to/ 18:03
codesections In general, I don't _love_ the idea of relying too much on them, both because I'd rather we keep control of our own content and because I'd hate to burden them more than we need to 18:05
but I agree it's better than nothing, obviously
tonyo how much data in video is it? 18:32
db48x codesections: all the Raku videos ever recorded probably won't add up to much compared to the 50PB of data they already save 18:38
lizmat ok, so it seems that uploading to archive.org and having a link in the CCR seems a viable solution 18:39
db48x codesections: but it does make sense to have multiple backups. you can always ensure that everything is archived, plus also start your own peertube :)
lizmat indeed... I will probably have a local copy of each
db48x in fact, they don't even care if you hotlink the video files
lizmat so: please create a PR for links to videos 18:40
or ask for a commit bit :-)(
db48x your peertube could just be an interface that lets users find videos, while actually serving them from the archive
lizmat afk for a few hours&
tonyo .tell jmerelo ty 18:45
tellable6 tonyo, I'll pass your message to jmerelo
codesections yeah, all that makes sense (though I'm not sure about the peertube-as-an-InternetArchive frontend idea!) 18:57
tonyo is it intentional that setting %*SUB-MAIN-OPTS outside of the entry point for raku has no effect? eg module X { my %*SUB-MAIN-OPTS = :; sub MAIN("l", :a($all)) is export {..} }; will only work if you call x -a l and not x l -a (if x is `using X`) 19:20
db48x codesections: why aren't you sure about it? 19:24
codesections tonyo: s/:;/:named-anywhere;/ ? 19:27
codesections tonyo: I don't know the intent for sure, but the implementation at github.com/rakudo/rakudo/blob/mast...in.pm6#L17 makes that look pretty intentional to me 19:31
db48x: well, just that the IA gets a lot of traffic and has pretty tight funds. There wouldn't be a *need* to develop a distributed, privacy respecting alternative to youtube if the answer to getting content of youtube was as simple as "create a frontend for the internet archive" 19:34
guifa2 oooh, FOSDEM is prepping the videos for release 19:46
db48x codesections: bandwidth is pretty cheap compare to the drives the data is stored on, and the motto at the archive is "access drives preservation" 19:51
that is, making the data available to people is what makes preserving it worthwhile 19:52
tonyo yes to your sub ^ 20:01
guifa2 lizmat++ for the weekly! 20:35
guifa2 Thinking out loud here, but is there a way to extend enums in some way? 21:27
In CLDR, gender values are any of 7 different values. That's in an enum, awesome. But in one subsection of the CLDR, it can be any of those, or one or two special values. SO right now I'm having to store them as strings, which feels not as neat and tidy compared to enums 21:30
codesections guifa2: (probably an unhelpful answer, but...) you could always just make your own enums out of Roles wimvanderbauwhede.github.io/articl...s-in-raku/ 21:35
guifa2 codesections: hmm something like that might work 21:51
codesections yeah, it'd work – I was guessing it would be more refactoring than you were interested in, but maybe I'm wrong about that 21:52
I guess it depends on how much you use the enum
guifa2 eh, not often but when I do it get used a decent bit and the integral values are important 21:53
this is kind of where I wish I could just do a C union or something
tbrowder can i pls get a commit bit for planet.raku.org?