🦋 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.
Geth doc: 1e216133f1 | (Christian Bartolomäus)++ | doc/Language/nativecall.pod6
Minor cleanup for section "Getting started"
06:44
elcaro I'm getting `No such method 'with-export' for invocant of type 'CompUnit::Handle+{<anon|1>}'` when I `use SomeModule:from<Perl5>` after `use v6.e.PREVIEW` 06:51
I couldn't find an existing issue... before I bug it... can someone confirm it's not just me
MasterDuke elcaro: same here 07:56
Geth ecosystem: 83705f8b22 | (Elizabeth Mattijsen)++ | META.list
It appears that github.com/palapitta has disappeared

This affects the Aria, Bencode, Movieinfo and Weather distributions.
The latest available versions of these modules *are* available in the Raku Ecosystem Archive at github.com/lizmat/REA/
  - Aria blob/main/archive/A/Aria/Aria:ver<0.1.4>:auth<github:palapitta>.tar.gz
  - Bencode blob/main/archive/B/Bencode/Bencode:ver<0.1.1>:auth<github:palapitta>.tar.gz
  - Movieinfo blob/main/archive/M/Movieinfo/Movieinfo:ver<0.1.2>:auth<github:palapitta>.tar.gz
  - Weather blob/main/archive/W/Weather/Weather:ver<0.2.1>:auth<github:palapitta>.tar.gz
09:49
lizmat I guess we could consider moving these modules to raku-community-modules 10:07
well, re-instating would be a better word, I guess
frost Just out of curiosity, in raku, the C style loop `loop (my $i = 0; $i < 10; $i++)`, why is $l outside the scope here 10:18
moon-child context? 10:20
what is $l?
lizmat frost generally people expect the counter to be available *after* a C-style loop ? 10:37
otherwise you would just use for ^10 -> $i { } 10:38
moon-child oh, I see. I definitely find that behaviour surprising
in c: for (int i = 0; i < 10; i++); //i is no longer in scope
if you want it to remain in scope, then declare it externally, as in int i; for (i = 0; i < 10; i++); //i remains in scope 10:39
However it is somewhat consistent, given you can say e.g. '3 + (my $x = 2)' and $x will be visible outside 10:40
frost sorry, J=just dealt with something 11:09
yeah, moon-child, it is different from C 11:10
holyghost e.g. my $I = 0; BTW (undef) 11:13
I didn't drink for 2 days, so it's going better for me (doctor's orders), I don't know if I want to take vacation 11:15
Just saying for old time's sake
frost lizmat: I see, but for me, I am more familiar with C. 11:26
lizmat well, I guess that's a behaviour inherited from Perl then 11:27
frost In C, I can use the same loop statement `for (int i = 0; i < 10; i++)` many time in the same  scope
In raku, if i use the C style loop, i have to define differet counter 11:28
lizmat in Raku, idiomatically you'd use: for ^10 -> int \i { }
frost yeah, it's so nice
i ask this just for curiosity
lizmat thanks 11:29
moon-child I don't really know perl, but in a basic test it does not seem to behave that way eitehr 11:29
either
lizmat frost: sure, but the "bleeding into outer scope" is the reason we have a "loop" in Raku, afaik
well, then I'd say @LARRY changed their mind on that :-) 11:30
frost wow
interesting ;)
lizmat but really, the C-style loop exists in Raku *because* of the bleeding of the counter
I can't really see another really valid reason for it 11:31
stoned75 hi 11:42
frost stoned75 hello 11:44
stoned75 I was looking after documenting IO::Path.add(@list), cf. github.com/rakudo/rakudo/pull/4472, then I was wondering about what is planned for IO::Path.child(), which right now is documented as "alias for .add", when it is not anymore ':) 11:47
and considering github.com/rakudo/rakudo/commit/8b...ca565646e7
Voldenet compare HEAD my $n = 0; for ^10 -> \i { $n += i }; ||| my $n = 0; for ^10 -> $i { $n += $i }
lizmat stoned75: I'm not touching that anymore 11:48
Voldenet benchable6: compare HEAD my $n = 0; for ^10 -> \i { $n += i }; ||| my $n = 0; for ^10 -> $i { $n += $i }
benchable6 Voldenet, starting to benchmark the 1 given commit
stoned75 arf ':)
benchable6 Voldenet, gist.github.com/4a59f84f2d529c858e...9c5ac64547
Voldenet \i seems significantly slower than $i in this context 11:50
holyghost for (my $i = 0; $i < 1024; $i++) {} 12:06
lizmat Voldenet: that's because the standard way of `for Range` is highly statically optimised 12:07
Voldenet Oh, so it isn't the case for every iterable 12:09
holyghost scsi, loop (my $i = 0; $i < 1024; $i ++) {} 12:19
thowe Hi Raku folks. How are you today? 17:10
tonyo lizmat: did you checkout the fez orgs stuff? 17:11
lizmat tonyo: didn't get around to it yet... almost ready with the Weekly, then one more advent post to finish before tomorrow... 17:12
too many things to do, not enough time :-( 17:13
thowe I love the advent calendar; I appreciate what goes into it. 17:24
guifa lizmat: I'm almost done recoding timezones. Pulled out the data/calculations, but still finishing up the last bit of C code conversion 17:31
they made a lot of changes since i last ported it
tonyo .notable deathbykeystroke.com/articles/2021...racle.html 18:31
lizmat tonyo: talk about JIT publishing :-() 18:31
tonyo weekly: deathbykeystroke.com/articles/2021...racle.html
notable6 tonyo, Noted! (weekly)
lizmat :-)) rather
notable6: weekly reset
notable6 lizmat, Moved existing notes to “weekly_2021-12-20T18:31:56Z”
tonyo haha
hard to keep track of the bots 18:32
JJ asked me to do a `how to get started with fez` for the advent
lizmat so, do you want me to import that into the Advent Calendar? 18:33
tonyo i think tomorrow i'll write up a quick tut, may have to download mi6 and figure that out
lizmat ok, gotcha
tonyo the org one? nah, i'll just link it from the one i'm going to write tonight or tomorrow
lizmat ok
[Coke] raku -MFile::Temp -e1; # is there a way to do this that doesn't complain about sink? 18:35
lizmat -e'' 18:36
[Coke] -e'' gives help usage.
-eNil works.
lizmat -e '' 18:37
note the whitespace
[Coke] lizmat++
[Coke] uses File::Temp for something, duff++ 18:38
guifa I find it so weird that it's quite difficult to make natives constants 18:42
lizmat guifa: I don't think you can atm 18:43
the problem is that a native is a piece of memory that is not an object by itself
guifa lizmat: my work around is to put them into a module called "Constants"
and then
lizmat and pre-compilation needs objects, and constant are compile time construcrts 18:44
guifa sub EXPORT { my int $FOO = 0; Map: :$FOO }
lizmat that would not make $FOO a constant: assigning to it would work
guifa Right
It's not a true constant 18:45
lizmat why do you need it to be a native ?
guifa but where I 'use Constants'; the term "FOO" would appear, sans sigils
lizmat: porting C code that is designed with wrapping in mind.
mcmillhj Can someone explain the semantics of what is happening with `$depth` here? I kind of expected the _value_ of `$depth` to be copied into my array, not a reference. 18:47
topaz.github.io/paste/#XQAAAQCjAQA...r6HGP8BnUA
guifa as much as I'd love to rewrite the code to be super Raku-ish, I had to rewrite stuff from scratch (in a very C-accented Raku) because it's nigh impossible to track the changes in the C code in my Rakuish version =\
mcmillhj: I believe it's because you've used push: (List) 18:49
@snailfish.append: $c.Int, $depth;
that gives me [4, 4, 3, 4, 4, 3, 4, 2, 7, 2, 8, 4, 4, 4, 9, 3, 1, 2, 1, 2] as a result
mcmillhj I actually want it to be a subarray, `push: [$c.Int, $depth]` appears to work. That is just confusing to me for some reason. 18:50
guifa ah, you want to keep them in the subaray. push: (+$c, +$depth) seems to work. 18:52
but the list doesn't copy values or anything 18:53
m: my $a = 0; my @b is List = $a, $a, $a; $a++; say @b;
camelia (1 1 1)
guifa m: my $a = 0; my @b is Array = $a, $a, $a; $a++; say @b;
camelia [0 0 0]
mcmillhj thanks guifa 18:58
lizmat and yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2021/12/20/2021-...ransiting/ 18:59
guifa lizmat++
thowe In the code at gist.github.com/bduggan/a929bd7a06...55dcb7b316 on lines 9 and 10, what does the *.f and *.d mean? Are those globs of file names (seems not) or do those have special meaning to multi or IO::Path ? 19:11
or am I trying to bite off too much at once? there's a lot going on there I don't quite get. 19:15
guifa thowe: the * is a Whatever 19:19
in this case, it refers to $f
thowe OK, but what is it doing? how do *.f and *.d differ? What are those? How does it know which version of the function to run? 19:20
guifa files(IO::Path $f where *.d) === subroutine "files" with a first argument of type IO::Path named $f, where it (* or $f) is a directory (.d)
atroxaper Hello, #raku 19:21
guifa $file.d = is $file a directory? $file.f = is $file a file ?
holyghost takes a few days of vacation 19:22
guifa m: multi sub size (Int $a where $a < 10) { say "small" }; multi sub size (Int $a where * ≥ 10) { say "big" }; size 5; size 15; size 1; 19:23
camelia small
big
small
guifa that might make it a bit clearer what's going on
thowe OK, so those are something specific to IO::Path then? Just trying to figure out where to look at docs to understand them. 19:35
Ah I see, method f and method d... 19:37
wild 19:39
guifa yup, exactly. You wouldn't be able to use .d/.f on most other things 19:44
holyghost Here's the best I wrote in 5 years chosen by my admin, I put it online here : sf.net/projects/bubblesrc. The user login features later projects 19:50
5 years, 5 years ago :-)
We posted links back in the day at WF, so there you go
thowe guifa++ 20:08
lizmat tonyo: so "fez org list" shows up empty, which means I would have to create an org from scratch, right ? 21:22
tonyo yea lizmat 21:30
lizmat any limitations as to the org name ? 21:31
tonyo as long as there is no user or group with that name existing 21:32
lizmat ok 21:34
tonyo should I get a mail after creating an org? 21:38
tonyo nope, just on invites
lizmat and I guess the auth of a module should then be zef:org-name right ? 21:39
tonyo yea
lizmat ok, lemme take one then as a test case :-) 21:40
tonyo which one you uploading? 21:49
lizmat well, I am looking at Die
simple, straightforward :-)
lizmat tonyo: hmmm.. it appears that mi6 will need some tweaking before this gets straigtforward 22:06
yeah, will need some work on App::Mi6 22:14
auth 'zef:raku-community-modules' in META6.json does not match auth 'zef:lizmat' in ~/.fez-config.json 22:15
lizmat tonyo: Die:auth<zef:community-modules> should now be a thing 22:53
tonyo: Die:auth<zef:raku-community-modules> 22:54
rather
Xliff I'm trying to put a custom trait on a class definition. Which trait mod can I use for that?
trait_mod:<is> will not work for classes, since it is used for inheritance.
lizmat sub trait_mod:<is> probably?
make sure the name of the trait is a *required* named argument 22:55
sub trait_mod:<is>(Any:U $class, :$foo!) { dd }; class A is foo { }
m: sub trait_mod:<is>(Any:U $class, :$foo!) { dd }; class A is foo { }
camelia ===SORRY!=== Error while compiling <tmp>
Type check failed in binding to parameter '$class'; expected Any but got A (A)
at <tmp>:1
lizmat m: sub trait_mod:<is>(Mu:U $class, :$foo!) { dd }; class A is foo { } 22:56
camelia sub trait_mod:<is>(Mu:U $class, :$foo!)
lizmat Xliff ^
Xliff Ooh! Let me try. 22:57
And I take it roles cannot be punned on to type objects? 23:00
gfldex m: multi sub trait_mod:<is>(Mu:U $c, :$foo) { say $c.^mro; }; class C is Any is foo<42> { }
camelia ((C) (Any) (Mu))
gfldex Looky like you need to add Any by hand in this case. 23:01
Xliff Hum... 23:33
m: use NativeCall; class A is repr<CStruct> { has uint32 $.a }; A.REPR.say
camelia CStruct
Xliff m: use NativeCall; class A is repr<CStruct> { has uint32 $.a }; A.REPR.say; ::("A").REPR.say
camelia CStruct
CStruct
tonyo lizmat: looks good 23:36
the first RCM module in fez
Xliff Hum. 23:37
I think we haz problem.
If i use a module with a struct, I get the right .REPR value
However if I late-load AND late-bind, said .REPR is now P6opaque
./p6gtkexec -e 'require ::("GDA::Raw::Structs"); ::("GdaTimestamp").REPR.say' # P6opaque 23:38
Xliff ./p6gtkexec -e 'use GDA::Raw::Structs; GdaTimestamp.REPR.say' # CStruct 23:38
lizmat Xliff: is repr() needs to be done on the very first mention of a class, even if it is a stub
that's a known issue afaik 23:39
Xliff lizmat: This did not happen prior to new-disp.
Even late bound references returned the right REPR
Xliff And this is not about "is repr" on first mention. I know this. 23:39
lizmat hmmm... well, then please make an issue and make sure jnthn is pinged on it
Xliff This is about retrieving the REPR at run-time 23:40
lizmat: OK. Will do.
Geth ecosystem: fe27c24133 | (Elizabeth Mattijsen)++ | META.list
Die now lives in the zef ecosystem
23:42