🦋 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.
00:07 reportable6 left 00:08 reportable6 joined 00:15 jjido left 01:00 Kaiepi left
Nemokosch ^ means beginning of string 01:13
^^ means beginning of line
01:31 guifa joined 02:01 frost joined 02:35 silug left 02:36 silug joined 02:38 Kaiepi joined 03:33 Guest35 left 03:36 Sankalp left, Sankalp joined 04:12 londoed__ left, londoed__ joined 04:20 guifa left 04:26 guifa joined 04:31 guifa left 04:44 z4kz joined 04:45 guifa joined 04:48 xinming left 04:50 swaggboi left 04:51 xinming joined 04:54 z4kz left 04:57 Kaiepi left 05:01 juanfra__ left, juanfra__ joined 05:03 swaggboi joined 05:05 londoed__ left, londoed__ joined 05:47 jmcgnh left 06:04 Oshawott joined 06:07 guifa left 06:08 archenoth left, reportable6 left 06:09 reportable6 joined 06:10 Sgeo_ joined 06:12 Sgeo left 07:12 evalable6 left, bisectable6 left, greppable6 left, benchable6 left, committable6 left, unicodable6 left, releasable6 left, statisfiable6 left, tellable6 left, quotable6 left, nativecallable6 left, reportable6 left, bloatable6 left, shareable6 left, linkable6 left, notable6 left, sourceable6 left, coverable6 left, quotable6 joined, releasable6 joined 07:13 nativecallable6 joined, benchable6 joined, reportable6 joined, notable6 joined 07:14 greppable6 joined, shareable6 joined, bisectable6 joined, sourceable6 joined, tellable6 joined, unicodable6 joined, linkable6 joined, coverable6 joined 07:15 bloatable6 joined, evalable6 joined, committable6 joined, statisfiable6 joined 08:15 evalable6 left, bloatable6 left, nativecallable6 left, linkable6 left, unicodable6 left, shareable6 left, bisectable6 left, releasable6 left, sourceable6 left, notable6 left, tellable6 left, reportable6 left, statisfiable6 left, quotable6 left, committable6 left, benchable6 left, greppable6 left, coverable6 left 08:16 greppable6 joined, sourceable6 joined, linkable6 joined, bisectable6 joined, benchable6 joined, committable6 joined 08:17 bloatable6 joined, statisfiable6 joined, coverable6 joined, notable6 joined, nativecallable6 joined, unicodable6 joined, quotable6 joined, releasable6 joined 08:18 reportable6 joined, evalable6 joined, tellable6 joined, shareable6 joined 09:01 Kaiepi joined, guifa joined 09:02 jjido joined 09:04 guifa left 09:06 Kaiepi left 09:11 Kaiepi joined 09:32 Sgeo_ left 09:47 razetime joined 10:11 jjido left
lizmat weekly: www.reddit.com/r/rakulang/comments...ence_2022/ 10:25
notable6 lizmat, Noted! (weekly)
10:52 grondilu joined
grondilu Hi 10:52
I realized I followed the wrong track for my project, yet again. The method I used won't allow me to have distinct instances. 10:53
So I want to try an other method : using classes similarily as closures. If that makes any sense.
Here is a mockup : gist.github.com/grondilu/386665ea3...96f6bab244 10:54
Would you mind look at it and tell me if that makes sense to you?
lizmat grondilu: one thing that jnthn taught me (again and again I might say) is that classes are *not* closures 11:03
looking at your gist, all instances returned will be instances of the *same* anonymous class
so there's no difference with calling that class "Foo" and doing "say Foo.new: 13 for ^100" 11:04
SmokeMachine grondilu: for that, maybe you should use MOP. 11:18
m: sub get-class { my $type = Metamodel::ClassHOW.new_type: :name(“UnluckyNumber” ~ ++$); $type.^compose; $type }; say get-class.^name for ^3 11:22
camelia UnluckyNumber1
UnluckyNumber2
UnluckyNumber3
SmokeMachine grondilu: 👆 11:23
11:52 evalable6 left, linkable6 left, linkable6 joined 11:53 evalable6 joined
grondilu noted 11:58
lizmat still, this does feel like a X-Y solution.. :-) 12:04
12:09 reportable6 left 12:10 reportable6 joined
grondilu I think I'll try to use parametrized roles again. I just need to accept that the parameter has to be known at compile time. 12:17
lizmat m: role Foo[$a] { method bar() { $a } }; my $b = 42; say Foo[$b].new.bar; 12:19
camelia 42
grondilu using the MOP seems too complicated
lizmat grondilu: ^^ the parameters to a parameterized role don't need to be known at compile time
grondilu well I'm confused then, as that is not what we concluded few days ago. 12:20
lizmat m: role Foo[$a] { method bar() { $a } }; my $b = 42; class Bar is Foo[$b] { }; dd Bae 12:21
camelia ===SORRY!=== Error while compiling <tmp>
Undeclared name:
Bae used at line 1. Did you mean 'Bag', 'Bar'?
lizmat m: role Foo[$a] { method bar() { $a } }; my $b = 42; class Bar is Foo[$b] { }; dd Bar.new.bar
camelia Any
lizmat if you consume a role into a class, it needs to be compile time
m: role Foo[$a] { method bar() { $a } }; BEGIN my $b = 42; class Bar is Foo[$b] { }; dd Bar.new.bar
camelia 42
lizmat but not if you pun a role 12:22
grondilu indeed
13:10 linkable6 left, evalable6 left 13:11 linkable6 joined, evalable6 joined 13:35 razetime left 13:41 frost left 13:47 razetime joined 13:48 razetime left 14:02 Guest35 joined 14:55 masak joined 14:56 CIAvash left, Matthew|m left, daxim left, vodkra left, masak_ left, El_Che left, goblin left, PotatoGim left 14:57 CIAvash left, Matthew|m joined, CIAvash joined, daxim joined, vodkra joined, El_Che joined, goblin joined, PotatoGim joined 15:26 Kaiepi left 15:55 jaguart joined 16:06 Kaiepi joined 16:18 z4kz joined 16:38 z4kz left 16:44 lichtkind joined 17:44 reportable6 left, bloatable6 left, notable6 left, benchable6 left, greppable6 left, committable6 left, nativecallable6 left, releasable6 left, sourceable6 left, linkable6 left, quotable6 left, coverable6 left, bisectable6 left, tellable6 left, shareable6 left, unicodable6 left, evalable6 left, statisfiable6 left, greppable6 joined 17:45 committable6 joined, bloatable6 joined, releasable6 joined, notable6 joined, unicodable6 joined, quotable6 joined, nativecallable6 joined 17:46 statisfiable6 joined, sourceable6 joined, bisectable6 joined, coverable6 joined 17:47 shareable6 joined, benchable6 joined, evalable6 joined, tellable6 joined, reportable6 joined, linkable6 joined 17:49 grondilu left 17:50 sena_kun left 17:52 sena_kun joined 17:56 Kaiepi left 17:57 Kaiepi joined 18:07 jaguart left 18:08 reportable6 left 18:09 reportable6 joined 18:18 Kaiepi left 18:19 Kaiepi joined 18:32 Guest032 joined 18:33 Guest032 left 18:36 spacekookie left 18:37 spacekookie joined 18:49 Sgeo joined, Sgeo left 18:50 Sgeo joined
japhb .tell grondilu When samuraisam and I worked on Protocol Buffer support, we used the MOP; you'll find it in several places in: github.com/samuraisam/p6-pb 19:13
tellable6 japhb, I'll pass your message to grondilu
19:17 jjido joined 20:09 sena_kun left 20:10 sena_kun joined 20:27 hankache joined 20:51 jjido left 21:02 hankache left 21:23 jjido joined 22:23 evalable6 left, linkable6 left, linkable6 joined 22:25 evalable6 joined 22:34 jjido left
ecocode___ hi. how should I define a Type "unit" which can be either of these Str "m", "m2", "m3" ? 22:40
gfldex m: enum Unit <m m1 m2>; my $str = 'm1'; say ::($str) ~~ Unit; 22:44
camelia True
gfldex You can use an enum for that, but a Set might be better.
m: enum Unit (<m m1 m2> Z=> <m m1 m2>); my $str = 'm1'; say $str ~~ Unit; sub foo(Unit() $u) { say $u }; foo('m2'); 22:51
camelia False
m2
gfldex m: enum Unit (<m m1 m2> Z=> <m m1 m2>); my $str = 'm1'; say $str ~~ Unit(); sub foo(Unit() $u) { say $u }; foo('m2'); 22:52
camelia True
m2
gfldex I didn't know that ~~ takes a coersion type. 22:53
ecocode___ how would you use a set instead ?
gfldex I shall query Roast and check for ENODOC tomorrow. 22:54
22:54 melezhik joined
melezhik . 22:54
gfldex m: constant Unit = Set(<m m2 m3>); say 'm2' ~~ Unit;
camelia False
gfldex m: constant Unit = Set(<m m2 m3>); say 'm2' ∈ Unit;
camelia True
ecocode___ sounds good 22:55
for my usage :)
is there an ascii alternative for ∈ ?
22:56 melezhik left
ecocode___ hmmm... Attribute definition of type Set (implicit : by pragma) needs to be marked as required or given an initializer 22:59
can't use the Set in "has Unit $.unit" in a class definition ? 23:00
it works with enum, but then without using strings 23:01
23:59 lichtkind left