🦋 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:03 reportable6 joined 00:08 gcd left
Anton Antonov @rf I plan to publish my book(s) GitHub. 00:10
Geth ecosystem/main: 8935fa36ce | zhouzhen1++ (committed using GitHub Web editor) | META.list
handover perl6-Inline-Scheme-Gambit to iynehz (#616)
00:37 deoac joined
rf Is that Raku for predication @Anton? 00:43
tellable6 2023-02-25T21:50:36Z #raku <shmup> rf: it'll be cool if someone publishes a raku book on no starch press
rf schmpu: Yes I agree!
shmup lol
rf shmup oh jeez
shmup twirls
rf Sorry, just got back from a family birthday not in the sanest of minds lol 00:44
shmup quite ok
rf I still have a functional programming blog-post/guide/book thing planned at some point for Raku 00:48
Is there a with syntax, where I can copy all of the properties of an object and replace one part, something like 01:05
m: class Foo { has $.bar; has $.baz; }; my $foo = Foo.new(bar => 123, baz => 'abc'); my $foo2 = $foo with (baz => 'efg'); 01:06
camelia ( no output )
rf m: class Foo { has $.bar; has $.baz; }; my $foo = Foo.new(bar => 123, baz => 'abc'); my $foo2 = $foo with (baz => 'efg'); say $foo2;
camelia Foo.new(bar => 123, baz => "abc")
rf m: class Foo { has $.bar; has $.baz; }; my $foo = Foo.new(bar => 123, baz => 'abc'); my $foo2 = $foo.clone(baz => 'efg'); say $foo2; 01:09
camelia Foo.new(bar => 123, baz => "efg")
rf Ah, there we go
Anton Antonov @rf yes, “Raku for prediction” is one of them. 01:22
Unfortunately I got distracted with "Predictions with Raku". Which requires fair amount of work. (Sigh..) 01:29
01:31 merp left, merp joined 01:55 gugod left 02:00 gugod joined 02:05 Manifest0 left
sjn heya; is there a way to make raku force the re-creation of a .precomp directory? 02:20
02:20 razetime joined
MasterDuke i don't know of one other than deleting said .precomp directory 02:26
02:59 deoac left, razetime1 joined, razetime left, razetime1 is now known as razetime 03:11 gcd joined 03:12 freeside left 03:23 razetime left
rf Found a super curious thing, if I have a function as a member on a object, say class Foo { has &.bar }; my $foo = new Foo(bar => { say $^a }); my &bar = $foo.bar; $foo.bar(123) != &bar(123) 04:15
I have a much more practical example in humming bird
04:16 rf left 04:23 razetime joined
guifa_ rf: you want $foo.bar()(123) 04:41
tellable6 guifa_, I'll pass your message to rf
guifa_ rf: the thing is that by having has &.bar with the . twigil, raku sets up an automatic accessor method, equivalent to `method bar ( &!bar )`. If you call $foo.bar(123), you're really passing (123) to that method, rather than to the result of the method 04:42
tellable6 guifa_, I'll pass your message to rf
guifa_ It's a small price to pay to not have to use as many parentheses as other languages LOL 04:44
04:57 razetime left 04:59 razetime joined 05:39 razetime left 05:58 cfa left 06:00 reportable6 left 06:01 reportable6 joined 06:34 MasterDuke left 06:50 grondilu joined
grondilu Hi. It's kind of annoying that Configure.pl does not reckognize '~' in '--prefix' 06:51
Not sure if that's standard semantics or what, but it created a '~' directory. 06:52
That seems pretty dumb tbh
07:04 nort left 07:07 freeside joined 07:08 jpn joined
grondilu unrelated: 07:13
m: grammar { token TOP { <print> } }.parse: "foo"
camelia Cannot resolve caller print(Mu:U: <anon|1>:D); none of these signatures matches:
(Mu: *%_)
in block <unit> at <tmp> line 1
07:13 jpn left
grondilu isn't print a default character class? 07:13
m: grammar { token TOP { <alpha> } }.parse: "foo"
camelia ( no output )
guifa_ grondilu: it is, and it works fine in slashed regexen, but in bracketed ones in grammar it seems to not work 07:16
m: say 'foo' ~~  /<print>+/
camelia 「foo」
print => 「f」
print => 「o」
print => 「o」
07:18 freeside left 08:01 freeside joined 08:46 jpn joined
Nemokosch I think this is the infamous problem with grammars again - their tokens/rules/regexes share the exact same namespace as their methods 09:13
m: my token blah { <print> }; say 'foo' ~~ blah; 09:16
Raku eval Exit code: 1 Too few positionals passed; expected 1 argument but got 0 in regex blah at main.raku line 1 in block <unit> at main.raku line 1
Nemokosch Pfff
09:23 sena_kun joined 09:42 jpn left
grondilu it shouldn't be a problem, provided some kind of precedence is set. 09:45
like in a grammar, a regex should have precedence over a method.
10:00 Guest79 left 10:10 Manifest0 joined 10:21 jpn joined
Nemokosch wouldn't it be clearer to give some namespace to grammarish components 10:27
11:05 Sgeo left 12:00 reportable6 left, reportable6 joined 12:04 jpn left 12:30 jpn joined 12:38 jpn left 13:08 jpn joined 13:13 jpn left
guifa_ grondilu: I agree, and I'd think that *should* be the case. I figured it might have been an order-of-composition issue but… 13:19
m: grammar A { token TOP { <say> }; token say { <alpha>+ } }; A.parse('aaa')
camelia No such method 'nl-out' for invocant of type 'Mu'
in regex say at <tmp> line 1
in regex TOP at <tmp> line 1
in block <unit> at <tmp> line 1
guifa_ it's definitely calling the method and not the token, despite being directly included
So this feels more bug territory than anything else 13:20
el aren't regex just code so they can reside in & namespace just like functions
guifa_ elgatito: they are just code, but when you declare them inside of grammar, some other stuff happens internally — they're not kept in the method table 13:21
13:22 jpn joined
el m:perl say (rx/ (\d+) (.*) /)('1 pigs') 13:24
Raku eval Exit code: 1 No such method '!cursor_start' for invocant of type 'Str' in block <unit> at main.raku line 1
el m:perl say (rx/ (\d+) (.*) /).Signature 13:25
Raku eval Exit code: 1 No such method 'Signature' for invocant of type 'Regex'. Did you mean 'signature'? in block <unit> at main.raku line 1
el m:perl say (rx/ (\d+) (.*) /).signature
Raku eval (Mu: *%_)
el me when
m:perl say '1 pigs'.&(rx/ (\d+) (.*) /) 13:26
Raku eval Exit code: 1 No such method '!cursor_start' for invocant of type 'Str' in block <unit> at main.raku line 1
el what
13:27 jpn left 13:40 jpn joined 13:49 jpn left 13:53 jpn joined
ugexe I wonder if it would be simple to at least throw a warning when a token/regex shadows a normal method 13:53
I know i've been bit writing a large grammar when creating tokens named 'pos', 'to', and 'from'. the later two are particularly unfortunate since they are pretty common words 13:55
(i.e. tokens named after methods on Match) 13:56
13:58 jpn left
ugexe when I brought this up before with someone knowledgeable on it they were suggesting its more of a DIHWIDT, hence why I mention a warning instead of outright trying to change it. although i didn't probe them on why. 14:00
ab5tract seems like a warning is reasonable. In other places of similar shadowing we raise a "Potential difficulties" 14:06
m: my $a = 1; my $a = 2
camelia Potential difficulties:
Redeclaration of symbol '$a'.
at <tmp>:1
------> my $a = 1; my $a⏏ = 2
ugexe true, but tokens are more like methods which we don't do that for 14:10
m: class Foo { method bar { 42 } }; class Foo2 is Foo { method bar { 43 } }; say Foo2.new.bar
camelia 43
ugexe and you'd still want composition of grammar classes to work
14:11 jpn joined
ugexe it would have to check if its shadowing an e.g. Match method 14:11
i wonder if internally instead of `pos` it could reference `Match::pos` 14:13
14:17 jpn left
ab5tract now that's a thought 14:24
14:31 jpn joined 14:36 jpn left 14:50 jpn joined 14:55 jpn left 15:08 jpn joined 15:13 jpn left 15:16 jpn joined 15:21 jpn left 15:27 squashable6 left 15:28 squashable6 joined
guifa_ could have sworn that the tokens were stored in a table separate to methods, but apparently not 15:31
15:31 rf joined
rf Morning 15:34
tellable6 2023-02-26T04:41:05Z #raku <guifa_> rf: you want $foo.bar()(123)
hey rf, you have a message: gist.github.com/0753c65624281e705a...c86054b886
rf guifa_: Yeah I know, just doesn't feel super intuitive but then I guess you can't differentiate between methods and functions as attributes. 15:35
15:35 grondilu left
guifa_ You could potentially create a new postcircumfix that would handle that for you :-) 15:35
Actually only for doing the execution 15:36
rf Yeah, I just settled on ()(...)
Pulling it out to a local variable makes it read pretty well too, my &foo = $obj.foo; &foo(...) 15:37
guifa_ That's what I tend to do anyways
rf The error message really threw me off last night though haha, $obj.foo(args, args, args, args); -> Expected 1 argument, received n 15:39
Then I realised...
guifa_ re the regex/grammar issue though, how is it that tokens like <ws> can be easily overriden in the local sense, but <say> can't be? (I know the MRO is funky with grammars but still) 15:40
15:45 cfa joined 15:52 jpn joined 15:56 jpn left 16:13 squashable6 left
guifa_ TIL you don't have to .new everything for RakuAST. you can do `constant ONE = RakuAST::IntLiteral.new(1)` and then just use ONE anywhere you need it. Can make a lot of stuff much more readable 16:14
16:14 squashable6 joined 16:19 razetime joined
rf That's interesting guifa_ so it will instantiate every time you use ONE or?? 16:26
guifa_ Nope, no need to newly instantiate — compile doesn't care that you reuse instances 16:34
So anywhere you have full branches that are exact duplicates, you can just store the heck out of them
rf Cool 16:36
github.com/rawleyfowler/Humming-Bird/pull/38 New PR for Humming-Bird would like some feedback 16:37
16:47 jpn joined 16:52 jpn left 16:59 razetime left 17:01 razetime joined 17:14 razetime left
ab5tract rf: You could also write a trait for this. `is called-directly` or something like this 17:24
(about the ()(123) thing)
but that would probably look something like meta programming that installs an accessor method for that attribute, which I expect you've already considered 17:26
rf Yeah I wrote something like that but it made it harder to understand anyways so I just kept it. 17:38
Kept the ()(123) **
guifa_ huh I dunno why I didn't think of doing a trait but that would work pretty nicely 17:41
18:00 reportable6 left 18:01 reportable6 joined 18:36 jpn joined 18:41 jpn left 18:55 codesections joined
rf [Coke]: Did you mean to name the distribution for Slang::Date, Slang:Date? 19:11
19:25 squashable6 left, theesm left 19:26 squashable6 joined 19:27 theesm joined 19:35 deoac joined 19:40 ab5tract left 20:05 deoac left 20:07 squashable6 left 20:08 squashable6 joined 20:24 jpn joined 20:26 nort joined 20:29 jpn left
[Coke] rf: nope, it's a typo 20:32
Didn't seem worth a release just to fix that, though. 20:33
rf Yeah I was a little confused when I went to install it lol 20:35
[Coke] If I fix the name, will I end up with two versions of this in fez? 20:36
20:36 Sgeo joined
[Coke] ah, yes. I can remove the old one. rf: uploaded a version with just that one fix, should be in the eco shortly 20:41
thanks for the ping.
rf No problem, thanks for the fix ! 20:43
[Coke] what's best practice on old versions in fez? I have a bunch of pre-prod versions of App::Zef-Deps that don't need to be there. 20:44
I'm happy to just keep the latest one since there isn't any expectation of API, etc.
>= Slang::Date:ver<0.1.2>:auth<zef:coke> 20:45
ah, fez remove only works within 24 hours?
tonyo: how to remove Slang:Date now that Slang::Date is there? (and also the 10 old versions of App::Zef-Deps?) 20:46
rf I have this problem too I don't think you can delete after 24 hours :( 20:47
ugexe: Do you know if this is possible?
20:52 vrurg_ joined, vrurg left 21:13 epony joined 21:41 sena_kun left
Geth doc: tbrowder++ created pull request #4215:
Modify the 'Brackets' table generator to read the data source file
guifa_ I think that either ugexe or tonyo can manually do it 21:47
21:59 simcop2387 left, perlbot left 22:02 greppable6 left, committable6 left 22:03 committable6 joined, tib_ left 22:04 tib joined 22:05 greppable6 joined 22:12 jpn joined 22:19 jpn left 22:34 Scotteh left, Scotteh joined, epony left 22:36 epony joined
coleman Docs site rewrite has gone live docs.raku.org/ 22:48
23:01 Juerd left
Geth doc-website/main: a6fb41939c | (Richard Hainsworth)++ (committed using GitHub Web editor) | Website/structure-sources/about.rakudoc
New about page (#143)
23:06 amenonsen left
[Coke] weekly: docs.raku.org/ !! 23:07
notable6 [Coke], Noted! (weekly)
23:07 jpn joined
[Coke] (the new site is up) - We've sporadically asked for feedback before go live, I fully expect us to get more tickets now that it's live. Please report pure content issues to raku/doc, issues with the site (like search, formatting, etc.) to raku/doc-website 23:08
23:11 simcop2387 joined 23:12 perlbot joined, jpn left
Geth ¦ doc-website: finanalyst self-assigned generated from is not linking to the reflog github.com/Raku/doc-website/issues/145 23:12
guifa_ [Coke] NIIIIIIIIIIIIIIICE 23:18
23:39 deoac joined