🦋 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.
00:00 reportable6 left 00:03 reportable6 joined
uzl[m] m: loop (my $i = 0; $i < 10; $i++) { say $i; }; loop (my $i = 10; $i < 20; $i++) { say $i; } 00:55
camelia Potential difficulties:
Redeclaration of symbol '$i'.
at <tmp>:1
------> $i < 10; $i++) { say $i; }; loop (my $i⏏ = 10; $i < 20; $i++) { say $i; }
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16…
uzl[m] > Redeclaration of symbol '$i'. 00:56
Isn't the loop variable lexically-scoped to the loop's block?
01:03 linkable6 left, evalable6 left 01:05 linkable6 joined 01:06 evalable6 joined 01:58 rf left 02:16 tea3po joined 02:18 teatwo left 02:19 tea3po left, tea3po joined 03:19 coverable6 left, evalable6 left, reportable6 left, linkable6 left, statisfiable6 left, committable6 left, releasable6 left, notable6 left, greppable6 left, tellable6 left, sourceable6 left, quotable6 left, nativecallable6 left, benchable6 left, squashable6 left, shareable6 left, bisectable6 left, bloatable6 left, unicodable6 left 03:20 shareable6 joined, greppable6 joined 03:21 linkable6 joined, nativecallable6 joined, evalable6 joined, coverable6 joined, benchable6 joined, notable6 joined, tellable6 joined, reportable6 joined, statisfiable6 joined, committable6 joined 03:22 quotable6 joined, sourceable6 joined, bisectable6 joined, unicodable6 joined, releasable6 joined, bloatable6 joined, squashable6 joined
Voldenet m: loop (my $i = 0; $i < 10; $i++) { }; say $i 03:53
camelia 10
Voldenet > In case the initializer involves a variable declaration, the variable is declared as a lexical variable in the loop's outer or containing scope so that it can be used in code following the loop statement. 03:55
04:22 linkable6 left, evalable6 left 04:23 linkable6 joined 04:24 evalable6 joined 04:55 deoac left
avuserow Xliff: thanks for the tips about proto methods for subclassing `new`, I'm much happier with this code now 05:01
tellable6 avuserow, I'll pass your message to Xliff
05:51 abraxxa joined 06:00 reportable6 left, reportable6 joined 06:50 sftp joined 07:03 frost left 07:28 tea3po left 07:30 teatime joined 07:33 sena_kun joined 07:48 Sgeo left 08:36 jpn joined 09:20 derpydoo left 09:35 buffet left 09:36 buffet joined 10:36 quotable6 left, releasable6 left, bloatable6 left, unicodable6 left, statisfiable6 left, committable6 left, shareable6 left, notable6 left, tellable6 left, coverable6 left, bisectable6 left, sourceable6 left, nativecallable6 left, squashable6 left, reportable6 left, benchable6 left, linkable6 left, evalable6 left, greppable6 left, bisectable6 joined 10:37 unicodable6 joined, benchable6 joined, statisfiable6 joined, sourceable6 joined, greppable6 joined, notable6 joined, shareable6 joined 10:38 reportable6 joined, tellable6 joined, releasable6 joined, committable6 joined, evalable6 joined, coverable6 joined 10:39 linkable6 joined, quotable6 joined, bloatable6 joined, nativecallable6 joined, squashable6 joined 11:39 statisfiable6 left, notable6 left, benchable6 left, unicodable6 left, squashable6 left, committable6 left, evalable6 left, sourceable6 left, releasable6 left, linkable6 left, quotable6 left, tellable6 left, nativecallable6 left, reportable6 left, bloatable6 left, shareable6 left, bisectable6 left, greppable6 left, coverable6 left 11:40 bisectable6 joined, linkable6 joined, reportable6 joined, squashable6 joined, benchable6 joined, coverable6 joined 11:41 bloatable6 joined, sourceable6 joined, notable6 joined, releasable6 joined, shareable6 joined 11:42 nativecallable6 joined, evalable6 joined, greppable6 joined, unicodable6 joined, committable6 joined, statisfiable6 joined, quotable6 joined, tellable6 joined 12:00 reportable6 left, reportable6 joined
lizmat and yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2023/05/08/2023-19-pakku/ 12:37
13:00 linkable6 left, evalable6 left 13:01 linkable6 joined, evalable6 joined 13:39 rf joined
rf Morning folks :) 13:40
lizmat rf o/ 13:42
13:57 jgaz left 14:16 teatime left, teatime joined 14:18 kjp left 14:48 kurahaupo joined
ugexe fwiw we've had recommendation managers before, i.e. for metacpan when jdv ran the raku version. but they aren't a great fit because they either have to query for one distribution at a time (very inefficient) or they return multi distributions but then aren't cooperative with other recommendation managers 14:52
see: perl6advent.wordpress.com/2016/12/...d-ish/#fn1 14:53
15:10 kjp joined 15:29 Sgeo joined 15:49 guifa_ joined 15:50 guifa left
ugexe For the raku core summit I think I might try to add options for disabling (or explicitly setting) the repositories that get loaded by default. Then a `--install-to=/myapp/myapps-libs --contained` + `raku -I /myapp/myapps-libs bin/my-app` will give you application isolated module loading. 15:50
Why does this matter? One example would be runtime loading of modules -- without the ability to disable the default repositories a plugin that is explicitly not installed in `/myapp/myapps-libs` could still be loaded through the `site` repo. This means other users can unknowingly affect the runtime behavior of other code. 15:51
15:52 Xliff joined
ugexe It kind of sucks that the Staging repository does not work with custom install locations, but imo custom install locations are more important in a production environment where you don't have application specific raku installations 15:54
and unfortunately i have no idea how to make Staging work with custom install locations 🤷 15:55
15:57 hythm joined
ugexe What I'm thinking is some sort of CompUnit::Repository::Mask like repo but included in the core, so one could do like RAKULIB="/myapp/myapps-lib,mask#foo" 15:58
16:03 abraxxa left
hythm "but they aren't a great fit because they either have to query for one distribution at a time (very inefficient)" Isn't this more efficient than downloading entire ecosystem META.json file (could be multiple ecosystems as well) everytime one needs to install a distribution. especially as these downloaded files grows larger with time 16:14
ugexe you shouldnt be downloading it every time for one, and no not really
it is true a different index format will likely be needed as the number of distributions grow
but its still just downloading an index 16:15
now that i think about it zef used to handle the p6c and cpan ecosystems via git if it was configured as such, so even updating the index did not require redownloading most of it. maybe fez should provide snapshots to a git repo 16:23
tonyo what do you mean by provide snapshots? 16:28
we had a dist query system built into the early versions of the ecosystem, i could look at resurrecting that.
also happy to look at a more efficient way to pass off that meta 16:31
16:31 jgaz joined
ugexe i'm not really sure its a problem yet, but if 360.zef.pm/index.json also had like 360.zef.pm/index.git, then instead of fetching index.json when updating the index clients could `git pull` that repo 16:33
a better index format than array of meta6 json hashes is a better thing to focus on imo though 16:34
99% of the time the index is searched i dont care about i.e. the meta6 description. something like that can be at the end of a file where it never even needs to get read in for most cases 16:36
17:11 kurahaupo left, kurahaupo joined
tonyo what would be in that repo? 17:12
or is that just to pull diffs of the json file? 17:13
lizmat perhaps I should take raku.land/zef:lizmat/JSON::Fast::Hyper and put that in Rakudo's from_json logic? 17:23
it's usually N-1 x as fast (where N is the number of available cores) 17:24
ugexe the problem is json isn't a good format for this
for instance: JSON::Fast::Hyper still leaves "description" getting parsed for every line 17:26
tonyo i also have the thing we worked on at PTS that just indexes a json file
i could rewire that so that zef doesn't need to reparse the entire thing 17:27
ugexe its true that clients could just implement their own index format locally, but i think it'd be better to have one that rakudo itself could parse and theoretically be used as a CURI that doesn't rely on sha1 file system lookups to be fast 17:28
tonyo are you suggesting a binary format? 17:29
or just _not json_?
ugexe that'd be great but i dunno how that'd be done in a core friendly way
tonyo something chunked like tar (where the block sizes are static) would make a slurp/split/distribute model easy enough 17:31
lizmat I guess any format with \0 as a delimiter, and a \0\n at the end of each record, would do fine 17:32
you could .lines.hyper that
ugexe an overly naive example would be an ini file where there is a [namespaces] with lines like Foo::Bar=SomeDist:ver<1.0>\nFoo::Bar=SomeOtherDist:ver<1.0>, basically mapping provides namespaces to a distribution. for most queries of this index it will only ever need to parse that [namespaces] section, and not later sections that have the other, less often needed information mappings like description 17:33
tonyo the problem with variable length records is that you still have a linear parsing time
guess that's still better than what we have, i can work on something like that. 17:35
lizmat metacpan.org/pod/Sereal perhaps too general, but maybe still a source of inspiration? 17:36
tonyo ugexe: is just the dist str needed?
ugexe well i think it'd probably be better to not use the dist str, but something easier to parse as well 17:38
that was just a naive example
but we want $namespace-that-can-be-queried mapped to any distributions that can contain it (although for duplicate $namespace-that-can-be-queried i'd probably just put them on their own line each pointing at a different distribution) 17:39
tonyo i thought we needed the description for search
ugexe well yes, you would use this mapping to lookup the description from another slower part of the index 17:40
tonyo are you suggesting that the index reverses, in that we have one key for each provides per dist that maps the dists that provide it?
ugexe i dunno, just that the index should be optimized for doing exact namespace lookups quickly while still being able to look up other information like description as needed 17:41
when doing `zef install Foo` it only ever queries the index for exact namespaces 17:42
yet we still had to parse description for Foo and every dependency
tonyo gotcha, i'll think about the best way to do that and integrate it 17:44
ugexe write a dependency-less pure raku sqlite driver! 17:45
tonyo it requires tooling changes which gives me an excuse to redo a lot of the backend stuff for the eco
that was going to be my other suggestion
downloadable sqlite db seems like the easiest option
ugexe well a pure raku sqlite driver could also exist and be used in the core 17:46
tonyo agreed
ugexe assuming a pure raku sqlite driver can be written at all :P 17:47
tonyo it looks like it's mostly just c/++ bindings
which i guess can be assumed when building raku 17:48
not really part of the spec though and would require libsqlite to use raku 17:49
lizmat I guess a pure Raku sqlite would talk the protocol, and not need NativeCall or a library 17:54
17:59 human_blip left
[Coke] in addition to a possible binary format, could be organized differently (non desc data first? desc data in a separate file?) 17:59
18:00 human_blip joined, reportable6 left
[Coke] I like the git idea but that's another dep also 18:00
18:03 reportable6 joined
Xliff m: 'sub a ($a, $b, $c) { say &?ROUTINE.signature.list }; a(1, 2, "bye" )'; 18:07
camelia WARNINGS for <tmp>:
Useless use of constant string "sub a ($a, $b, $c) { say &?ROUTINE.signature.list }; a(1, 2, \"bye\" )" in sink context (line 1)
tellable6 2023-05-08T05:01:45Z #raku <avuserow> Xliff: thanks for the tips about proto methods for subclassing `new`, I'm much happier with this code now
Xliff m: sub a ($a, $b, $c) { say &?ROUTINE.signature.list }; a(1, 2, "bye" )';
camelia ===SORRY!=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> OUTINE.signature.list }; a(1, 2, "bye" )⏏';
expecting any of:
infix
infix stopper
statement end
statement…
Xliff m: sub a ($a, $b, $c) { say &?ROUTINE.signature.list }; a(1, 2, "bye" ); 18:08
camelia (($a, $b, $c))
Xliff How can I get the capture object of a sub? I want raku to print "1, 2, "bye" in sub a
I should know this. Brain on strike
lizmat sub a(|c) { } 18:19
sub a(|c) { dd c }
Xliff ^^ 18:26
19:03 linkable6 left, evalable6 left 19:04 evalable6 joined 19:05 linkable6 joined 19:57 jpn left 20:17 Vyrus left, RonaldR34g4m joined
uzl[m] m: loop (my $i = 0; $i \< 10; $i++) { say $i; }; loop (my $i = 10; $i \< 20; $i++) { say $i; } 20:44
camelia ===SORRY!=== Error while compiling <tmp>
Malformed loop spec
at <tmp>:1
------> loop (my $i = 0; $i⏏ \< 10; $i++) { say $i; }; loop (my $i =
expecting any of:
infix
infix stopper
Xliff lizmat++: Thanks. Is there any way to do that with a block and WITHOUT a Capture? 20:45
You can't get the args from a Signature, can you?
Arg values, rather.
uzl[m] m: loop (my $i = 0; $i < 10; $i++) { say $i; }; loop (my $i = 10; $i < 15; $i++) { say $i; } 20:46
camelia Potential difficulties:
Redeclaration of symbol '$i'.
at <tmp>:1
------> $i < 10; $i++) { say $i; }; loop (my $i⏏ = 10; $i < 15; $i++) { say $i; }
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
uzl[m] > Redeclaration of symbol '$i'.
Isn't the loop variable lexically-scoped to the loop's block?
[Coke] someone just asked that earlier. 20:49
docs.raku.org/language/control#loop
Nemokosch by your terms, no, it isn't 20:50
[Coke] the answer is no, it's the outer block.
Nemokosch by either terms, to be honest, it isn't
arguably "the loop's block" would be the only block involved, i.e the one that contains say $i
[Coke] "In case the initializer involves a variable declaration, the variable is declared as a lexical variable in the loop's outer or containing scope so that it can be used in code following the loop statement. " 20:51
Nemokosch on the other hand, if you mean that the "loop's block" is the block that contains the loop, then yes, $i is declared in the loop's block - which happens to be the block of both loops, hence redeclaration 😛 20:52
20:57 jpn joined 21:04 sena_kun left
lucs Can I has different comment character? gist.github.com/lucs/9eecaec406960...58427a7388 21:39
If that's possible, I have something more interesting in mind that would use the technique. 21:40
[Coke] lucs: depending on how the grammar is written, you can make a slang that extends the definition of comment. 21:44
lucs Hmm... Do you know where I can read up on how to make a slang? 21:45
[Coke] something like github.com/coke/raku-slang-date/bl...te.rakumod - I added a new type of literal, you can (probably) add a variant of comment. 21:46
lucs Thanks, I'll check it out.
[Coke] it's not direct; you need to figure how the bit of grammar to override, then the QAST to replace it with... and all that is obsoleted by rakuast 21:47
lucs Yeah, I kind of expected it not to be exactly trivial to implement :) 21:48
[Coke] ah, nifty, token comment:sym<#> - so you can probably add another sym in your mixin 21:49
afk 21:50
guifa_ Also 21:52
look up the module basic test
github.com/alabamenhu/BasicTest/tree/main
What are you wanting to do exactly in your slang? 21:53
21:53 jpn left
guifa_ (if you're aiming for anything more than that Date slang, my BASIC test, or the SQL::Inline module, I'd recommend waiting a bit longer because when RakuAST is fully finished slangs will be MUCH easier) 21:54
lucs The idea would be to have a module like PrintDebug, exporting a sub like PRINT-DEBUG(), and it could be toggled on or off, and when off, the lines having those PRINT-DEBUG lines would be totally ignored, like comments. 21:55
It's easy to make the sub not do anything, but I'm not sure how I could make it not evaluate its arguments, even if it does nothing with them. 21:56
guifa_ hmm, I think you should be able to do that as is. Just decide whether to install a noop or an actual sub call. Sub calls are fairly simple
lucs guifa_: You see what I mean about the arguments? 21:58
guifa_ yes, what I just said holds. Because if you don't install the sub call, the arguments wouldn't be evaluated 21:59
lucs Oh, interesting. 22:00
guifa_ the sub call has an argument list that holds things that would be evaluating arguments
the only catch would be that if it's a sub, it's best to probably transform it into a `sinkn Nil` statement or something instead 22:04
otherwise something might not compile quite right on the backend
lizmat fwiw, I think the mechanism that handles DOC phasers could be useful for this 22:12
too bad it doesn't work yet 100% on RakuAST
22:53 evalable6 left, linkable6 left 22:54 linkable6 joined 22:55 evalable6 joined 23:55 hythm left