🦋 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:01 reportable6 joined 00:50 bigdata left 00:59 whatnext joined
whatnext hello raku community :] 01:00
how can I set an attribute declared in the parent in the TWEAK of the child? 01:01
I get "Attribute $!id is not declared in class My::Class" 01:02
any thoughts? :] 01:03
01:20 Vyrus left, Vyrus joined 01:27 whatnext left
MasterDuke m: class A { has $.a }; class B is A { has $.b; multi method new($n) { self.bless(a => $n) } }; say B.new(4).a   # whatnext ^^^ it's not TWEAK, but would this accomplish what you're trying to do? 02:07
camelia 4
02:10 heartburn left 02:13 tea3po left, tea3po joined 02:50 teatwo joined 02:53 tea3po left 03:28 zara joined 03:42 shmup left 04:35 heartburn joined 05:23 Sgeo_ joined 05:26 Sgeo left 06:00 reportable6 left 06:02 reportable6 joined 06:23 zara left 06:42 Bocaneri joined, Bocaneri is now known as Guest5440 06:43 Sauvin left, Geth left 06:53 Guest5440 is now known as Sauvin 06:59 Sgeo_ left 07:11 abraxxa joined 07:31 sena_kun joined 07:53 Manifest0 joined 08:12 dakkar joined 08:34 Geth__ left, Geth joined 08:37 RakuIRCLogger left, RakuIRCLogger joined 08:40 Geth left, jpn joined 08:42 Geth joined 08:46 Geth left, Geth joined 08:47 whatnext joined 09:18 bigdata joined 09:22 sena_kun left 09:23 bigdata left 09:30 Geth left 09:31 Geth joined 09:32 Geth left, Geth joined 09:35 Geth left, Geth joined 09:37 Geth left, Geth joined 09:43 Geth left 09:48 Geth joined 09:52 Geth left, Geth joined 09:54 Geth left 09:57 Geth joined 10:57 linkable6 left, evalable6 left 10:58 evalable6 joined, linkable6 joined
lizmat sjn: did you find a solution ? 11:56
11:58 linkable6 left, evalable6 left 12:00 reportable6 left, linkable6 joined 12:01 evalable6 joined, reportable6 joined 12:06 jaguart joined
Anton Antonov I am trying to get someone to install and use Raku, but they get messages about "psunzip" not being available, etc. 12:26
whatnext hi all :] re-asking my question from earlier: 12:27
Anton Antonov Do you / did you have Raku installation problems like that? I pointed them to : github.com/ugexe/zef/issues/341#is...-611459217 . Does the advise there work?
whatnext how can I set an attribute declared in the parent in the TWEAK of the child?
I get "Attribute $!id is not declared in class My::Class" ...? 12:28
lizmat m: class A { has $.a is rw }; class B is A { method TWEAK { self.a = 42 } }; dd B.new.a 12:34
camelia Int $!a = 42
lizmat whatnext ^^
whatnext thanks lizmat - that looks like the way I'd expect it to work. Not sure why I'm getting an error though. If $.a is not rw and I set $!a that also should work? And would it make a difference if "required" ? I am trying to figure what might be causing that error 12:40
lizmat the attribute *must* be marked as "is rw", otherwise it won't work
whatnext ah really
that explains it then
lizmat well, there are other ways... 12:41
whatnext for example?
Nemokosch $!a is like object private
lizmat but if the class has indicated that the attribute is not to be changed from outside, you should probably respect that
whatnext yes... but I figured the child would still have access
lizmat access is ok
whatnext but cannot set? 12:42
lizmat m: class A { has $.a = 42 }; class B is A { }; dd B.new.a
camelia 42
Nemokosch to $!a ? it probably won't
whatnext yes I guess I meant that in the TWEAK of the child, $!a declared in the parent cannot be set - is this correct? 12:44
lizmat not unless the parent allows it
whatnext the parent allows it by marking it "rw" ? 12:45
Nemokosch $.foo stuff is essentially a method, and these methods can be marked "is rw". From what I know, the actual data with the ! is always object private; basically there is no syntax to access it in a high-level way 12:47
whatnext haha great bot :] 12:48
lizmat well, there is, but it's butt ugly, using introspection
m: class A { has $.a }; class B is A { method TWEAK { self.^mro[1].^attributes.first(*.name eq q/$!a/).set_value(self,42) } }; say B.new.a
camelia 42
whatnext ok that looks complicated '=D 12:50
I think the "rw" solution will work - thanks lizmat
12:57 jgaz joined 13:07 jaguart left 14:07 squashable6 left, evalable6 left, nativecallable6 left, reportable6 left, benchable6 left, coverable6 left, notable6 left, statisfiable6 left, bisectable6 left, tellable6 left, shareable6 left, releasable6 left, linkable6 left, quotable6 left, unicodable6 left, bloatable6 left, sourceable6 left, committable6 left, greppable6 left, bloatable6 joined, evalable6 joined 14:08 statisfiable6 joined, quotable6 joined, sourceable6 joined, shareable6 joined, unicodable6 joined, coverable6 joined, greppable6 joined, nativecallable6 joined 14:09 notable6 joined, tellable6 joined, linkable6 joined, reportable6 joined 14:10 releasable6 joined, squashable6 joined, bisectable6 joined, benchable6 joined, committable6 joined 14:13 Geth left, Geth joined, teatwo left 14:14 teatwo joined, rf joined
rf Morning folks 14:14
lizmat rf o/
rf How are things today lizmat? 14:17
lizmat interesting and a bit exciting: trying to re-implement pod parsing as a true slang 14:18
rf Oooh sounds like fun!
Best of luck :D
lizmat well, the fun comes when it works, so far it is mostly torture :-)
rf :P 14:19
14:46 Sgeo joined
Anton Antonov @rf Please, take a look here: resources.wolframcloud.com/PacletR...nadMakers/ 14:55
I used "⟹" in monadic pipelines before I discovered Raku. I like Raku's forward feed operator, "==>". 14:56
(And the backward one too..)
15:08 zara joined 15:11 El_Che left 15:12 El_Che joined 15:13 TieUpYourCamel left
ugexe Anton Antonov: that error message means they have no program that can extract whatever archive the distribution is. if its from fez then they don't have a program that can extract a tar file in their PATH, if its a zip file they don't have 'unzip' or 'powershell' in their PATH, etc 15:16
15:18 rf left 15:35 rf joined
Anton Antonov @ugexe Thanks! So, the correct paths of "unzip" and "powershell" have to be specified. 15:39
ugexe er, not exactly i was simplifying it to unixy terms 15:40
to be more precise, they need either a `unzip` or `powershell` command to be available 15:41
they might not exist in $PATH, but on a unixy system that is what that usually means
im guessing they need the tar command
Anton Antonov @ugexe 🙂 thank you. I know they had unzip when we talked.
ugexe modern windows 10 comes with one i think 15:42
Anton Antonov Ok
I should try to make a Windows 10 virtual environment in some cloud service. 15:43
ugexe devblogs.microsoft.com/commandline...o-windows/
Anton Antonov Thanks again1 15:44
15:56 whatnext left 16:11 bigdata joined 16:17 jpn left
rf @Anton very nice 16:33
16:36 dakkar left 16:42 Bocaneri joined 16:43 Bocaneri is now known as Guest6979
Anton Antonov @rf Thanks, you are kind, 16:43
16:45 Bocaneri joined, Sauvin left, Bocaneri is now known as Guest476 16:46 Guest476 is now known as Sauvin 16:48 Guest6979 left 16:51 jaguart joined 16:56 jaguart left 16:57 abraxxa left 16:59 TieUpYourCamel joined 17:09 ab5tract joined 17:15 zara left 17:17 Bocaneri joined, jpn joined, Bocaneri is now known as Guest1957, Guest1957 is now known as Epicycloid 17:19 Sauvin left 17:30 ab5tract left 17:40 jpn left 17:52 sena_kun joined 18:00 reportable6 left 18:02 reportable6 joined 18:04 zara joined 18:07 zara left 18:15 codesections joined 18:36 bigdata left 18:43 jpn joined 18:49 jpn left
rf Where exactly is the docs for declaring types for sub-routines as parameters 18:56
m: sub foo((foo -> bar):D &f) { &f() } 18:57
camelia ===SORRY!=== Error while compiling <tmp>
Invalid typename 'foo' in parameter declaration.
at <tmp>:1
------> sub foo((foo⏏ -> bar):D &f) { &f() }
rf kind of thing ^
Voldenet rf: docs.raku.org/language/signatures.html 19:03
rf Thanks!
Is there any way to have generics in a sub-routine?
Voldenet see type captures 19:06
m: sub foo(::T $x) { sub (T $bar) { $x + $bar } }; foo(1)(2).say; 19:07
camelia 3
Voldenet m: sub foo(T) { sub (T $foo) { sub (T $bar) { $foo + $bar } } }; foo(Int)(1)(2).say;
camelia ===SORRY!=== Error while compiling <tmp>
Invalid typename 'T' in parameter declaration.
at <tmp>:1
------> sub foo(T⏏) { sub (T $foo) { sub (T $bar) { $foo +
Voldenet m: sub foo(::T) { sub (T $foo) { sub (T $bar) { $foo + $bar } } }; foo(Int)(1)(2).say; 19:08
camelia 3
rf Perfect thanks! 19:13
19:15 Bocaneri joined, Bocaneri is now known as Sauvin 19:18 Epicycloid left 19:38 jpn joined 19:55 jpn left 20:43 vrurg left 20:48 vrurg joined 21:02 sena_kun left 21:15 jpn joined 21:21 jpn left 21:31 jgaz left 21:34 eroux left 21:44 eroux joined 22:44 coverable6 left, releasable6 left, committable6 left, notable6 left, greppable6 left, sourceable6 left, tellable6 left, linkable6 left, benchable6 left, reportable6 left, squashable6 left, nativecallable6 left, quotable6 left, shareable6 left, statisfiable6 left, evalable6 left, bloatable6 left, unicodable6 left 22:45 greppable6 joined, bloatable6 joined, sourceable6 joined, coverable6 joined, notable6 joined, releasable6 joined, statisfiable6 joined, reportable6 joined, shareable6 joined 22:46 quotable6 joined, squashable6 joined, linkable6 joined, tellable6 joined, evalable6 joined, nativecallable6 joined 22:47 unicodable6 joined, benchable6 joined, committable6 joined 23:03 jpn joined 23:08 jpn left 23:21 TieUpYourCamel left 23:22 Manifest0 left 23:26 aMc joined, aMc left
Nemokosch can a user define "thunky operators"? 23:33
23:46 heartburn left 23:54 heartburn joined 23:58 deoac joined
deoac What is the meaning of `:10[6,1,3]` 23:58
is it simply shorthand for `[6,1,3].join.Int.base(10)` 23:59