🦋 Welcome to Raku! raku.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: colabti.org/irclogger/irclogger_log/raku
Set by ChanServ on 14 October 2019.
sampersand hi all! 01:08
should i be using `is pure` for functions that call other things that may not be pure? eg something like this:  `method add(Value $rhs --> Number) { Number.new: $!data + $rhs }` — the `$rhs.Int` method may not be pure, but if it is, my function is pure 01:09
sampersand also, how should i be creating objects? with positional parameters or keyword  parameters? 01:11
elcaro As far as I'm aware, the only thing `is pure` does is allow calls to that function to be constant folded if the value is known (eg. with Literals) 01:15
sampersand so i may as well use it in this case? 01:16
elcaro eg. sub square($n) is pure { $n ** 2 }; my $x = square(2); # <- since 2 is known at compile time, it may be constant folded
so you "can" use it on impure subs, but I don't know why you would. 01:17
sampersand ah ok
elcaro re: objects, by default, you create them with named args, tho you can create a `multi new` that accepts positional args
sampersand what's more idiomatic? 01:18
elcaro wellll... given Raku is related to Perl, the general sentiment is TIMTOWTDI (there is more than one way to do it) 01:19
sampersand sure, but TIMTOWTDIBSCINABTE
elcaro so do what you like! but... named args are the default for a reason... they are typically more readable, particularly with multiple args 01:20
timotimo äp5
elcaro if your class instatiation only takes one arg... I'd call that a good candidate to make it also accept a positional arg
sampersand cool ok 01:20
i dont really understand how `new` and `BUILD` relate, and why `has $!foo; sub new($f) { self.bless :$foo }` doesn't work 01:21
elcaro if you don't want to write a multi new... I experimented with a Role that does it for you, thought it's not available on the ecosystem
0racle.info/articles/everyone_loves_porgs
If Porgs was a module, you would just `use Porgs; class Foo does Porgs { ... }` 01:22
sampersand yeah. the fact that `...` is an actual thing (for stubbing out classes) tripped me up before lol 01:23
elcaro I never published Porgs... but feel free to steal it, rename it, publish, and claim it as your own... i'm not fussed
sampersand does idiomatic raku leave off the trailing `;` at the last statement? what about for multiline statements
elcaro again, I'm not sure the community has really settled on idiomatic ways of doing everything. some people really like to write using as few parens as possible 01:24
sampersand yeah makes sense 01:25
elcaro i use them a lot because to me it makes things more readable. Do what suits you (tho my recommendation is to learn towards more readable way)
sampersand i just want my code to be as normal as possible lol
elcaro as far as semi's are concerned. i often exclude them on a line if it's the only line in a block
sampersand yeah ok cool 01:26
elcaro if I put 2 lines in a block... both will have semi's. that's just how I do
sampersand yeah makes sense
sampersand is there a way to make infix methods? something like `class Frac { method infix:<+>($rhs) { ... } }` 01:27
elcaro as in... infix:<+> that works on your own class. yes, absolutely, but you declare the sub outside your class
tonyo sampersand: you should use `is pure` for things that don't have side effects 01:28
eg 5 + 5 is always the same. "x".IO.slurp is not, even if called close together
sampersand tony: the problem is my thing won't have side effects if the values passed to me dont have side effects
tonyo then you have side effects 01:29
sampersand ok cool, so i need to be certain i wont
elcaro m: class M { has $.x }; multi infix:<+>(M $a, M $b) { $a.x ~ $b.x }; say M.new(x => 'A') + M.new(x => 'B')
evalable6 AB
tonyo you can do a purity check on the arguments
sampersand purity check?
re inflx: so i always have to declare it outside the class?
elcaro it's a function, so if you declare it inside a class, it's only available inside that class 01:33
presumably you are writing a module that provides a class... you module could also declare (and export) an infix function that handles your class
sampersand ah 01:34
 ok
elcaro yeah, just remember that in Raku, most "operators" (eg. infix) are _just_ functions. Classes do not do operator overloading 01:36
not in the traditional sense, at least 01:37
sampersand so, to learn new languages i write a dumb little programming language
i usually use operator overloading, but here it doesn't make as much sense. in the dumb little language, `+` is both concatenation and addition, but in raku (and perl) they're separate functions. should i just scrap the operator overloading idea entirely? 01:38
elcaro that's really a design decision you need to make. Perl needed to make this distiction because it had no types, & even tho Raku has types, i think this distinction is still valuable (readability!) 01:40
but using plus for concat and addition is not inherently "wrong" and plenty of popular languages do it
sampersand yeah, totally agree. I originally overloaded them, but then i realized it wasn't really following raku style—`String.new("12") + Number.new(1)` would be expected to return 13 01:41
sampersand so now im doing `String.new("12").add(Number.new(1))` 01:42
tonyo m: sub x is pure { }; sub y { }; say "x {'is pure' if &x.^can('is-pure')}\ny {'is pure' if &y.^can('is-pure')};"; # sampersand 02:23
evalable6 x is pure
y ;
guifa elcaro: I think even with types it’s not a bad idea to have the two. Strings and numbers are (especially in Raku) fundamentally distinct scalar values, and many classes can reasonably behave in both contexts 02:34
re sampersand’s desire for custom infixes, the only problem with them is you have to ensure that the infix sub is in the scope. Otherwise, if you pass the two objects to a sub where it’s not declared, it’ll try to do standard math. Almost makes you wish there was a MATH method similar to ACCEPTS that was called, but understandably that would probably destroy performance 02:36
sampersand i dont really understand how private fields (ie `$!field` ), `bless` and `new` work. This only works when i have `$.field`  : `role Foo { has $!field; method new($field) { self.bless :$field } }` 03:26
sampersand beuler? D: 03:47
guifa only public fields are set automatically 04:10
at least for the default BUILD
sampersand i dont really understand how private fields (ie `$!field` ), `bless` and `new` work. This only works when i have `$.field` : `role Foo { has $!field; method new($field) { self.bless :$field } }` 04:22
elcaro .tell sampersan maybe this helps (re: $!private attrs, `bless` and `new`) gist.github.com/0racle/959a94fdb38...a150150dfc 06:46
tellable6 elcaro, I haven't seen sampersan around, did you mean sampersand?
elcaro .tell sampersand maybe this helps (re: $!private attrs, `bless` and `new`) gist.github.com/0racle/959a94fdb38...a150150dfc
tellable6 elcaro, I'll pass your message to sampersand
PimDaniel \o 09:56
tyil o/
sjn \o/ 09:57
PimDaniel I'v found a simple way to EXPORT_OK some tags : without writing "is export" on each of them : pastebin.com/HBSnq6s5
PimDaniel I wanted to go further just for fun and bring some variable from TestImport module into MYTAG package, but i still strugle to interpolate and... 10:24
Here is the code , the question is at the line HERE IS THE QUESTION. Thanks in advance. 10:25
pastebin.com/W0H1bfJW
Xliff jmerelo: Good morning. You around? 11:59
.tell jmerelo Considering github.com/perl-foundation-outreac...ndings.md, I wouldn't mind serving as an additional mentor to the project, assuming finalyst doesn't mind. Especially given: github.com/Xliff/p6-GtkPlus 12:00
tellable6 Xliff, I'll pass your message to jmerelo
Xliff .tell jmerelo Wasn't planning on updating that module to :ver<4> until it was available on distributions. So maybe sometime next year I can bring a more complete version to Raku. However Raku has some serious issues with its installers to handle large scale projects. Things zef does not handle well at all. 12:02
tellable6 Xliff, I'll pass your message to jmerelo
ugexe As always, zef just passes a dist to Rakudo to install. There is literally nothing that can be done to improve what xliff is talking about outside of rakudo itself 12:35
Xliff ugexe: Use of parallel rakudo process for precomp. 12:36
ugexe Zef has no hand in any of that
Why would you think it did?
Xliff I don't. That's the problem.
For large scale projects, the installer must be able to apply tricks to speed up the installation process. 12:37
If you think that is not zef's domain, it isn't.
Another installer must then fit that niche.
ugexe Raku has no way of doing this
precomp happens inside Raku own install method 12:38
Xliff Yes, it does. I spent a good few months writing code that inspired nine to add the proper code to do it.
ugexe I think you’re confused the
Xliff ugexe: Will 'raku -e 'use Module' precompile said module? 12:39
ugexe For a CURFS report sure
that isn’t CURI
Xliff Then I am not speaking CURI
And CURI is insufficient for large scale deployment. 12:40
ugexe Then why would an installer matter
installers use CURI for installation... that’s the point
Xliff ugexe: See github.com/Xliff/p6-GtkPlus
ugexe I’m aware
Xliff Installing that module will take zef over an hour.
ugexe install it with core Raku will take an hour then 12:41
Xliff Would you find that time acceptable?
So another solution needs to be developed.
That's what I would like to discuss.
ugexe Great , so quit blaming zef everything you have this issue
Xliff ugexe: I am not blaming zef. I am saying that zef is insufficient and too limited to solve the problem by your own admission. 12:42
YOU are saying I am blaming zef.
See: github.com/Xliff/p6-GtkPlus/blob/m...-build.pl6 for an attempt at a solution. 12:43
ugexe You have said what you have said. If you wish to continue saying it I will continue to correct it
Xliff But you aren't correcting. You are starting an argument where there isn't one.
And you continue to ignore the attempt at furthering raku. 12:44
How would you define it?
ugexe Well one thing that lessens my involvement is accusations 12:46
tadzik Xliff: the www.gtk.org/screenshots/ from your readme looks like a dead link :) 12:46
Xliff tadzik: Thanks! I'll fix.
ugexe: Well, by doing so, you are saying you are unwilling to be involved in the solution. 12:47
tellable6 Xliff, I'll pass your message to ugexe
Xliff And that behavior is the reason why Raku will not grow beyond small scripts.
For the record, I would take zef at least 6000 seconds to install p6-GtkPlus from scratch. 12:50
By attempting to parallel precompile and somehow moving the compunits to their final destination, this can be shortend to something akin to 1600 seconds. 12:51
What would be the best way to attain this with current Raku?
patrickb Xliff, ugexe: I think a rather large misunderstanding is at work. I suspect Xliff does not intend to give zef any blame in the long install times, but wants to say that installation (obviously using zef) is currently slow and we should do something about it (not implying zef needs to change), that's why he insisted on already having spent some time 13:04
on rakudos internals, where the real bottleneck is.
tellable6 2021-02-01T09:32:41Z #raku-dev <MasterDuke> patrickb not sure i'd seen that problem-solving PR. yeah, i'll add a comment there
2021-02-01T09:34:03Z #raku-dev <MasterDuke> patrickb and yep, no problems here not doing *BSDs right away, i'd just suggest making it clear in the proposal that what you're proposing would be able to be easily extended for them
Xliff patrickb: Thank you for calmly stating what I indended. 13:05
patrickb On the other hand ugexe took Xliffs repeated use of the word 'zef' as his primary target of concern. I do admit that with a different angle the statements can be read as such. 13:09
patrickb If in doubt try really hard to presume honest motives on the other side. If things get out of hand it's usually safe to assume there is some kino of missunderstanding or (and that's often the worst case) ortogonal focuses of interest on the same subject without realizing. 13:14
PimDaniel \o 13:25
Is there something that can emulate libio-string-perl? 13:26
I need to write into a fixed buffer.
*fixed sized.
Xliff PimDaniel: Why not use Buf? 13:27
PimDaniel Xliff: I do no know , i look at this ... 13:28
Xliff stackoverflow.com/questions/621602...ingbuilder
^^ Not fixed length, though.,
PimDaniel Xliff: Thank's! 13:32
Xliff PimDaniel: Working on another one for you, one sec.
PimDaniel Is there a difference between Str and str type? 13:37
moritz PimDaniel: yes, see docs.raku.org/language/nativetypes 13:38
PimDaniel ok
Xliff PimDaniel: How's this? Feel free to fork. 13:40
PimDaniel Interesting! 13:44
I will have to make a virtual screen buffer. Despite that the fact fixed size is not, it can be controlled. 13:46
but this is not my priority for now. 13:47
I asked another question this morning and nobody replied, i suppose people are just busy.
pastebin.com/W0H1bfJW 13:48
The question is into the post if you may look at it. Thank's in advance, I cannot interpolate. Nothing is urgent. 13:49
The question does not treat about what i'm trying to do but why it does not work. for now i just learn Raku. 13:50
back later... 13:55
tonyo if you have a way to make precomp faster, it should be in core. 15:35
[Coke] .tell pimdaniel - your paste doesn't compile, guessing one of those notes should be a comment. 15:45
tellable6 [Coke], I'll pass your message to PimDaniel
PimDaniel .tell Coke i know it does not. 16:26
tellable6 PimDaniel, I'll pass your message to [Coke]
PimDaniel .tel Coke i'll modify it for it compiles...
tellable6 2021-02-03T15:45:35Z #raku <[Coke]> pimdaniel - your paste doesn't compile, guessing one of those notes should be a comment.
PimDaniel .tell Coke i'll modify it for it compiles...
tellable6 PimDaniel, I'll pass your message to [Coke]
[Coke] . 16:30
PimDaniel .tell Coke this code works but there's a question about interpolation into it, thanks Coke! 16:49
tellable6 PimDaniel, I'll pass your message to [Coke]
PimDaniel .tell Coke pastebin.com/CYNEFSpx 16:50
tellable6 PimDaniel, I'll pass your message to [Coke]
[Coke] . 18:38
tellable6 2021-02-03T16:49:45Z #raku <PimDaniel> Coke this code works but there's a question about interpolation into it, thanks Coke!
2021-02-03T16:50:10Z #raku <PimDaniel> Coke pastebin.com/CYNEFSpx
[Coke] wonders what PimDaniel is trying to do in that example. 18:59
perry He heu hey whoou 19:01
El_Che releasable6: status 19:43
releasable6 El_Che, Next release will happen when it's ready. 1 blocker. 22 out of 110 commits logged
El_Che, Details: gist.github.com/78b176a65ba91b91c8...08ed22f608
perry A bit passive aggressive there, releasable6. 19:44
El_Che ypu have to read it in a NY accent
perry >merge conflict on your Pr's branch "I'M PUSHIN' HERE" 19:45
El_Che aha
gfldex I prefer an upolite bot over folk who release software that is not ready. 19:46
El_Che why not have both? 19:49
tonyo why make a machine polite? 20:50
lizmat perry; releasable6 is a bit testy because there was no 2021.01 release 21:06
AlexDaniel` just change it to 2021.02 then
github.com/rakudo/rakudo/wiki/ChangeLog-Draft 21:07
click edit and change
anybody can do it, I think 21:09
well, anybody except me :)
MasterDuke releasable6: status 21:10
releasable6 MasterDuke, Next release will happen when it's ready. 1 blocker. 22 out of 110 commits logged
MasterDuke, Details: gist.github.com/4e6e8e04f94da8eb11...e390085f48
AlexDaniel` not so fast, there's a cache
aaaaah 21:12
actually, that's a bit different
I looked into the source code
what you actually need to change is this: github.com/rakudo/rakudo/blob/mast...e-releases
AlexDaniel` sorry, I got confused 21:13
lizmat releasable6: status 21:27
releasable6 lizmat, Next release will happen when it's ready. 1 blocker. 22 out of 110 commits logged
lizmat, Details: gist.github.com/a14a661121edbfc688...c26e871350
lizmat releasable6: status
releasable6 lizmat, Next release will happen when it's ready. 1 blocker. 22 out of 110 commits logged
lizmat, Details: gist.github.com/38fe13546c626cc149...66af1cd46d
lizmat I've changed planned future releases
AlexDaniel` releasable6: status 21:31
releasable6 AlexDaniel`, Next release will happen when it's ready. 1 blocker. 22 out of 110 commits logged
AlexDaniel`, Details: gist.github.com/8ece87865a55b1e29e...a4cf77b446
AlexDaniel` hmmmmmm
I think that's something I wanted to fix for a long time :) 21:32
it doesn't react on webhooks, just pulls periodically
give it a minute it'll fix itself probably
getdevvved hellooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo 21:38
AlexDaniel` hi 21:43
releasable6: status
releasable6 AlexDaniel`, Next release in ≈16 days and ≈21 hours. 1 blocker. 22 out of 111 commits logged
AlexDaniel`, Details: gist.github.com/5f4410cc934dd79d48...f124de664c
AlexDaniel` lizmat: ↑ it works! Thanks!
getdevvved woah epic
im new to perl but im interested in learning 21:44
eseyman but not interested in staying, apparently 21:46
summerisle hey all, quick nativecall question here. there's a structure that I need to work with (though it can be a plain old pointer if need be) that has a statically allocated array in the middle. as far as i can tell, there isn't a way to provide hints about these sorts of things to nativecall, is there? worst comes to worse i'll just use a CPointer repr with malloc and be done with it. 22:44
(for the whole struct) 22:45
summerisle i just went with the malloc workaround 23:05
works
tonyo summerisle: HAS int32 @.x[<size>] is CArray 23:25
summerisle i figured it would be HAS, good to know about specifying size. thanks.