This channel is intended for people just starting with the Raku Programming Language ( Logs are available at
Set by lizmat on 8 June 2022.
jaguart stevied - do you want a code review of your mod (albeit from a newbie?) - I'll give it a go if you want, so I can learn too 🙂 00:43
Nemokosch good morning :DD
jaguart things like: dir-check fails if $dir.f -> but maybe should probably be fail unless $dir.d because symlinks - which might need a follow to see if they link to a file or a folder, etc. 00:45
Morning Nemo 😄
stevied sure, absolutely 01:03
i'm not much past newb and have a lot to learn 01:04
jaguart do you have any thoughts on how? I could create a github pull request and then we can comment on my alternates? 01:05
stevied ok, let's try that
jaguart ok - give me a few hours, have some bits to do first 01:06
stevied ok
I forget how to embed a variable in a variable: @.$ext-files 01:07
$ext is the variable
Nemokosch and this is an attribute
does @."$ext-files" not work? 01:08
by the way, really, what is the obsession with this hack? :cameliathink:
stevied doesn't work, no
Nemokosch are Maps dull these days?
jaguart do you mean you want to interpolate an attribute name? ala
stevied yeah, an attribute
jaguart never tried this for attributes thoug 01:09
stevied ok, cool. that was the section I was looking for. forgot where to find it
Nemokosch still not sure how this would apply to attributes
I thought what I wrote would work for method calls at least 01:10
jaguart sounds like an anti-pattern though - why not have %.dir where you lookup using %.dir{$ext}
stevied yeah, good idea
jaguart the ."" method lookup need parens I think - ."$ext"() 01:11
Nemokosch m: my $lol = 'polymod'; say 5."$lol"();
yes, I think it works
had to realize there is no evalbot for the time being
the cost of the bridge switchover
jaguart did someone kill her :o
Nemokosch the thing is, gfldex hosted the evalbot AND the bridge, they might have been the same program even 01:12
so now that there was a bit of motion to get a bridge that isn't tied to gfldex but rather the discord mods, the evalbot function isn't solved yet 01:13
jaguart so no m: use nqp;... 😉
Nemokosch not gonna lie, this bridge looks nice at least, if it's written in plain old JS(/TS) 01:15
maybe there can be a solution for evaling, we'll see, no stress for now 😄
the OG move would be to adopt the Camelia IRC bot, of course 01:16
02:21 rf left 03:40 rf joined 04:15 rf left
jack9 m: my $str = 'x'; class Foo { has $.x; } say$str; 06:15
jaguart jack9: maybe my $m = 'x'; class C { has $.x; }; say"y"))."$m"(); 06:49
the ."$m"() --> calls method by interpolated name .""() 06:51
08:52 dakkar joined
jack9 can you use c++ instantiation syntax in raku 10:05
Nemokosch do you mean like new Classname? 10:06
jack9 yes 10:17
Nemokosch You could fake it I guess but there doesn't seem to be any point. A constructor still has the API of a method. 10:36
you could invent a prefix new operator, for example but not sure how it would add up 10:37
jack9 you can literally create operators in raku 10:47
with precedence?
Skarsnik yes, you can even inject new grammar (slang) 10:54
jack9 raku be context sensitive 10:58
Nemokosch yes, you can kind of create DSL's 11:06
but this will probably be easier and more stable once the RakuAST developments mature 11:07
11:11 ab5tract joined
jack9 RakuAST? is that a module to expose raku asts? 11:18
Nemokosch a bit more than that: it's basically a new representation of Raku code 11:21
a representation that both a compiler and an author can use
as things stood for a long, long time, there was the written textual code and the Rakudo parser tried to turn it into its own VM representation, QAST 11:23
QAST is something the Rakudo backends, especially MoarVM but I think basically all three, like to consume 11:24
but it has quite little to do with Raku's syntax structure per se. A lot of things are dismantled and generated to leverage the backends that consume it 11:25
so the idea was that it would be much easier to generate code, both for the compiler and especially for the authors, if there was a way to represent Raku code directly, without either having to parse it again or basically use a lower-level, highly compiler-specific structure that isn't really Raku 11:26
I only took a couple of looks at it but I can say (and it's pretty much agreed by more experienced developers) that the compiler also got much cleaner, it's way easier to understand what is going on 11:27
if you check #raku-dev-irc , it's (almost) all about RakuAST developments at the moment. The parser is not yet used but it's actively developed and one can try it on a fresh build of Rakudo with RAKUDO_RAKUAST=1 env 11:29
and module authors can try generating code with RakuAST nodes already 11:30
jack9 so like, python ast but more 12:11
Nemokosch probably something like that, yes 12:20
jack9 is there a way to see moar bytecode 13:40
Nemokosch I think this is a #moarvm-irc kind of question 13:42
14:28 rf joined
stevied I'm not doing something right here: method has-legacy-extensions(*@exts where {@ext.grep: $_} ) 14:48
I want to limit the arguments that can be passed to the strings that are in @ext
lizmat And yet another Rakudo Weekly News hits the Net: 15:06
15:28 jgaz joined
rf stevied: Try where { @ext.index($_) !~~ Nil } 15:58
Nahita f(*@args where not @args (-) @allowed) 16:05
f(*@args where @args ⊆ @allowed) 16:07
16:20 NemokoschKiwi joined
stevied @Nahita thanks! worked perfectly. even when for when @args is empty, which is what i want 16:21
Nemokosch as a sidenote: *@args is a flattening slurpy, **@args is a structure-preserving slurpy and +@args is a slurpy that unrolls a single argument but otherwise it's like **@args 16:23
stevied ok. yeah, forgot there were even different kinds of slurpies. you could literally write an entire book about signature arguments 16:24
there's a good reason raku took almost 20 years to write 16:27
16:34 NemokoschKiwi left 16:57 jgaz left 17:11 jgaz joined 17:36 dakkar left 17:57 ab5tract left
Nemokosch @jack9 another similar example to what I did with augment class and adding a method 18:10
20:44 discord-raku-bot left, discord-raku-bot joined
stevied any module for searching and replacing content in a single file? 20:53
Nemokosch pretty sure you could run rak that way 20:55
what do you have in mind?
stevied I want to easily update a META6.json file. Find all instances of String X, Y, and Z and replace with String A, B, and C 20:56
I could roll it myself but would rather not
Nemokosch okay, now there is not one pattern and one output but 3 literal strings 20:58
it makes a difference, for the latter, trans might be a better fit
stevied there could be less than 3 or many more than three
Nemokosch what do you need these indefinite string subsitutions for? 20:59
stevied updating the names of file extensions 21:00
Nemokosch I'm thinking if the META6 module is more convenient to work with 21:01
so yeah 21:15
stevied this one? 21:16
Nemokosch yep
use META6; my $meta = => 'META6.json'); # whatever file path
stevied how does that make it easier for me to edit an existing file? 21:17
Nemokosch by reading that existing file and turning it into an object and a map? 21:18
stevied yeah. other option is to just do a slup of the file and do some regexes on it 21:19
that's easier for me, at least
Nemokosch well then do that
I for one think it's harder, besides being more fragile 21:20
stevied is the provides section the only part of the file that would have file extensions? 21:22
I think it is. 21:23
Nemokosch in theory the resources part could also contain relevant files, although it typically wouldn'
stevied true, at least not related to the operation of the module. thought I should probably exclude that directory when I search for legacy extensions 21:24
actually, there are probably other dirs like that. hmmm.
using a regex will leave a smaller footprint. won't mess with the persons' whitespace or anything like that. 21:27
Nemokosch whether the latter is a good thing could be debated 21:28
stevied can you think of a time when .t or .pod6 files would ever be listed in META6.json? 21:29
Nemokosch pod6 I could imagine in the resources, especially if you are finanalyst who really fancies Raku-native formats for basically everything
by the way, I'm also somewhat disappointed by the META6 module, I thought it would have a nicer interface... 21:30
stevied yeah, I don't think the module should touch anything in resources 21:31
Nemokosch the question is really, how much foolproof you want to be, how much it's a problem if some files get unwanted modifications
stevied well, the user will have an opportunity to review what gets changed before the module does anything 21:32
at least in the command line version of the module
p6steve maybe could help 21:34
stevied i think if I do a regex in just the "provides" section of the file and replace extensions between .\w+" I should be safe
Nemokosch been there 😛
you know 21:36
I'd be curious of a parser module
that can give you a cursor in the file to the parsed nodes
where they start, where they end
I don't know if there is such a thing, and especially not how to look for this concept
stevied seems like it could be done easily enough with json 21:37
Nemokosch anyway, this is getting a bit trivia style 21:40
it would be good to have a META6.json scheme "set into stone" more or less, I wouldn't be surprised if a valid scheme could be parsed with regex only even
no deep nesting 21:41
stevied yeah, you'd think there would be a parser for existing meta6 files 21:43
oh, wait, that module can 21:45
Nemokosch it can but it discards whitespace and stuff 21:48
stevied well, what I'm thinking is I do a hybrid approach. grab the provides section as json, make my changes to it, and then do a regex to replace the provides section in the original file 21:50
jaguart watch out for mi6 build though - that rewrites the provides section based on the file system 21:52
in fact - maybe that's what you want? update teh filesystem and then run mi6 build
stevied i'm changing the names of the files in the filesystem first so that shouldn't be a problem
jaguart yeah - but that's exactly what mi6 does for you 21:53
stevied but mi6 build would change their meta6.json file all around
i don't want to touch anythign other than the file extensions
jaguart true - it does a sanity check that the provides matches the file system - because bad things happen when they dont
and there seems little point in fixing something broken so it is still broken 🙂 21:54
also mi6 has been tested against a lot of modules and is in active use on multi platforms... 21:55
how are you going to get all the dists to accept your pull requests?
esp given that many of them don't respond, even after years of peep asking? 21:56
are you going to fork all the dists? 😮 21:57
stevied yeah, i'm going to fork all of them locally
probably just do a few a day to start to see how it goes 21:58
it'll help weed out module that have been abandoned
jaguart I see that your #166 fix is released in mi6 🙂 21:59
stevied yeah, gotta test it out. 22:01
22:02 NemokoschKiwi joined 23:05 NemokoschKiwi left
Nemokosch #166 fix of what? 23:06
btw @jaguart the evalbot doesn't... exist, yet