This channel is intended for people just starting with the Raku Programming Language ( Logs are available at
Set by lizmat on 8 June 2022.
Anton Antonov <@297037173541175296> Here: 00:01
Nemokosch does this actually explain though? I watched this back then 00:17
Anton Antonov Yeah, it is a very short explanation -- camelCase puts more line-noise to the reader of the package. 00:34
I agree with that. I prefer kebab-case, but often I forget that is an option in Raku. 00:36
00:54 Nemokosch left
Nemokosch I'm fine with kebab-case but yeah, I don't think it's an unforgivable sin to use camelCase for whatever reason 00:55
01:14 frost joined
guifa To me it's just a "make stuff consistent" โ€”ย and that's when you can often argue in favor of using stuff other than kebab case โ€”ย if interacting with tools that default to other ones, it can sometimes make more sense to maintain their styles 01:48
02:01 razetime joined 02:34 Heptite joined
CIAvash I personally think one should use whatever style they want, unless they want to follow a convention or style guide for working in a team or other reasons. 03:15
Anton Antonov I have used camelCase for decades in any language I have programmed. So, that style creeps in if I do not pay attention into my Raku packages. 03:32
03:49 Heptite left 04:38 razetime left 04:39 razetime joined 05:15 razetime left 05:16 razetime joined 06:38 razetime left, razetime_ joined 07:39 Guest68 joined 07:58 razetime_ left 07:59 razetime joined
Kaiepi i use kebab-case in raku mostly 08:53
huge exception being metamethods
because those tend to use `_`
Nemokosch I would like to use my own comparator for testing my module, it would be good if I could import it in all test files without exporting it from the module 10:30
Is there a way to do this without making a different module?
10:44 gfldex left, deadmarshal left
lizmat Nemokosch: perhaps answers your question 10:45
10:49 gfldex joined, deadmarshal joined
Nemokosch well, I don't know... maybe not 10:58
the important part is that I want it to be shared across multiple test files 10:59
without polluting my module to the outside
11:30 razetime left 11:31 razetime joined 12:31 frost left 12:35 Kaiepi left 12:36 Kaiepi joined
Kaiepi my `Trait::Traced` module has a shared `t/lib` for tests 12:39
`use lib $?FILE.IO.sibling: 'lib'` 12:40
but i recall people working on the module loader being kind of irked by this pattern for one reason or another
but i recall people working on the `CompUnit` etc. being kind of irked by this pattern for one reason or another 12:42
in rust it's not uncommon for one crate to be fragmented. maybe a test dependency others depending on it could take advantage of optionally <@297037173541175296> ? 12:44
Nemokosch > maybe a test dependency others depending on it could take advantage of optionally 13:03
sorry but I just can't comprehend this sentence lol
Kaiepi a completely separate module not bundled with the library itself 13:09
there's a test dependency field in `META6.json` for stuff like that 13:10
if you need tools to help with testing, others might as well 13:11
guifa Nemokosch: a few things I could think of. One, put it in a separate module file within your module. This would make it available to you, but you could even feature guard it as exported only with `use My::Comparator :TESTING` or something. Two, if the comparator might have even a slight bit of general benefit outside of your module, put it in its own module, and include it as a test dependency only. Three, I believe you
are able to have t/lib/Comparator.rakumod; and then in t/01-foo.rakutest have `use lib 'lib', use Comparator`
I feel like I've done three before, but don't quote me on it
Kaiepi ^ 13:12
lizmat and yet another Rakudo Weekly News hits the Net: 13:25
Nemokosch well, I'll have to ponder upon this anyway. Let me summarize the situation itself as well 13:44
HTML::Tag generates HTML strings from objects that describe tags 13:45
the order of attributes doesn't matter in HTML 13:46
but random attribute order is hard to test
so the workaround I inherited was to sort the attributes some way
I'd like to get rid of this eventually, it's an unnecessary performance cost
I'd rather have slower tests than slower runtime code 13:47
Kaiepi are you depending on `^attributes`? 13:48
Nemokosch perhaps not
but the attributes are stored in a Hash anyway iirc
Kaiepi yeah, that's `^attribute_table`
Nemokosch I mean, it's done by hand basically
there is an attr field
and that attr field is populated 13:49
eventually the mktag method generates the string from that (as well) 13:50
Kaiepi it looks a bit like the values want a wrapper with a `Str` method 13:53
with `when %self-resolving{$_}` and `default` being one type and `when 'value'` being another 13:54
Nemokosch Let me quote the original author: "definitely work in progress" ๐Ÿ™‚
And I don't want to appear thankless because what you're saying makes sense ultimately, it's a good way to go about it probably 13:55
But I think we could establish the "Y-X problem" term, as a paraphrasis of "X-Y problem" 13:56
and I can understand that many people don't like to show code because of that
they ask about "Y" and they get answers about "X" instead
Kaiepi ah sorry
Nemokosch like let's assume for now that the implementation is nicer ๐Ÿ˜‚ 13:57
I'm not sure if that makes the test easier
unless there is a clever way to eliminate to nondeterminism altogether
13:58 Heptite joined
yabobay is this very beginnery? 14:00
Nemokosch I assumed so, because I'm super unknowledgeable with modules
and since it came up if the testing could be useful for others, I thought it would be good to talk about what needs to be tested 14:01
so that others can judge if it's worth it 14:03
guifa I wonder if a Test::Util module might not be a bad idea. For instance, it's not super easy to see if two lists are functionally equivalent. for instance, <a b c> ~~/eqv <c b a> returns False, but that's probably a common test someone might want to do. You *could* convert both to a bag, but I'd venture to say that's not immediately intuitive for someone. So Test::Util could export, say, is-basically-same test, or an 14:05
unord-eqv infix, etc.
(also the Bag version wouldn't work on arbitrary objects, since IIRC it uses WHICH / === comparisons) 14:10
Nemokosch yes, it does 14:13
<@989550365533937664> ๐Ÿ˜Ž 14:25
yabobay where is this written 14:26
liz always sends it to IRC 14:27
lizmat m: <a b c> (==) <b c a> # guifa, set equality for the win!
Nemokosch and gfldex usually reposts it in <#538445796664803330>
camelia WARNINGS for <tmp>:
Useless use of "(==)" in expression "<a b c> (==) <b c a>" in sink context (line 1)
Nemokosch if you are looking around on a monday or tuesday afternoon on this server, there are ~ 3 occasions to catch it ๐Ÿ˜‹
lizmat m: say <a b c> (==) <b c a> # guifa, set equality for the win! 14:28
camelia True
Nemokosch does it work for "multisets" as well?
m: say <a b c a> (==) <b c a>
lizmat Nemokosch: if no sets are in the equation, then set semantics are assumed 14:29
m: say <a b c a> (==) <b c a> # set semantics
camelia True
lizmat m: say <a b c a> (==) <b c a>.Bag # bag semantics
camelia False
Nemokosch well... sometimes you want this to be False, depending on the task
lizmat then use Bag semantics by making either side of the comparison a Bag 14:30
m: say <a b c a> (==) bag <b c a> # perhaps better readable 14:31
camelia False
Nemokosch it makes sense but if we accept the premise that converting to Bag is "code smell" in the test, then we are left with nothing
which I don't necessarily agree with, to be honest, but it's not ocompletely baseless either 14:32
which I don't necessarily agree with, to be honest, but it's not completely baseless either
lizmat m: dd (<a b c a> (==) <a b c>):bag # would an adverb like that make more sense ? 14:45
camelia ===SORRY!=== Error while compiling <tmp>
You can't adverb (<a b c a> (==) <a b c>)
at <tmp>:1
------> dd (<a b c a> (==) <a b c>):bagโ # would an adverb like that make more
expecting any of:
pair value
Anton Antonov Why not use XOR (symmetric difference) on sets (or lists or bags) and test is it empty? Something like `@A โŠ– @B eqv โˆ…` . 14:55
(I might have missed the point of the discussion though... ) 14:56
lizmat Anton Antonov: that's why I implemented set equality, so you wouldn't have to do that 14:59
set equality also allows short-circuiting
m: say <d a b c> (==) <a b c> # returns False on seeing that "d" is not at the right hand side 15:00
camelia False
Anton Antonov @lizmat Yes, `(==)` is good / useful. Definitely wasn't in my active Raku vocabulary. (But I can "figure out" or come up equations like the one I posted above.) 15:03
@lizmat I started considering Raku for implementing Machine Learning (ML) algorithms after seeing this talk of yours: "Raku - Sets without borders", . (I mentioned that before.) Before that I was using _only_ Raku's grammars functionalities. So, I am rewatching that talk now, since I am sure I have missed some (important) detai 15:28
Heptite Is Learning Perl6 a decent resource to start learning Raku? 15:33
Anton Antonov @Heptite I think so. It is the first book I read on Raku / Perl6. (Then Moritz' "Parsing with Perl 6 Regexes and Grammars: A Recursive Descent into Parsing".) 15:45
Heptite Thank you. :) I'll start there. 16:16
guifa m: class A { has $.x }; say (==) 16:17
camelia False
guifa ^^ lizmat unfortunately, (==) fails for non-value types. A (==)-like operator that uses eqv instead of === could be useful (not for Raku itself, but for test utils and such) 16:18
lizmat guifa: fair point, but of course, you could make A a ValueType (if that makes sense) 17:16
Anton Antonov Is there are a way to make provide detailed descriptions for CLI scripts in a package? For example, I think the CLI usage message is way too long here: 17:23
17:49 razetime left 18:35 n1to joined
guifa You can override `sub USAGE` for basic control, or `sub GENERATE-USAGE` for really fine grained control 18:37
Anton Antonov @guifa Thank you! I will read the documentation for that. 18:40
22:04 n1to left