šŸ¦‹ 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:03 deoac left 00:07 reportable6 left 00:09 reportable6 joined
Xliff tonyo: I was just hoping for a more direct method than" ::?CLASS.^attributes.grep( *.name eq $attribute-name )" is all. Thanks for the help. 00:09
m: class A { has $!x; has $!y; }; A.^attribute_table.gist.say 00:12
camelia {$!x => Mu $!x, $!y => Mu $!y}
Xliff :-O
Well color me plaid!]
00:13 habere-et-disper left
Xliff m: role AttributeAccess { method ATTRIBUTE { ::?CLASS.^attribute_table{ self.VAR.name }; }; multi sub trait_mod:<is> (Attribute \a, :$accessed) { a does AttributeAccess }; class A { has $!x; has $!y; method a { $!x.ATTRIBUTE.name.say }; }; A.new.a 00:21
camelia ===SORRY!=== Error while compiling <tmp>
Cannot declare our-scoped class inside of a role
(the scope inside of a role is generic, so there is no unambiguous
package to install the symbol in)
at <tmp>:1
------> sed) { a does Attributeā€¦
Xliff m: role AttributeAccess { method ATTRIBUTE { self.package.^attribute_table{ self.VAR.name }; }; multi sub trait_mod:<is> (Attribute \a, :$accessed) { a does AttributeAccess }; class A { has $!x; has $!y; method a { $!x.ATTRIBUTE.name.say }; }; A.new.a
camelia ===SORRY!=== Error while compiling <tmp>
Cannot declare our-scoped class inside of a role
(the scope inside of a role is generic, so there is no unambiguous
package to install the symbol in)
at <tmp>:1
------> sed) { a does Attributeā€¦
Xliff m: role AttributeAccess { method ATTRIBUTE { self }; multi sub trait_mod:<is> (Attribute \a, :$accessed) { a does AttributeAccess }; class A { has $!x; has $!y; method a { $!x.ATTRIBUTE.name.say }; }; A.new.a 00:22
camelia ===SORRY!=== Error while compiling <tmp>
Cannot declare our-scoped class inside of a role
(the scope inside of a role is generic, so there is no unambiguous
package to install the symbol in)
at <tmp>:1
------> sed) { a does Attributeā€¦
tonyo Attr table, nice find 00:23
Xliff Thanks! I think that will work. 00:26
Thanks again for the help, tonyo++
00:26 Kaiepi left
Xliff In the end, this is what worked... 00:27
m: class A { has $!x; has $!y; method a { self.^attribute_table{ $!x.VAR.name }.gist.say }; }; A.new.a
camelia Mu $!x
Xliff tonyo: You mentioned a use case. Well, in some of my code, I have postdeclared comments on attributes that serve as annotations. Such things I can use at runtime. 00:28
So direct access to the Attribute (not its value) is preferred. This solves that problem.
tonyo Ahh v nice
00:29 Kaiepi joined 00:47 Guest56 joined 01:43 derpydoo left 01:44 Maylay left 01:46 Maylay joined 01:56 Kaiepi left 01:58 Maylay left 02:01 razetime joined 02:03 jjido left 02:04 frost joined 02:18 Xliff left 02:28 Maylay joined 03:03 frost left 03:05 frost joined 03:12 squashable6 left 03:13 squashable6 joined 03:46 razetime left 03:51 bigdata joined 04:32 razetime joined 04:35 Maylay left 04:41 Maylay joined 04:56 Xliff joined
Xliff \o 04:56
Is there a way to have a role enforce a class inheritance? 04:57
05:11 bigdata left 05:50 frost left 05:59 Guest56 left 06:02 razetime left 06:03 razetime joined 06:07 reportable6 left 06:10 reportable6 joined 06:12 razetime left, razetime joined
moritz a role can apply a class inheritance 06:13
07:12 linkable6 left, evalable6 left 07:13 evalable6 joined 07:15 linkable6 joined 07:26 Kaiepi joined 07:34 Kaiepi left 07:39 razetime left, razetime_ joined 07:41 jjido joined 07:45 razetime_ is now known as razetime, razetime left, razetime joined 07:46 habere-et-disper joined 07:48 Kaiepi joined 07:53 Maylay left 07:57 Maylay joined 08:08 frost joined 08:11 abraxxa joined 08:15 abraxxa left 08:16 abraxxa joined, Maylay left 08:18 razetime left 08:19 frost left 08:24 frost joined 08:28 Maylay joined 08:50 squashable6 left 08:53 squashable6 joined 08:56 jjido left 09:03 Sgeo left 09:12 kaskal left, dakkar joined, kaskal joined 09:23 japhb left 09:24 japhb joined 09:31 japhb left, codesections left 09:36 japhb joined 09:37 japhb joined 09:41 sena_kun joined 10:13 Maylay left 10:32 Maylay joined 10:45 rcmlz joined, rcmlz left 10:54 frost left 11:30 frost joined 11:39 sena_kun left 11:42 sena_kun joined 11:48 habere-et-disper left 12:07 reportable6 left 12:09 reportable6 joined
Geth ecosystem/main: 3d408a6d55 | L'AlabameƱu++ (committed using GitHub Web editor) | META.list
Intl::CLDR is now on zef/fez
12:09
12:14 Maylay left 12:17 Maylay joined 12:19 frost left
tbrowder hi, need some help about module organization for a class and a separate file for a r 13:05
*set of subroutines for use by it and other progs 13:06
call the class Bar in dir lib/Foo 13:07
call the file of subs lib/Foo/Subs.rakumod 13:08
i want to call a sub in Subs from class Foo::Bar 13:09
no reply yet, please, i need to check some more...i'm getting circular call errors but i haven't given just yet. 13:13
13:22 mahafyi joined
ugexe do you know what a circular reference is? 13:25
if you have Foo.rakumod and Foo/Subs.rakumod and each one of those files uses the other file, its a circular reference 13:26
because when you load Foo it then goes to load Foo::Subs, which then needs to load Foo which needs to load Foo::Subs, and so on 13:27
it sounds like you need to move code in Foo::Subs (the code that depends on Foo in such a way you need a `use Foo` in Foo/Subs.rakumod) to a third module 13:28
or put that logic inside of Foo::Subs in such a way that it doesnt need `use Foo`
13:59 codesections joined 14:38 ProperNoun left 14:39 ProperNoun joined
[Coke] if we don't have that in one of the tutorials on the doc site, someone please open a ticket for it. 14:39
(avoiding circular dependencies)
Anton Antonov @Coke In case you did not get the message -- you have issues. 14:40
[Coke] I didn't see that, no. 14:44
14:49 mahafyi left
[Coke] Thanks. this should a small lift, will try to get to it in the next few days 14:51
15:02 codesections left 15:04 codesections joined 15:20 Sgeo joined
Anton Antonov @Coke Sounds good. 15:27
El_Che does [Coke] have issues? www.youtube.com/watch?v=SAxPLSvvbXY 15:29
15:33 razetime joined
tbrowder ugexe: yes, i got it fixed, thnx 15:43
Anton Antonov @El_Che Thanks! 15:48
All the chapters of my PhD thesis start with epigraphs that are quotes from "The Offspring" songs. 15:49
nine Anton Antonov: that's epic :)
El_Che Anton: as everyone's should! 15:50
Nemokosch not sure if it's possible to forgive them for that awful Obladi Oblada parody... but anyway, that's not what I wanted to say 16:11
do we have something like Text::Extract::Word in Perl, or is it up to the new generation?
"the new generation" that hopefully won't need much of .doc files but unfortunately I do
16:15 atweedie joined 16:22 razetime left 16:23 razetime joined 16:51 codesections left, codesections joined 17:07 codesections left, derpydoo joined 17:08 codesections joined 17:10 derpydoo left 17:20 razetime left 17:32 dakkar left 17:44 codesections left 17:45 codesections joined 17:50 abraxxa left 17:58 derpydoo joined 18:02 mahafyi joined 18:07 reportable6 left 18:08 reportable6 joined 18:25 Guest78 joined 18:37 perlbot left 18:40 perlbot joined 18:43 sena_kun left, jjido joined 18:46 sena_kun joined 19:46 linkable6 left, nativecallable6 left, quotable6 left, squashable6 left, notable6 left, evalable6 left, shareable6 left, sourceable6 left, releasable6 left, bloatable6 left, benchable6 left, unicodable6 left, bisectable6 left, coverable6 left, tellable6 left, committable6 left, statisfiable6 left, greppable6 left, reportable6 left, unicodable6 joined, greppable6 joined, notable6 joined, bloatable6 joined 19:47 tellable6 joined, releasable6 joined, reportable6 joined, shareable6 joined, quotable6 joined, squashable6 joined, statisfiable6 joined 19:48 sourceable6 joined, nativecallable6 joined, committable6 joined, bisectable6 joined, linkable6 joined, coverable6 joined 19:49 evalable6 joined, benchable6 joined 19:54 tirnanog joined 20:06 codesections left 20:08 codesections joined 20:25 ToddAndMargo joined, ToddAndMargo left, ToddAndMargo joined
ToddAndMargo I have created a class andĀ  a variable of that class.Ā  I have been using "push" to create an array of that variable.Ā  Problem: all of the lines inside the array (about 20 of them)Ā  are all the last line I pushed into the array,Ā  Am I doing something wrong?Ā Ā  The offending line is 84: "push @Tasks, $TaskLine;" 20:31
vpaste.net/iI8EM#uploads
lizmat could you create a gist with line numbers ? 20:33
ToddAndMargo Windows 11; raku -v 20:34
Welcome to RakudoĪ“Ć¤Ć³ v2022.07.
Implementing the Rakuā”¬Ā« Programming Language v6.d.
Built on MoarVM version 2022.07.
lizmat looks like you're only creating a single $TaskLine object
and updating that in each iteration and pushing that 20:35
instead of creating a new TaskLine object each iteration
ToddAndMargo It is that last line repeated over and over 20:36
Xliff ToddAndMargo, under "for $RtnStr.lines[ 3..*-1 ] -> $Line {" 20:37
You need a "$TaskLine = TaskLine.new"
Rather ... "$TaskLine = TaskLineClass.new" 20:38
You can turn the "my $TaskLine = TaskLineClass.new" above that into just "my $TaskLine" 20:39
ToddAndMargo I though I was just reusing line 51 "my $TaskLineĀ Ā Ā Ā  = TaskLineClass.new;"
Xliff Nope.
Well... yes. You are.
That's why you are getting the repeats. 20:40
'You are using the same object. Not a new one.
So when you go to print the list in the next loop, they are all the same.
It's pretty much as lizmat++ said.
ToddAndMargo Fixed! Thank you! 20:42
Ā Ā  for $RtnStr.lines[ 3..*-1 ] -> $LineĀ  { 20:43
Ā Ā Ā Ā Ā  # print "$Line\n";
Ā Ā Ā Ā Ā  my $TaskLine = TaskLineClass.new;
Ā Ā Ā Ā Ā  $TaskLine.ImageNameĀ Ā Ā Ā  = $Line.substr(Ā  0..24 ).trim;
Ā Ā Ā Ā Ā  $TaskLine.PIDĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā  = $Line.substr( 26..33 ).trim.Int;
Ā Ā Ā Ā Ā  $TaskLine.SessionNameĀ Ā  = $Line.substr( 35..50 ).trim;
Ā Ā Ā Ā Ā  $TaskLine.SessionNumber = $Line.substr( 52..62 ).trim.Int;
Ā Ā Ā Ā Ā  $TaskLine.MemUsageĀ Ā Ā Ā Ā  = $Line.substr( 64..75 ).trim;
Ā Ā Ā Ā Ā  push @Tasks, $TaskLine;
Xliff yw - And try to minimize posting code like that in IRC>
I speak from experience! You get yelled at!
Particularly if you bother camelia. 20:44
Xliff flees
ToddAndMargo oops!
lizmat also: if you want to ensure types and values, you'd probably be better of in a TWEAK method doing all of the cleanup
*off
ToddAndMargo Soon as I learned Raku's OOP, I dropped hashes.Ā  OOP is just to powerful and easy to read 20:50
Xliff ToddAndMargo: Yes. However hashes still have their place. ;)
20:52 codesections left, codesections joined
ToddAndMargo One of the endearing things I find with Raku is that there are 1001 ways to do everything! 20:54
20:59 ToddAndMargo left
Xliff Is a once {} block guaranteed to run only once per execution? 21:00
21:00 codesections left
Xliff m: sub a { once { say "Boo!" }; say "You" }; a;a;a;a 21:00
camelia Boo!
You
You
You
You
21:01 codesections joined
lizmat once, like state, suffers from a race condition, but other than that: yes 21:01
21:17 sena_kun left 21:18 sena_kun joined 21:26 Maylay left, Maylay joined
Xliff m: class A { method A { say "A"; }; method a { say "a" }; }; A.a; A.A 21:30
camelia a
A
Xliff Oh god bless Raku for case sensitive method names!
21:32 Maylay left
lizmat although, you could actually make method lookup case-insensitive if you really wanted :-) 21:33
by replacing the ^find_method method in the meta-class :-)
21:34 Maylay joined
Xliff lizmat: Yes, I do realize that. I'm good. Thanks! ;) 21:40
lizmat hehe 21:41
Xliff Case sensitivity solves a significant design issue in my code.
So I'm happy about it.
21:42 ToddAndMargo joined
ToddAndMargo Is tehere a sysem variable that will tell me "raku,exe"?Ā  (rakuw,rakudi, etc.) 21:42
rakudo
lizmat m: say $*EXECUTABLE # ToddAndMargo 21:43
camelia "/home/camelia/rakudo-m-inst-1/bin/rakudo-m".IO
ToddAndMargo >raku -e "say $*EXECUTABLE" 21:45
"C:\Program Files\Rakudo\bin\raku.exe".IOaPerfect!Ā  TH
Thank yoU!
Geth advent: 80bfebb402 | (Tom Browder)++ (committed using GitHub Web editor) | raku-advent-2022/artlicles/tbrowder
Create tbrowder
21:49
lizmat tbrowder++ 21:50
Geth advent: 729a7cd8a4 | (Tom Browder)++ (committed using GitHub Web editor) | raku-advent-2022/artlicles/tbrowder
Delete raku-advent-2022/artlicles directory
21:51
advent: e312cf397a | (Tom Browder)++ (committed using GitHub Web editor) | raku-advent-2022/articles/tbrowder.md
Create tbrowder.md
21:52
advent: c29a13bae7 | (Tom Browder)++ (committed using GitHub Web editor) | raku-advent-2022/articles/tbrowder.md
Update tbrowder.md
21:54
22:21 codesections left 22:23 codesections joined, codesections left 22:24 codesections joined, codesections left 22:25 codesections joined 22:28 codesections left, codesections joined 22:29 Xliff left, jmcgnh left 22:31 ToddAndMargo left 22:48 bigfondue left 23:03 sena_kun left 23:08 epony joined 23:10 jmcgnh joined
Geth advent: 29f6698007 | (Tom Browder)++ (committed using GitHub Web editor) | raku-advent-2022/articles/tbrowder.md
Update tbrowder.md
23:11
advent: 5e5812e223 | (Tom Browder)++ (committed using GitHub Web editor) | raku-advent-2022/authors.md
Update authors.md
23:12
23:15 derpydoo left 23:18 codesections left 23:19 codesections joined
Geth advent: 693eee6ed4 | (Tom Browder)++ (committed using GitHub Web editor) | raku-advent-2022/articles/tbrowder.md
Update tbrowder.md
23:22
advent: efe5c7d7b9 | (Tom Browder)++ (committed using GitHub Web editor) | raku-advent-2022/articles/tbrowder.md
Update tbrowder.md
23:25
23:34 codesections left
Geth advent: 01b97af6cc | (Tom Browder)++ (committed using GitHub Web editor) | raku-advent-2022/articles/tbrowder.md
Update tbrowder.md
23:35
23:35 codesections joined
Geth advent: tbrowder++ created pull request #97:
add draft article
23:50
advent: 7c86520f0b | (Tom Browder)++ | raku-advent-2022/articles/tbrowder.md
add draft article
23:51
advent: e38b05938b | (Tom Browder)++ (committed using GitHub Web editor) | raku-advent-2022/articles/tbrowder.md
Merge pull request #97 from tbrowder/tbrowder

add draft article
23:53 codesections left 23:54 codesections joined, codesections left 23:55 codesections joined 23:56 codesections left 23:57 codesections joined, codesections left