🦋 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.
Voldenet the only thing I'm wondering about is whether ProtocolSubset does double dereference somehow 00:02
probably not, because new type gets composed from current and protocol, so it's very cheap 00:08
SmokeMachine Voldenet: thanks for your answer. At the end, ProtocolSubset is just a regular subset that tests the .^methods of the data being tested… 00:13
Voldenet I have no idea how subsets work in the context though, coerce might be faster if it's actually a mixin 00:22
what's worse is that profiling is not enough, because profiling will not tell you theoretical limits of generated assembly 00:26
so if protocol method usage can call proper address directly or has to go through some indirection in the end 00:28
SmokeMachine ProtocolCoerce uses the ProtocolSubset… it’s kinda: ProtocolClass(ProtocolSubset) 01:01
01:33 arkiuat left 01:34 vasko4 left 01:35 kylese left, kylese joined 01:42 vasko4 joined 01:44 arkiuat joined 01:49 arkiuat left
Voldenet m: class X { method foo() returns Str { "test" }}; role R { method foo returns Str {…} }; sub n(R $r) { say $r.foo }; n(X.new but R) 02:01
camelia test
Voldenet this appears to be enough however
m: class X { method foo(Int $n) returns Str { "test" }}; role R { method foo returns Str {…} }; sub n(R $r) { say $r.foo }; n(X.new but R) # X never gets validated 02:02
camelia Too few positionals passed; expected 2 arguments but got 1
in method foo at <tmp> line 1
in sub n at <tmp> line 1
in block <unit> at <tmp> line 1
Voldenet so it fails at runtime
so `X.new but R` needs to become protocol-casted and validated somehow anyway 02:03
m: class X { multi method bar() returns Str { "test" }}; role R { method foo() returns Str {…} }; sub n(R $r) { say $r.foo }; n(X.new but R) # correction, it's partially validated 02:10
camelia Method 'foo' must be implemented by X+{R} because it is required by roles: R.
in block <unit> at <tmp> line 1
02:15 kylese left, kylese joined 02:18 arkiuat joined
SmokeMachine That’s not a role that tests if the methods exists… it’s the subset… what I do is: when you do protocol { … } I create a new class with all the methods you defined (yada or not) (a I’ll call it PC). When you parameterize with ProtocolCoerce, it creates the subset (let’s call it PSS) that’s something like: `subset PSS of Any where { @yada-method-names.all ~~ .^methods>>.name.any }` and then the ProtocolCoerce, I do: 02:20
`PC(PSS)` but something I forgot to mention, is that on PC, I create a method `COERCE(PSS)` that receives the data and `but` it with a role that adds PC as its parent…
02:23 arkiuat left 02:37 arkiuat joined
Voldenet ah, so ultimately COERCE validates subset and then adds a role with subset, it probably makes sense 02:40
though for it to be useful, it'd probably need to see if signatures match 02:42
otherwise it kind of does the earlier `but R` check, which is only limited to names 02:43
protocol would imply something stricter 02:47
SmokeMachine Voldenet: github.com/FCO/Protocol/blob/af70c...akumod#L33 03:08
Sorry, I have to go now… &afk 03:09
Voldenet: but please let me know if that makes sense… 03:12
03:28 arkiuat left 03:41 arkiuat joined 03:45 kylese left 03:47 arkiuat left 03:48 kylese joined 03:58 arkiuat joined 04:14 librasteve_ left 04:21 human-blip left 05:10 arkiuat left 05:17 SmokeMachine left, leont left 05:18 kjp left 05:19 kjp joined 05:21 leont joined, SmokeMachine joined 05:23 arkiuat joined 05:28 arkiuat left 05:31 rir_ joined 05:34 avuserow left 05:35 avuserow joined, rir left 05:39 arkiuat joined 05:48 gordonfish- joined 05:49 gordonfish left 05:51 gordonfish- is now known as gordonfish 05:55 Aedil joined 06:19 bdju left 06:21 bdju joined 06:41 Aedil left 07:01 jjido joined 07:12 kjp left 07:13 kjp joined 07:14 kjp left 07:15 kjp joined 07:18 sorenson_ joined, sorenson left, sorenson_ is now known as sorenson 07:29 jjido left 07:34 arkiuat left 07:40 arkiuat joined 08:23 Sgeo left 08:24 lichtkind joined 08:45 arkiuat left 08:59 arkiuat joined 09:04 arkiuat left 09:24 jjido joined 09:32 arkiuat joined 09:37 arkiuat left 09:53 wayland76 joined 09:54 wayland left
disbot3 <holmdunc> Will the redevelopment of the raku.org site be distinct from the docs.raku.org site? I find the latter really nice as it is 10:00
10:06 arkiuat joined 10:10 arkiuat left
[Coke] They are two different sites with different infra, so yes. 10:13
I would like, in general, to have a similar L&F but with different color schemes so one person *could* easily work on both UIs, but I am not looking for that right now. librasteve & finanalyst are working on different UI and backend bits and am pretty sure they are not unifying any of the styles or JS as part of them 10:16
10:27 arkiuat joined
disbot3 <holmdunc> Cool. FWIW this page docs.raku.org/reference is just sheer awesome. Don't think I've ever seen such a large well-presented set of guides on any official language site 10:29
[Coke] Happy to hear it! 10:30
10:31 arkiuat left 10:45 arkiuat joined 10:50 arkiuat left
lizmat weekly: github.com/Raku/problem-solving/issues/488 10:55
meh, looks like we lost notable6 10:56
meh, already 2 days ago :-( 10:57
11:03 arkiuat joined 11:07 arkiuat left 11:20 arkiuat joined 11:24 arkiuat left
[Coke] I was going to do a restart but lost my special push privs when the repo was moved recently 11:26
saw you did a pr
(I made a ".ping" file for meaningless edits to trigger the rebuild, FYI) 11:27
11:34 bdju left 11:36 bdju joined 11:44 arkiuat joined 11:49 arkiuat left 12:07 jjido left 12:17 arkiuat joined 12:24 arkiuat left 12:29 jjido joined 12:45 arkiuat joined 12:49 arkiuat left 12:58 rir_ left 12:59 rir joined, rir left 13:00 rir joined
rir nanos 13:05
jdv picos
disbot3 <antononcube> jedos 13:08
rir ^^ That was supposed to be a search. 13:09
13:10 jjido left 13:18 arkiuat joined 13:23 arkiuat left 13:46 arkiuat joined 13:51 arkiuat left
disbot3 <librasteve> weekly: rakujourney.wordpress.com/2025/07/...k-editing/ 13:59
14:00 librasteve_ joined
disbot3 <librasteve> @holmdunc thanks for the feedback on the docs site (all kudos to finanalyst, not me) - but its important to understand where the diamonds are from everyone's point of view 14:07
<librasteve> stylistically, the design goal for the new raku.org site is to employ a modern, ready build CSS library (ie choose the best in class rather than do a full custom website CSS design) - in my searching I was particularly impressed with the Pico CSS library (picocss.com) which has three fundamental characteristics that recommended it (i) it is super clean and minimalist (ie very modern), (ii) it has excellent responsive 14:12
characteristics (with light/dark colours and modes) and (iii) it has (almost) the right set of pre-built components set out in a semantic way.
<librasteve> rakujourney.wordpress.com/2024/09/...-pico-css/ <== anyway I blogged about this in a bit more detail when selecting Pico ... and the target all along tbh has been to drag raku.org into a better place 14:15
14:17 arkiuat joined
disbot3 <librasteve> that said, the Rakudoc site has been built by finanalyst with Bulma CSS ... I am in regular contact with Richard and he and I share the desire to keep the raku.org and docs.raku.org L&F very close - initially the design is intended to be complementary so not a shock to move from one to the other - we are now exploring the ways to brings HARC Stack and the Rakudoc site closer and we will be sure to share back our results 14:19
<librasteve> one initial step in this direction is that I recently (with Richard's encouragement) excised the raku Hilite module (raku.land/zef:librasteve/Hilite) from Rakudoc::Plugin::HTML into a stand alone module (it uses Patrickbkr RakuAST based Rainbow module under the hood for raku code highlighting ... so the code examples L&F between the two projects is already unified 14:22
14:22 arkiuat left
disbot3 <librasteve> PS. while I really like the content of the page you mention, I suggest you open it on a smartphone (51% of web visits are via a phone these days) ... or just narrow your browser width to 1200px ... so I would contend that by working together we can further improve it ;-) 14:26
<holmdunc> Thank you, nice work. I may try HARC myself at some point because I've used HTMX with Python & Starlette in the past 14:46
14:48 nativecallable6 left, benchable6 left, bloatable6 left, quotable6 left, releasable6 left, shareable6 left, greppable6 left, tellable6 left 14:49 arkiuat joined 14:51 bloatable6 joined 14:52 linkable6 joined, notable6 joined, nativecallable6 joined, tellable6 joined, unicodable6 joined, releasable6 joined, evalable6 joined, benchable6 joined 14:53 committable6 joined, shareable6 joined, bisectable6 joined, quotable6 joined, sourceable6 joined, arkiuat left 14:54 greppable6 joined, coverable6 joined 15:15 arkiuat joined
tbrowder and i just watched Steven Lembark's presento on closures where he demoed one of the many reasons i left Perl as fast as i could. 15:19
15:20 arkiuat left
tbrowder i feel sorry for those folks who are stuck with perl because their job requires it. 15:22
15:25 jjido joined
disbot3 <librasteve> posted on HN submit rakujourney.wordpress.com/2025/07/...k-editing/ all eye catching and subversive comments welcome 15:45
<librasteve> news.ycombinator.com/item?id=44626278 15:46
<librasteve> (help lost coders find raku and save them from perl oblivion) 15:47
15:49 arkiuat joined 15:53 arkiuat left
jdv why did you leave then? you don't like closures? 16:10
tbrowder: ^
16:18 jjido left 16:20 arkiuat joined 16:24 arkiuat left 16:25 jjido joined
Voldenet SmokeMachine: I've tried using `protocol` lib but it doesn't export the enum 16:25
tbrowder clo 16:26
Voldenet SmokeMachine: tbh I don't understand how subsets and roles are implemented well enough to say, but I think that ProtocolCoerce could do the check cache the type somehow instead of validating the subset every time 16:27
16:27 Aedil joined
SmokeMachine Voldenet: No? Really?? This should be being exported (github.com/FCO/Protocol/blob/af70c...akumod#L8) are you using the correct branch?! It’s not on master… 16:28
Voldenet I'm using zef one 16:29
probably wrong version
tbrowder you didn’t catch my feeble attempt at humor. i have no need to use them because the raku class allows me most if not all the ugly perl code steven demord
SmokeMachine That’s the reason then… I haven’t released the new features yet… (not even merged it…)
The on on zen only creates the subset… so it is not parameterized… so no enum… 16:31
Voldenet: I’m thinking if the new features should be under :api<2> 16:33
jdv tbrowder: i don't get what you mean 16:36
Voldenet I've checked, ProtocolCoerce is just mindblowingly slow
jdv raku has closures
timo Voldenet: we don't do any kind of caching for subset type checks, the type checks will probably run a bit more often than you expect for a variety of internals-y reasons, but we also don't have anything that can prove that the type check result remains stable over time
jdv: presumably something about the rules of what is closed over or not? 16:37
i just lost my internet connection so i can't really watch the presentation myself
SmokeMachine Voldenet: because of the `but`, I suppose?
jdv i guess i'll watch it then 16:39
Voldenet timo: I see, thanks – I wouldn't have expected any subset-level checking though
timo how do you mean?
jdv i feel i've probably heard it before but its been a while
Voldenet I mean - if the thing is checked as subset once, it will get checked whenever it gets passed to other method 16:40
unlike role, which can specialize the code better
timo yeah, the check runs every time a value is assigned to or bound to a variable (including parameters) with that type
Voldenet and it makes sense, because it operates on current value, it is a runtime check 16:41
timo yes, we need something that can reason about what the code of the subset does
if we could somehow use dispatchers for this purpose, that could be a lot better, but it requires a lot more complicated code from the creator of such a subset 16:42
16:42 arkiuat joined
timo the dispatcher can explicitly state that if the type is the same as last time, it doesn't have to do anything at all 16:42
which will still be per-callsite X per-type, but a lot less in general 16:43
until then, it should be safe for you to put an explicit cache in the subset checking code
Voldenet m: subset RecentNow of Instant where { $_ + 1 > now }; sub b(RecentNow $x) { say $x }; sub a(RecentNow $x) { sleep 1; b($x) }; a(now) 16:44
camelia Constraint type check failed in binding to parameter '$x'; expected RecentNow but got Instant (Instant.from-posix(1...)
in sub b at <tmp> line 1
in sub a at <tmp> line 1
in block <unit> at <tmp> line 1
Voldenet m: subset RecentNow of Instant where { $_ + 1 > now }; sub b(RecentNow $x) { say $x }; sub a(RecentNow $x) { b($x) }; a(now)
camelia Instant:1753029897.100092387
Voldenet so it makes sense that it's a runtime check
16:46 arkiuat left
SmokeMachine ProtocolSubset could be a bit faster if I wasn’t using junctions on that, I suppose… 16:48
Voldenet SmokeMachine: I'd be betting it's because `COERCE` does `value but ParentRole[$parent, value];` - in case of type-based COERCE it might be enough to have type-level check probably` 16:49
Subset is 10x faster
still, simple `role Foo { method bar() { … } }; class X { method bar() { } }; my $n = X.new but Foo;` is a lot faster 16:50
I'm thinking out loud, but maybe ProtocolSubset should be runtime check and ProtocolCoerce should be type-level check (check if type can be used by the protocol on first use, then do `but TargetRole`) 16:52
I'm still not sure what ProtocolClass would be for either way 16:54
in fact, maybe different naming would've been better
`protocol Foo { … }; my Foo[RuntimeCheck] …; my Foo[TypeCheck] …; etc.` 16:55
SmokeMachine But in that case it wouldn’t add the new methods on coerce? 16:56
Voldenet It would, because TypeCheck would first get type, then extract role impl for that type 16:57
effectively I'd expect it to do exactly what `$value but Role` does 16:58
SmokeMachine I was trying to create a role initially… but I think I’m not art enough… :(
Voldenet I'm not sure how implementation would look like either :/ 16:59
SmokeMachine I do not understand all those Role like meta model roles… 17:00
Voldenet I was only expressing how "if the world was perfect, this is what I'd expect it to be" :)
timo you mean like RoleGroup and all that?
SmokeMachine timo: yes, that and the parametric ones and etc… 17:02
timo right. i can't claim to be an expert on this part of the code, but i believe it has to do with how SomeRole behaves when there is also SomeRole[$foo] and such 17:04
hm, did we have multi roles?
SmokeMachine My original intention was to create a role to be used on coerce, but the closer I was able to do was to create a class, and a role not meta created that adds the class as parent…
timo: sorry what do you mean? 17:06
timo m: role Flubber[int $amount] { }; say Flubber.HOW.^name; say Flubber[99].HOW.^name 17:07
camelia ===SORRY!===
No appropriate parametric role variant available for 'Flubber':
Cannot resolve caller (Flubber[Int]:U, Int:D); none of these signatures matches:
(::$?CLASS ::::?CLASS Mu, int $amount)
timo oops, i guess not like that huh
m: role Flubber[Int $amount] { }; say Flubber.HOW.^name; say Flubber[99].HOW.^name
camelia Perl6::Metamodel::ParametricRoleGroupHOW
Perl6::Metamodel::CurriedRoleHOW
timo you were refering to the different HOWs i assumed
jdv timo: there is nothing in the ecos for tailing a file or similar 17:08
did you know of something i couldn't find?
timo no, i was ... wishcasting i guess?
sorry i wasn't clear that i was speaking hypothetically 17:09
17:10 Sgeo joined
jdv cool 17:11
SmokeMachine timo: I was talking about creating a role programmatically here (where I’m creating a class): github.com/FCO/Protocol/blob/coerc...ol.rakumod 17:12
17:15 arkiuat joined
timo i'm worried that using "but" for this purpose will break down with objects that are mutable 17:15
"this purpose" being really just what i gather from only half paying attention and being unable to concentrate very good 17:17
17:19 arkiuat left 17:24 arkiuat joined
SmokeMachine I’m also thinking that if we find a way to not use but, it would be good, because it makes it impossible to use undefined values… 17:28
17:29 arkiuat left 17:58 arkiuat joined 18:05 jjido left 18:13 mc2 left 18:17 cliviafreak joined 18:27 cliviafreak left, mc2 joined 18:40 cliviafreak joined 18:51 cliviafreak left 18:59 cliviafreak joined 19:06 cliviafreak left 20:16 Aedil left 21:11 jjido joined 22:10 arkiuat left 22:15 lichtkind left 22:22 arkiuat joined 22:26 arkiuat left
Voldenet but you can use but with undefined values 22:39
m: use nqp; role Aaa {}; for [nqp::null, Mu, Nil, Any] { my $x = $_ but Aaa; say $x } # pick your fav flavor of null 22:40
camelia (Mu+{Aaa})
(Mu+{Aaa})
(Any+{Aaa})
(Any+{Aaa})
22:46 arkiuat joined
SmokeMachine It seems the problem I was seeing is about parent: glot.io/snippets/h9ekwne74l 22:52
m: class C {}; role R { ::?CLASS.^add_parent: C }; say Any but R 22:54
camelia Could not build C3 linearization: ambiguous hierarchy
in block <unit> at <tmp> line 1
23:00 arkiuat left 23:23 wayland76 left 23:27 arkiuat joined 23:35 arkiuat left 23:40 arkiuat joined 23:41 jjido left, librasteve_ left 23:49 guifa joined
guifa I uploaded UI::Window v0.0.1 if anyone wants to play with it 23:49