🦋 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: ... | Logs can be inspected at colabti.org/irclogger/irclogger_log/raku
Set by lizmat on 1 May 2021.
whatnext hello all:)  I have a question about the mi6 tool 08:07
japhb Is there an idiom for an idle/default task within a react block? Meaning that I want all other `whenever` blocks to have priority, but if the react loop has no other `whenever` triggering, I want it to run my default block. Hopefully that makes sense ... 08:08
whatnext I am trying to run `mi6 release` and I get the error `Step 2 CheckOrigin: You should set git remote first`
my question is, set it to what? and how to do that?
japhb The actual use case is an action game main loop that wants to render a new frame whenever it is *not* currently processing user input, network messages, etc., but very importantly *not if it is already rendering a frame*, and without setting a fixed frame rate with e.g. Supply.interval. 08:09
japhb whatnext: If you run `git remote -v` what does it say? 08:10
whatnext22 @japhb sorry my connection dropped out - now apparently I am whatnext22:)  If I run `git remote -v` nothing happens - I haven't initialised a git repo at all as I wasn't aware this needed to be done. Maybe there are docs somewhere that I am missing? 08:14
lizmat ah, good point
I guess mi6 could do the "git init" for you
but you'd need to add a repo somewhere on a place like github to make it work for you 08:15
japhb Oh I see. Yeah, if you had created the project with `mi6 new Module::Name`, then among other things it initializes it as a git repo, with all the template files waiting in the index for your first commit. 08:15
lizmat ah, yes, of course, it does :-)
when you create a new repo on github, it will tell you what to do to link your local repo to the remote on Github 08:16
japhb But for release you still need to do as lizmat mentions and create an upstream somewhere, e.g. GitHub, and set your git remote there
Right, lizmat++
lizmat and also, you'd need a login on PAUSE as well
I don't think mi6 support uploading to the zef ecosystem yet, does it? japhb ? 08:17
japhb Until mi6 support for fez is merged ... :-)
lizmat right
whatnext Ah really. I did create it using `mi6 new Module::Name` - also I do have a PAUSE login
japhb Not that I know of, no.
OK, if you do `git status` in that directory, you should see all the files waiting to be committed 08:18
whatnext I see it is indeed a git repo - but `git remote -v` doesn't return anything
japhb whatnext: It won't until you have somewhere to push to. 08:18
whatnext I guess that is my question - what do I need to set it to? 08:18
japhb Basically mi6 doesn't want you to release something that people can't fork
Do you have a github account? 08:19
whatnext ok I see - so I need to put the project on github
got it
I was thinking it wanted some kind of remote on cpan
japhb (It doesn't have to be GitHub in particular, that's just the most common choice of Rakoons so far.)
Nope. :-)
whatnext ok thanks - I'll try that :) 08:20
japhb Good luck! Let us know if you have any other questions. :-) 08:20
whatnext thanks :)
japhb Speaking of which, anyone currently on have any ideas for my question of a default task within a react block?
PimDaniel \o 08:34
Is there a workarround for this: Circular module loading detected trying to precompile /home/moi/raku/trylib/CharCons.rakumod ? 08:35
I get a Line Class made of Point(s) (class) but class Point is into another module for some reasons. And the problem is that point MUST refer to Line also. so Point Class need to import the module where Line class is defined. This is a wellknown problem. 08:38
The simpler solution would be to put Points into the same module tha Line is but i shared it because of the size and other tricks. 08:40
So i just ask in the case it would exist a simple solution to resolve this. I red this was considered like a bug. I do not pretend it is still. 08:41
lizmat PimDaniel: are you aware of stubbing ? 08:43
PimDaniel lizmat: hello! No , i'm not aware! Sorry! 08:44
lizmat m: class A { ... }; class B is A { method foo() { dd } }; class A { method bar() { dd } }; B.foo; B.bar
camelia 5===SORRY!5=== Error while compiling <tmp>
'B' cannot inherit from 'A' because 'A' isn't composed yet (maybe it is stubbed)
at <tmp>:1
lizmat hmmm
m: class A { ... }; class B { method foo() { A.bar } }; class A { method bar() { dd } }; B.foo 08:45
camelia method bar(A: *%_)
lizmat that's more what you need, no
?
PimDaniel lizmat Thank you : i must understand... i'm not fast, sorry. 08:48
lizmat: You declared 2 times class A {} how can this work? 08:54
lizmat the first time I stubbed it
that's the meaning of the ... inside the body of the class 08:55
it tells the compiler: there's going to be a class A defined, but not now
it allows you to refer to the class, without it actually have been built yet
not that in class B in my example, method foo calls method bar in class A 08:56
*before* that method is actually defined
because method calling is late bound (aka the lookup for the method happens at runtime)
this can work
PimDaniel lizmat ok ok so i need to go further to well understand and to see how implement this in my code. 08:57
lizmat I'm not sure it is the solution to your problem, but it may help you figure out a way to do what you want :-) 08:58
PimDaniel lizmat in my case : i've class A and B in =! Modules and B is a composition of A let's say A is Point(s) : B is Line, but i do not know the side you chose so it may be the oposite. I must to check this more to understand and i'll come back if i struggle. Thank you very mutch! 09:01
lizmat you're welcome! 09:02
lizmat clickbaits rakudoweekly.blog/2021/05/10/2021-...-beta-pod/ 09:03
Altreus clicks 09:12
curses! baited!
lizmat :)
PimDaniel lizmat: I'm unable to say if your answer replies to my problem at this step. My problem should be tested with true files and modules not foo/bar into a simple inline. Foo/Bar means nothing for me even if wee see it everywhere it does not correspond to any reality: In real live you sometimes and may be often have classes that have relations between them eg : Point and Line one is a composition of the other. 09:33
lizmat so the file with Line, does a "use Point" ? 09:35
and you also want to do a "use Line" in the file that has Point ?
PimDaniel I should probably make a paste to explicit my need more. 09:36
lizmat yes, and please as short as possible :-)
whatnext hello again:)  I am still working on `mi6 release` - now I am down to `Step 8. UploadToCPAN` which is progress
lizmat if anything, it will help your own thoughts get straight
whatnext: you probably need a ~/.pause file with your PAUSE credentials ? 09:37
PimDaniel lizmat of course a reduced representation but it's not a problem.
whatnext however, I am getting `401 Unauthorized` - I have the user/password in a `.pause` file in my home dir and have logged in manually to PAUSE using the same to make sure they are correct - but still I have the error 09:38
lizmat - thanks yes I have done that already, but I still get the 401 09:39
moritz Hi all. I'm not updating the perl6-all-modules repository anymore, because it requires too much maintenance. If anybody wants to take over, please tell me soon; otherwise I'll delete that repo 09:40
lizmat moritz: link? 09:41
lizmat wow, whatnext is moving up the ranks quickly :-) 09:44
whatnext74 sorry I have  a crappy connection here :/ 09:45
lizmat whatnext74: I can only say: verify what's in .pause *again* 09:46
copy paste what's in there when trying to log in manually
PimDaniel lizmat YESS The file with line does a use Screen Module which contains Point class and just anothe one. The problem is that class Point MUST refer to Line : a kind of indexation to refer which lines a point belongs too for example, then Screen Module MUST import CharCons module where Class Line is defined and it is a circular import because CharCons yet imports Screen where Point class is defined. I
lizmat the mind can play tricks on you that access checking will catch
PimDaniel know and see, you are busy. No hurry! worry! Thank's.
whatnext lizmat thanks - yes I did that already, but same result - I was wondering at the error message, because it states the url as ` pause.perl.org/pause/authenquery?A...N=add_uri` - in the code it looks like it attempts to substitute `//` for `//{$.user}:{$.password}@` but it doesn't look like this is successful for some reason 09:53
lizmat on what OS are you ?
moritz lizmat: github.com/moritz/perl6-all-modules
whatnext CentOS 7.9 09:54
lizmat whatnext: sorry, out of ideas then 09:55
moritz: was "git grep" capability the only thing you were after ? 09:56
or was there some other functionality that would benefit from such a repo ?
whatnext lizmat ok no worries thanks anyway - if I manage to figure it out I'll post an update 09:58
lizmat ++whatnext
MasterDuke greppable6 uses that repo 09:59
lizmat ah, I see 10:03
moritz: so what is the maint work that needs to be done
?
moritz lizmat: yes, git grep was the purpose. The maintenance is getting the update script working when it's not, and running it regularly 10:10
lizmat what are typical failure modes? 10:11
lizmat moritz: or is that the issue: not typical failure modes :-) 10:19
Altreus Who comes up with the weekly challenges? 10:23
lizmat Mohammad S Anwar and their team? 10:25
whatnext wow this connection is really driving me crazy today X) 10:31
whatnext20 I am not sure if my last message got through, so I'll try again - I did figure out the mi6 issue in the end. It looks like the `upload` routine in `mi6` sends the url as `//{user}:{password}@` but doesnt url safe special chars in the password. If I replace special chars in the password with the `%...` equivalent it works 10:35
tadzik ha, good one. Should be easy to fix
whatnext20 ill write up a bug report this afternoon - giving up with IRC chat right now :') 10:36
raydiak .tell PimDaniel docs.raku.org/language/faq#Can_I_h...n_modules? 10:37
tellable6 raydiak, I'll pass your message to PimDaniel
raydiak .tell PimDaniel basically, you have to reorganize your classes/roles to eliminate the circularity, or else put them both in the same file and stub the second one before using it in the first one 10:37
tellable6 raydiak, I'll pass your message to PimDaniel
lizmat raydiak++ 10:40
raydiak knew I'd read that somewhere before, just took me forever to find it 10:41
Altreus I ask because they always seem to find something that is simple and complex at the same time
I wonder how they come up with so many!
moritz lizmat: typical failure mode: an error message. Typical response: try again. If the error shows up again: debug. 11:00
lizmat moritz: ack 11:01
canbenshanlo hey, everyone! is there a way to avoid the .Array and collect right into -> @perm? 11:32
m: (1..3).permutations.map(-> $perm { $perm.Array.push($perm.head) })
camelia ( no output )
canbenshanlo m: say (1..3).permutations.map(-> $perm { $perm.Array.push($perm.head) })
camelia ([1 2 3 1] [1 3 2 1] [2 1 3 2] [2 3 1 2] [3 1 2 3] [3 2 1 3])
thundergnat80 Altreus: Many of the challenge tasks seem to be lifted straight from rosettacode.org . At least, there are _very_ similar tasks on rosettacode. Raku (and Perl!) are pretty well represented on there, but could always use more task solutions. rosettacode.org/wiki/Reports:Tasks_...ed_in_Raku 11:33
canbenshanlo the most obvious thing didn't work when using -> @perm: Cannot call 'push' on an immutable 'List'
thundergnat80 m: say (1..3).permutations.map({ [|$_, .head] }) 11:36
camelia ([1 2 3 1] [1 3 2 1] [2 1 3 2] [2 3 1 2] [3 1 2 3] [3 2 1 3])
CIAvash canbenshanlo: you need `-> @perm is copy` 11:38
canbenshanlo oh, slick, is copy does work indeed 11:40
thanks both of you!
CIAvash m: [++$] 11:43
camelia 5===SORRY!5=== Error while compiling <tmp>
Unsupported use of $] variable; in Raku please use $*RAKU.version or $*RAKU.compiler.version
at <tmp>:1
------> 3[++$]7⏏5<EOL>
CIAvash Is this a bug?
m: say [++$ ] 11:44
camelia [1]
moritz CIAvash: no 11:49
you auto-increment an anonymous variable, and that happens to be defined as incrementing it to 1, and returing it
CIAvash I mean the previous code without the space after `$`
moritz it's intended behavior, possibly not optimal 11:50
Altreus You'd think it just wouldn't try to find the $] variable really 14:12
I suppose there are a few hangovers from when it was Perl 6 and therefore tried to accommodate Perl 5 people
lizmat m: say $] 14:17
camelia 5===SORRY!5=== Error while compiling <tmp>
Unsupported use of $] variable; in Raku please use $*RAKU.version or $*RAKU.compiler.version
at <tmp>:1
------> 3say $]7⏏5<EOL>
lizmat m: no isms; say $]
camelia 5===SORRY!5=== Error while compiling <tmp>
Unsupported use of $] variable; in Raku please use $*RAKU.version or $*RAKU.compiler.version
at <tmp>:1
------> 3no isms; say $]7⏏5<EOL>
lizmat m: no isms <Perl>; say $] 14:18
camelia 5===SORRY!5=== Error while compiling <tmp>
Don't know how to handle: isms <Perl>
at <tmp>:1
------> 3no isms <Perl>7⏏5; say $]
lizmat m: no isms <perl>; say $]
camelia 5===SORRY!5=== Error while compiling <tmp>
Don't know how to handle: isms <perl>
at <tmp>:1
------> 3no isms <perl>7⏏5; say $]
lizmat m: no isms <perl5>; say $]
camelia 5===SORRY!5=== Error while compiling <tmp>
Don't know how to handle: isms <perl5>
at <tmp>:1
------> 3no isms <perl5>7⏏5; say $]
lizmat hmmm
m: no isms <Perl5>; say $]
camelia 5===SORRY!5=== Error while compiling <tmp>
Unsupported use of $] variable; in Raku please use $*RAKU.version or $*RAKU.compiler.version
at <tmp>:1
------> 3no isms <Perl5>; say $]7⏏5<EOL>
lizmat I guess it's not covered in that case
PimDaniel \o Hi again! 15:31
tellable6 2021-05-11T10:37:17Z #raku <raydiak> PimDaniel docs.raku.org/language/faq#Can_I_h...n_modules?
2021-05-11T10:37:39Z #raku <raydiak> PimDaniel basically, you have to reorganize your classes/roles to eliminate the circularity, or else put them both in the same file and stub the second one before using it in the first one
PimDaniel raydiak Thank you. I'll try to do it with role since i'm affraid the 1st solution will end up using one unique huge module. But i'm used to using roles and i'm affraid or side effects. 15:42
PimDaniel raydiak But i'm *NOT used to using roles 15:42
raydiak *of side effects. Décidément! 15:44
antononcube lizmat Hi! You suggested using Math::Libgsl::LinearAlgebra, but I have hard time installing it on Mac OS 11.3. Also, generally speaking, I consider the dependency with gsl to be a "too heavy" requirement. Should I assume that your suggestion means that Math::Matrix is not actively developed, and, hence I should figure out how to install 15:56
Math::Libgsl::LinearAlgebra on my Mac?
Altreus PimDaniel: Français?
PimDaniel Altreus OUI
Altreus salut :) j'apprends français les samedis 15:57
PimDaniel Altreus: bon courage!
Altreus Je peux essayer de traduire si tu voulais!
PimDaniel Altreus C'est gentil mais je pense que je ne m'en sort pas trop mal. 15:58
Altreus Mon problème n'est pas là pour l'instant. 15:59
Altreus :) 16:00
tonyo PimDaniel: you can probably also do circulars with `require`
PimDaniel To everybody: Is there a dedicated paste place for this Raku chat?
Altreus I have been using github gists 16:01
PimDaniel tonyo thank you for sure i think there is one : that is what i was wondering.
Okay so i'll use pastebin like i did yet. 16:02
tonyo gist or pastebin is what most use
Altreus I think I solved the circular issue by simply removing all mentions of the other class :D 16:03
In this project everything is done by a single object anyway so it wasn't a problem
antononcube @PimDaniel Try the Raku discord channel/server. 16:04
PimDaniel Right but before all may you look at the question here, and please read everything? pastebin.com/ruZbL7ya 16:05
Altreus That's here if you want discord.gg/gg2a3T6
PimDaniel Altreus ok that you for the link. 16:06
PimDaniel Altreus what is discord? I do not create accounts of a site of what i do not know what it is! 16:09
Altreus If you don't have Discord then you would probably not benefit from this link :)
it's just another chat medium
PimDaniel Okay, very intresting but i'll not do this now, plus : does discord work in irssi: Linux Ascii Native Console? I like trivial old fashion apps (for PC) because the are allways or quite are fast and they don't piss me off. 16:13
Altreus: Are there more users and activity on Discord than here? 16:15
Altreus no :D 16:16
to any of those 16:17
PimDaniel onyo do you have a solution to my need pastebin.com/ruZbL7ya with require? 16:19
tonyo do you have a solution to my need pastebin.com/ruZbL7ya with require?
I fill there are many solutions as a workaround for circular dependencies but i fear many of them would lead to anarchy. I need to keep my code clear and simple. 16:30
tonyo why do you need `Line @belong` in Point ? 16:31
PimDaniel: ^ 16:32
i don't see the use case for @belong in that example 16:33
PimDaniel I need to know which Line(s) a point belongs too.
Altreus it is possible to just put `has @belong` 16:35
PimDaniel tonyo I need to know which Line(s) a point belongs too. Is it shocking
Altreus This was my solution :D
tonyo just make it a generic
tonyo it is shocking to think that a point will only ever belong to a Line 16:36
tonyo what about later when four of them comprise a Rect ? 16:37
PimDaniel tonyo A Point may belong (Touch) one or more Lines
tonyo you wouldn't deduce that without knowing all of the lines to get points from in your example which makes @belongs a bit moot 16:38
PimDaniel Into a Rect: each corner Point refer to 2 Lines. What is the problem?
tonyo How do you know which Rect they belong to? 16:39
moritz if you store all four corners, you could have contradictory information 16:39
PimDaniel Into a crux it refers to 2 at 4 lines : but it depends how we consider Lines of course.
moritz also, many rectangle implementations assume that it's aligned in a certain way; that might only make sense if you have also access to rotations 16:40
tonyo you don't need to keep track of the lines a point belongs to, you already know all of the lines and therefore the points
Altreus You could also have class Corner { has Line $line1; has Line $line2; has Point $common } 16:41
tonyo what is the Point going to do with the parent info?
PimDaniel moritz I need to mention i work in rectilinear plan. I just have horizontal and vertical lines.
Altreus You idea is may be good. 16:42
Altreus I think you are better off modelling it as class Line { has Point $point1; has Point $point2 }
Now if you transform either Point you transform the Line
the Point doesn't need to know the Line
tonyo it really sounds like there isn't a use case for the Point itself knowing about Line 16:43
PimDaniel tonyo There is one case a point belongs to one an only one line. 16:44
Altreus But still 16:45
What does the Point do with the Line?
The best way to solve the problem is to not need the thing :D
PimDaniel tonyo The Other cases are yet done. with chained points .
Altreus but maybe you do my $point1 = Point.new(...); my $point2 = Point.new(...); my $point3 = Point.new(...); my $line1 = Line.new($point1, $point2); my $line2 = Line.new($point2, $point3); my $line3 = Line.new($point3, $point1); 16:47
tonyo here is how you'd do it with require gist.github.com/tony-o/34d0aa032a6...149d2d47d2
Altreus This is of course a triangle
But if you change any point, both lines change as a result
because they share the point
So instead of having both points know what lines they belong to, you simply ensure that those lines use the same point object
PimDaniel Altreus: there are no triangle in my system. Well not really! just rectangles. 16:48
tonyo then `use A; call-ba; => 42`
Altreus PimDaniel: yes but I didn't want to do *four* points! 16:49
tonyo still, possible and good idea shouldn't be conflated
Altreus PimDaniel: Anyway I think you can make it work without having Line @belong 16:50
Just two Points on Line
or more!
PimDaniel Altreus Yess, I agree. At first i'm not forced to type the Array and could link it as is. But i'll not be able to use Line method though. 16:51
tonyo yes you will 16:52
PimDaniel tonyo : so this could be the solution.
tonyo but in fact i agree that this use case is NOT clear. 16:53
tonyo m: class A { has @.belongs; }; class B { has $.a; submethod BUILD { $!a = A.new; $!a.belongs.push: self; }; method hi { "hi".say; }; }; B.new.a.belongs.first.hi; 16:54
camelia hi
tonyo the design needs more thought, it seems intentionally chicken and egg
PimDaniel tonyo it is a more general problem that i try to achieve in fact. 16:55
It is an algorithm problem.
which i asked here yet.
I've got puzzled rectangles and i want to fill them. 16:56
But where do i start? 16:57
When i look as a human i see rectangles imbricated, but by computing, i must loop on Points or Lines : i need and algorithm. 16:59
Altreus I think you don't need the array at all, that's my point 17:00
in fact I don't think you need Lines at all 17:01
a rectangle is four points
those contain the important stuff - the numbers
PimDaniel Please may you look at what i did here : github.com/Pim-tech/Orthogon
which was made with theses algorithms: stackoverflow.com/questions/591929...68#6634668 17:02
This is a welknowed problem. 17:03
*welknown
Altreus This is interesting but unfortunately it is more than I can digest at the moment 17:04
In fact it would appear to be the end of my day :D
PimDaniel Altreus i did not ask you to finish it tonight. I'm not your boss. 17:05
Altreus :D 17:06
hope you find a good answer soon :)
Altreus away
PimDaniel Altreus but it gives you a subject to dream of for your nights.
Altreus and tonyo : You don't need to undestand nothing of the last link: it is just to explicit the context. 17:08
But if you look at the Jean-Yves DANIEL question into this link : it is the ultime final step which i need to achieve: How to fill the drawned rectangles? 17:10
tonyo and Altreus: Thank You! Good Night! 17:11
andinus m: say "ping" 18:00
camelia ping
tonyo expected: "pong" 18:02
codesections m: sub f { 42 }; &f.CALL-ME; 23:21
camelia No such method 'CALL-ME' for invocant of type 'Sub'
in block <unit> at <tmp> line 1
codesections well, _that's_ a surprise to me
moon-child would love if somebody could explain that 23:55