🦋 Welcome to the former MAIN() IRC channel of the Raku Programming Language (raku.org). This channel has moved to Libera (irc.libera.chat #raku)
Set by lizmat on 23 May 2021.
Geth examples: mykhal++ created pull request #78:
Update 01-00introduction.raku
07:02
Ulti gist.github.com/MattOates/c5879a07b1ef2c013097 if you check out the comments you can see the difference in numerical performance of Raku from 2016 and now 07:52
I think more important is the standard deviation really showing that things are consistent and predictable in how they perform 07:54
Geth examples: 2fd79e0298 | (Michal Bozon)++ (committed using GitHub Web editor) | categories/cookbook/01strings/01-00introduction.raku
Update 01-00introduction.raku

mistaken variable
09:12
examples: 1cbfc20b33 | (Juan Julián Merelo Guervós)++ (committed using GitHub Web editor) | categories/cookbook/01strings/01-00introduction.raku
Merge pull request #78 from mykhal/patch-1

Update 01-00introduction.raku
lizmat trivia question of the day: what's so special about the number 129419 ? 09:39
sjn nothing? :) 10:05
I pretty much has to be more interesting than 12407, at least, so there's that. 10:08
lizmat m: say chr(129419) 10:20
camelia 🦋
pony hehe 10:33
:)
Xliff m: 129419.sqrt.say
camelia 359.74852327702473
Xliff Well...darn
Well...darn 10:34
Xliff m: use NativeCall; constant CARD8 = uint8; class AA { has CARD8 $!aa is rw }; 10:59
camelia Potential difficulties:
useless use of 'is rw' on $!aa
at <tmp>:1
------> 3ARD8 = uint8; class AA { has CARD8 $!aa 7⏏5is rw };
Xliff ?? Why useless use?
... /o\ # Oh! 11:02
kawaii_ can the contents of a subset be overridden/extended? at the moment I have `subset TerminationPoint of Str where * eq any(<system transfer reward penalty>);` but ideally users of my lib would be able to add their own termination points to that list 11:14
Xliff m: sub myRoutine (\v) { True }; subset TerminationPoint of Str where *.&myRoutine; 11:17
camelia ( no output )
Xliff Huh! That worked...
m: my %conditions; sub myRoutine (\v) { for %conditions.keys { return False unless %conditions{$_}(v) }; True }; subset TerminationPoint of Str where *.&myRoutine; %conditions<even> = -> $v { $v eq 'Even' }; sub testCondition(TerminationPoint $a) { say 'Terminated!' }; testCondition('Even'); testCondition(42); 11:20
camelia Unhandled exception: Failed to write 184 bytes to filehandle: No space left on device
from gen/moar/stage2/NQPHLL.nqp:2117 (/home/camelia/rakudo-m-inst-1/share/nqp/lib/NQPHLL.moarvm:command_eval)
from gen/moar/stage2/NQPHLL.nqp:2036 (/home/cam…
Xliff rut roh!
kawaii_ oh dear :D 11:34
Altreus Can you use a class method in a subset I wonder 11:39
not sure how I would write it...
class A { subset X of Str where * eq any ( ??? ); } 11:40
&!foo?
Altreus nope 11:58
tbrowder ugexe: i think you said once that a bin/prog for one zef-installed module will not conflict with another module's bin/prog with the same name for installation, thus both will be available, is my memory correct? 12:56
if so, how does the user disambiguate them? (oops, i'll go check zef docs) 12:58
ugexe technically they are available, but it doesnt mean your shell lets you launch them by seeing them in PATH 13:01
github.com/rakudo/rakudo/pull/4153 this would solve your issue but i never merged it doh 13:03
oh i left a comment on something saying it wasnt sufficient 13:04
tbrowder so at the moment it looks like dup names will overwrite in my .raku/bin dir, correct? at least for the same module 13:15
on another zef topic, did i see a convo recently about speeding up zef by cleaning up somehow (removing old versions helps i'm sure)? 13:17
afk for awhile & 13:18
ugexe your bin scripts dont get installed to .raku/bin
that is just a shim which is capable of loading some version of the actual bin script of the same name 13:19
zef locate bin/zef
===> From Distribution: zef:ver<0.11.7>:auth<github:ugexe>:api<0>
bin/zef => /Users/ugexe/.rakubrew/versions/moar-blead/install/share/perl6/site/resources/9835BBA3FD98CC55CD826918B064F8A13616C14B
like that is the actual bin file of zef 13:20
if i run `raku /Users/ugexe/.rakubrew/versions/moar-blead/install/share/perl6/site/resources/9835BBA3FD98CC55CD826918B064F8A13616C14B --help` it will show zef help 13:21
tbrowder ok, forgot that, thnx 14:40
role question: i am creating a role that will be shared by two classes acting as a parent and children, say A and B (but no actual inheritance). in defining the role, in order to restrict the role's mehods to one or the other, is creating its signature similar to this a good practice:to use 14:49
(A:D: $arg) # restricted to class A
vrurg tbrowder: Not sure I'm getting you right, but do you mean `method foo(::?CLASS:D:) {}` or `method foo(::?ROLE:D:) {}`? 15:09
tbrowder kinda, but usage only by a particular class, say A 15:11
before the role defintion i precede all the using class defs with stubs, class A {...} 15:12
so i can use in the role: method foo(A:D:) so class B can't use it 15:14
*definition 15:15
so far i get no compilation errors, but i haven't yet tried to cause a problem, just investigating best practice 15:17
i saw similar syntax in class DateTime 15:18
but of course that was core...
tbrowder i'll try it here, take me some time, patience... 15:21
tbrowder m: class A {...}; class B {...}; role Foo { method bar(A:D:) { say "bar"}; method baz {say "baz};}; class A does Foo {}; class B does Foo {}; my $a = A.new; my $b = B.new; $a.bar; $a.baz; $b.baz; $b.bar; 15:28
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$a' is not declared
at <tmp>:1
------> 3 A does Foo {}; class B does Foo {}; my 7⏏5$a = A.new; my $b = B.new; $a.bar; $a.ba
tbrowder arg, missed a " 15:29
tbrowder trying offline... 15:30
lizmat clickbaits rakudoweekly.blog/2021/07/12/2021-...splitting/ 15:39
Altreus is baited
tbrowder ok, works as expected
tbrowder got a type check error when B tried to access method bar 15:41
lizmat++
if you add the missing " in say "baz" above that should dup my offline attempt 15:44
Xliff rut roh!
m: my %conditions; sub myRoutine (\v) { for %conditions.keys { return False unless %conditions{$_}(v) }; True }; subset TerminationPoint of Str where *.&myRoutine; %conditions<even> = -> $v { $v eq 'Even' }; sub testCondition(TerminationPoint $a) { say 'Terminated!' }; testCondition('Even'); testCondition(42);
camelia Terminated!
at SETTING::src/core.c/Exception.pm6:527 (/home/camelia/rakudo-m-inst-1/share/perl6/runtime/CORE.c.setting.moarvm:print_exception)
from SETTING::src/core.c/Exception.pm6:583 (/home/camelia/rakudo-m-inst-1/share/perl6/runtime/CORE…
guifa To what extent are traits supposed to be pervasive across composition and subclassing? 19:25
tellable6 2021-07-12T06:10:48Z #raku <raydiak> guifa "self" there is referring to the autopunned class, not the role itself. that's why .WHICH is different. e.g. try `role A { method new { say self.HOW; say A.HOW; } }; A.new`
lizmat a trait is nothing more / less than a piece of code that will get run during compilation time 19:32
with the (meta-)object as the invocant 19:33
what it does, who knows? so you cannot answer that question like that in general
m: sub trait_mod:<is>(Mu, :$foo!) { say "foo" }; sub bar is foo { } 19:34
camelia foo
guifa lizmat: okees, I guess then the question is more specific to particular traits ha 19:38
m: role Foo is repr('Uninstantiable') { }; class Bar does Foo { }; Bar.new.say; 19:39
camelia Bar.new
guifa This actually works *exactly* how I'd like it to (so yay), but it also feels like I'd expect the repr('Uninstantiable') trait to compose into the Bar class 19:40
(you know me, always doing weird things) 19:41
melezhik . 20:13
japhb (torch and pitchfork) DO ALLL THE WEIRD THINGS! 23:30