🦋 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: ... | Log inspection is getting closer to beta. If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 25 August 2021.
grondilu wasn't there such a thing as a 'parsed' trait to define terms constrained by a Grammar/regex? 10:22
lizmat not in current core 10:26
doesn't ring a bell with me, maybe with moritz_ ? 10:27
grondilu found it. It's discussed in S06 10:32
however : "This trait and the following are likely to be deprecated in favor of slang macros that are aware of the grammar and category in which they are installed, and that therefore already know how to parse like normal grammar rules. " 10:33
so macro it is I guess
grondilu is not sure how that would work though 10:34
lizmat neither 10:35
grondilu say I hawe a module Foo that uses an other module Bar. How can I have Foo export all the symbols that Bar exports? 11:39
with heritage maybe? 11:40
lizmat by playing EXPORT tricks
see e.g. P5built-ins that imports / exports all of the other P5xxx modules
github.com/lizmat/P5built-ins/blob...ns.rakumod 11:41
tbrowder m: my $fh = $*OUT 12:12
camelia ( no output )
tbrowder m: my $s="howdy"; my $fh=$*OUT; $fh.say: $s 12:13
camelia howdy
tbrowder just checking to see if i can use a shorthand for writing to stdout 12:14
m: my $fh = $*OUT; $fh.say("foo"); $fh.close 12:15
camelia foo
tbrowder m: my $fh=$*OUT; my $s="bar";$fh.say($s);$fh.close; say $s 12:17
camelia bar
Cannot do 'print' on a closed handle
in block <unit> at <tmp> line 1
tbrowder so, using the alias in a program, i think the "close open file handles when done with them" rule should generally not be followed for std* handles 12:20
rakuing down the river...bye 12:21
grondilu there is no such thing as a parametric module, is there? 12:40
lizmat grondilu: ? what do you mean by that? 12:42
grondilu 'use Foo(:param(value));' 12:43
I guess I can do 'use Foo; $Foo::param = value;' 12:44
lizmat that'd be passing :param(value) to its EXPORT SUB
grondilu *sub, no? 12:45
you could use that to parameterize, I guess
grondilu wrong syntax then
lizmat but it feels better to just export a parameterizable role
and parameterize that
grondilu I don't want to compose it though so it's not a role I want. 12:46
lizmat you can also have a class with a ^parameterize method ? 12:47
grondilu I don't want to instanciate it either. Nevermind I think I just have to assign a our variable. 12:48
setting it during in the use statement would feel convenient, though. 12:49
syntax would have been rather 'use Foo[param];' or something I guess 12:50
Anton Antonov "but it feels better to just export a parameterizable role" -- we can see modules as classes, hence switching from a module to a role is not that far fetched conceptually.
This SO discussion is related to my statement above: stackoverflow.com/q/67564394 12:52
lizmat m: role Foo { $.a = 42 }; dd Foo.new.a # and there's role punning
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable $.a used where no 'self' is available
at <tmp>:1
------> 3role Foo { $.a7⏏5 = 42 }; dd Foo.new.a # and there's r
expecting any of:
term
lizmat m: role Foo { has $.a = 42 }; dd Foo.new.a # and there's role punning
camelia 42
Skarsnik Hello, I am confused by some block syntax/error? 15:42
m: try {say "hello"; die "piko"; True} or say "plop"
camelia hello
plop
Skarsnik try {say "hello"; die "piko"; True} or {say "plop"}
evalable6 hello
Skarsnik I am not sure to understand why the second run does say plop 15:43
ugexe m: my $a = {say 42}; say $a 15:45
camelia -> ;; $_? is raw = OUTER::<$_> { #`(Block|74802872) ... }
ugexe m: my $a = {say 42}; say $a()
camelia 42
True
Skarsnik *does not 15:46
ugexe because you didnt use `do` 15:48
Skarsnik Was there a command to run on old rakudo version? 15:51
I dit a PR with code like this to fix a bug in Test and it does not work x) 15:52
!whateverable
commit: 2020.01 try {say "hello"; die "piko"; True} or {say "plop" 15:54
committable6 Skarsnik, gist.github.com/937d23dfa33d6ad65d...8b13b4db1d
Skarsnik commit: 2020.01 try {say "hello"; die "piko"; True} or {say "plop"}
committable6 Skarsnik, ¦2020.01: «hello␤»
ugexe i suspect your PR did not work the way you think then 16:02
Skarsnik not sure why the test did not caught it 16:05
Oh, I did not write a test for the input x) 16:11
I wonder if there are other case where it could be useful to maybe have a class doing her own test failure output. 16:14
# expected: Buf.new(22,25)
# got: Buf.new(22,255)
having the number in hex is more useful 16:15
especially if like the diff is at the 15 bytes, not easy to see if the expected & got string does not make them match 16:16
Skarsnik Can I call a non exported sub from a Module? Like I writing my own is sub in my code x) 16:29
Or can I directly make part of a my code being part of the Test module? 16:32
timo nice to see you Skarsnik :3 16:39
the Test module would probably want to get some kind of API for this purpose
Skarsnik Whenever I propose a new API it stay 4 years without answers! (just kidding) 16:40
timo, any news on your profiler? :) 16:43
timo i just resumed work on it actually 16:46
i made the mistake of just running "npm update" and hoping it would continue working
it did not :D
Skarsnik I will try do run some benchmark when the new release is out. I am curious of the gain on Gumbo benchmark 16:47
timo well, new-disp isn't merged yet, and nativecall is also not yet integrated with it in even the most basic form 16:48
so it's likely not going to be much better immediately
Skarsnik What is new-disp in summary?
timo well, there's an excellent jnthn presentation about it, and i'll likely not do it justice with just a short summary 16:50
one part of it is about generalising a bunch of systems into just one. for example, the method cache is gone now 16:51
AFK for a moment
ok, so we've now got a mechanism that lets the programmer (probably only core developers mostly, though) write in code how different kinds of "dispatch" work 17:04
where dispatch encompasses pretty much everything where "a bunch of arguments go in, a decision what to call or return is made, and that is then acted upon" 17:05
so this is for stringifying things (do we have a built-in C function? do we call .Str on the thing?), deconting things (is it a simple container so we just have to take an attribute? is it a Proxy where we need to invoke a FETCH method?), of course calling raku methods (is there a wrapper? is the proto sub complex? what decides what multi to invoke? are there "where" clauses?) and also this has a way 17:07
to program "resumption"
resumption is for things like nextsame/callsame/samewith/callwith
timo Skarsnik: anyway, with moarvm being "in the know" about all these more complex mechanisms, we can have the optimizer understand things better and do inlining and optimization in many more cases than before :) 17:48
Skarsnik interesting ^^
timo absolutely give jnthn's talk a shot
Skarsnik Now you need to profile the choice the optimiser made? x) 18:12
timo well, we'll get to see deoptimization counts, and we'll see the inlining decisions 19:01
timo apart from that we see the generated guards and such in the spesh log 19:01