🦋 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.
thowe_ the man himself... At least I can feel like I know good when I see it. 00:39
elcaro thowe_: There is similar code in the Net::Netmask module, which parses subnets into objects with a bunch of handy methods 02:21
azawawi hi 05:29
tellable6 2022-09-28T04:42:46Z #raku <[Coke]___> azawawi raw.githubusercontent.com/azawawi/...META6.json
2022-09-28T04:43:06Z #raku <[Coke]___> azawawi raw.githubusercontent.com/azawawi/...META6.json - you are on main, but you've published master
azawawi Coke++
thanks
github.com/azawawi/raku-godot-fun # Baby steps :) 05:30
ramesh Should I learn perl 5 or Raku? I have just started. 07:24
Nemokosch It depends. Currently, I'd say there are two things Perl is fundamentally better at. 07:30
1. backwards-compatibility and accessibility overall. These were the main concerns that resulted in the split in the first place so while Raku was about trying to fix things, Perl moves very slowly and carefully, so that something from 30 years ago will still work. 07:32
smol-hors they're both cool but my fav is Raku 07:35
Nemokosch 2. performance. I'm not sure how much this is intrinsic to the design (hopefully not too much) but as it stands, Perl is way faster and can be compiled to native code. If you want to compete with other mainstream scripting languages regarding speed right here and right now, Perl is ready for that while Raku is not. 07:38
What you get in return is: 1. an overall much more versatile and outsider-friendly language 2. generally much more willingness to move things forward and change things if necessary 07:40
Depending on what is your thing, you might like minor details like raku has a REPL and it can generate decent CLI from the signature of the MAIN subroutine 07:41
Or the zef/fez macroverse over oldschool CPAN 07:42
For the performance: iirc Perl is actually written in C. Now, if you know some C (perhaps any language with binary compatibility?), Raku has great FFI tools and you can do the heavy lifting with a C dynamic library. 07:44
Raku also has actual object model and multiple dispatch over types/custom conditions 07:51
I think I couldn't switch to Perl even if I wanted, I'd miss too much of Raku 😄
ramesh Thank you for the detailed information. I appreciate. 07:55
Nemokosch 🍬 08:01
Voldenet raku has better syntax and is more fun to write, it feels more modern 08:55
Geth doc/m-dango-patch-1: 46a7298394 | (Daniel Mita)++ (committed using GitHub Web editor) | doc/Language/syntax.pod6
Modify embedded comments documentation
12:39
doc: m-dango++ created pull request #4111:
Modify embedded comments documentation
12:41
[Coke] ooh, a patch 12:45
Nemokosch Very nice 🥳 12:53
Although I for one wouldn't completely remove examples of what the "open punctuation characters" are, at least a few
or maybe a link to a unicode description
leont Apparently C<> doesn't work inside a POD table 😑 13:26
Nemokosch what would C<> do normally? 13:38
docs.raku.org/language/pod#Code gotcha 13:39
leont It's a formatting code, it seems the other also don't work.
Nemokosch raw.githubusercontent.com/perl6/sp...tation.pod 13:59
if you look up =head2 Blocks 14:01
it seems to me it should work, or I don't understand you
Geth doc: c9cbe0fa58 | (Daniel Mita)++ (committed using GitHub Web editor) | doc/Language/syntax.pod6
Modify embedded comments documentation (#4111)
15:31
linkable6 Link: docs.raku.org/language/syntax
polarbearX What is right raku's idiomatic way to replace perl' s : while(<>) { s/A/B ; ; print }   # ? ? ? 17:34
[Coke] m: $*IN.slurp.subst(/A/, 'B').print 17:38
camelia »Wann treffen wir drei wieder zusamm?«
»Um die siebente Stund‘, am Brückendamm.«
»Bm Mittelpfeiler.«
»Ich lösche die Flamm.«
»Ich mit«

»Ich komme vom Norden her.«
»Und ich vom Süden.…
[Coke] m: $*IN.slurp.subst(/a/, 'B').print
camelia »WBnn treffen wir drei wieder zusamm?«
»Um die siebente Stund‘, am Brückendamm.«
»Am Mittelpfeiler.«
»Ich lösche die Flamm.«
»Ich mit«

»Ich komme vom Norden her.«
»Und ich vom Süden.…
[Coke] Depending on size, you might want to do that by line instead of .slurping the whole thing.
ah, sorry: in fact you do need to do it by lines to get the same effect. one sec. 17:39
polarbearX I tried:  for lines() { s/A/B/; .say }    # got "Cannot assign to an immutable value" 17:41
[Coke] m: .subst(/a/, "B").say for $*IN.lines # better
camelia »WBnn treffen wir drei wieder zusamm?«
»Um die siebente Stund‘, Bm Brückendamm.«
»Am Mittelpfeiler.«
»Ich lösche die FlBmm.«
»Ich mit«

»Ich komme vom Norden her.«
»Und ich vom Süden.…
[Coke] m: .subst(/A/, "B", :g, :i).say for $*IN.lines # better 17:42
camelia »Wann treffen wir drei wieder zusamm?«
»Um die siebente Stund‘, am Brückendamm.«
»Bm Mittelpfeiler.«
»Ich lösche die Flamm.«
»Ich mit«

»Ich komme vom Norden her.«
»Und ich vom Süden.…
[Coke] (ignore that last one, testing)
gfldex m: for lines() <-> $_ { s/A/B/; .say } 18:27
camelia Parameter '$_' expects a writable container (variable) as an argument,
but got '»Wann treffen wir drei wieder zusamm?«' (Str) as a value
without a container.
in block <unit> at <tmp> line 1
gfldex m: for lines() <-> { s/A/B/; .say }
camelia Too many positionals passed; expected 0 arguments but got 1
in block <unit> at <tmp> line 1
gfldex m: for lines() -> $_ is copy { s/A/B/; .say } 18:28
camelia »Wann treffen wir drei wieder zusamm?«
»Um die siebente Stund‘, am Brückendamm.«
»Bm Mittelpfeiler.«
»Ich lösche die Flamm.«
»Ich mit«

»Ich komme vom Norden her.«
»Und ich vom Süden.…
lizmat gfldex: but what is the point of storing the substitution if it is discarded ? 18:34
gfldex I would never rule out the possibility to find use for a Raku idiom. Mostly, because I'm not smart enough to contain the whole of Raku in my head. 18:36
Rog Is there a way to get a manually written multi method to work alongside the an autogenerated field accessor? Naïvely this is what I tried: `class Investment { has Rat $.balance; multi method balance(Investment:U: --> Rat) { 0.0 } }` 18:56
`s/the an/an/`
xinming m: class Investment { has Rat $.balance; multi method balance(Investment:D: --> Rat) { 1.0 }; multi method balance(Investment:U: --> Rat) { 0.0 }; }; Investment.balance.say; Investment.new.balance.say; 19:21
camelia 0
1
Rog Sure, but now try returning the balance field in the defined case 19:23
gfldex m: class Investment { has Rat() $!balance is built; multi method balance(Investment:D: --> Rat) { $!balance }; multi method balance(Investment:U: --> Rat) { 0.0 }; }; Investment.balance.say; Investment.new(:balance(42)).balance.say; 19:29
camelia 0
42
gfldex <@102059593697361920> There is always a way. :-> 19:30
ugexe "...to work alongside the an autogenerated field accessor?" 19:30
gfldex The autogenerated accessor is of no help, because it isn't a multi. I believe Rog was missing `is built` to make it work. 19:31
lizmat fwiw, you can create your own methods, even if the attribute is public 19:35
the accessors are created *after* a class is parsed and only for those attributes that don't have an accessor yet 19:36
m: class A { has $.foo; method foo() { "bar" } }; my $a = A.new(foo => 42); dd $a; dd $a.foo 19:37
camelia A $a = A.new(foo => 42)
"bar"
gfldex lolibloggedalittle: gfldex.wordpress.com/2022/09/29/rabbitholeing/
Rog Ahh, I had not heard of `is built`
melezhik o/ 19:49
I have spinned up alpine repository for raku modules, so far this is just a few modules - github.com/melezhik/raku-alpine-repo , ping me if you want to add your module ... thanks 19:50
Nemokosch I wonder how many years of Raku wizardry is required to comprehend a gfldex post 😅 20:33
tonyo .tellable github.com/tony-o/envy/ 23:19
or whatever it is?
.weekly github.com/tony-o/envy/ 23:20
weekly: github.com/tony-o/envy/
notable6 tonyo, Noted! (weekly)