🦋 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.
Xliff m: say "198' ~~ / \d+ <!( $/[0] < 255}> 00:20
camelia ===SORRY!=== Error while compiling <tmp>
Unrecognized backslash sequence: '\d'
at <tmp>:1
------> say "198' ~~ / \⏏d+ <!( $/[0] < 255}>
expecting any of:
argument list
double quotes
term
Xliff m: say "198' ~~ / \d+ <!( $/[0] < 255}> / 00:21
camelia ===SORRY!=== Error while compiling <tmp>
Unrecognized backslash sequence: '\d'
at <tmp>:1
------> say "198' ~~ / \⏏d+ <!( $/[0] < 255}> /
expecting any of:
argument list
double quotes
term
Xliff m: say "198" ~~ / \d+ <!( $/[0] < 255}> /
camelia ===SORRY!===
Unrecognized regex metacharacter < (must be quoted to match literally)
at <tmp>:1
------> say "198" ~~ / \d+ <!⏏( $/[0] < 255}> /
Unable to parse regex; couldn't find final '/'
at <tmp>:1
------> say "198" ~~ …
Xliff m: say "198" ~~ / \d+ <!( $/[0] < 255}> /
camelia ===SORRY!===
Unrecognized regex metacharacter < (must be quoted to match literally)
at <tmp>:1
------> say "198" ~~ / \d+ <!⏏( $/[0] < 255}> /
Unable to parse regex; couldn't find final '/'
at <tmp>:1
------> say "198" ~~ …
Xliff m: say "198" ~~ / \d+ <(! $/[0] < 255}> /
camelia ===SORRY!===
Unrecognized regex metacharacter ! (must be quoted to match literally)
at <tmp>:1
------> say "198" ~~ / \d+ <(⏏! $/[0] < 255}> /
Unable to parse regex; couldn't find final '/'
at <tmp>:1
------> say "198" ~~ …
Xliff WTF?
guifa_ did you mean <{ and not <( ? 00:22
Xliff m: say "198" ~~ / \d+ <!{ $/.Int < 255}> / 00:23
camelia Nil
Xliff The above
That should return a match, yes?
m: say "198" ~~ / \d+ <{ $/.gist.say }> / 00:24
camelia #<failed match>
「198」
「19」
「」
「98」
「」
Nil
guifa_ $/.Int < 255 will return True. <!{ … }> checks if the value is False. It is not, so the match fails.
s/False/Falsey
Xliff m: say "198" ~~ / \d+ <?{ $/.Int < 255}> /
camelia 「198」
guifa_ you probably want <?{ … }
Xliff Oho! Reversed logic. Silly.
m: say "198" ~~ / \d+ <?{ $/.Int .. (..255}> / 00:25
camelia ===SORRY!=== Error while compiling <tmp>
Preceding context expects a term, but found infix .. instead.
at <tmp>:1
------> say "198" ~~ / \d+ <?{ $/.Int .. (..⏏5255}> /
Xliff m: say "198" ~~ / \d+ <?{ $/.Int ( 0.. 255}> /
camelia ===SORRY!=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> say "198" ~~ / \d+ <?{ $/.Int⏏ ( 0.. 255}> /
expecting any of:
infix
infix stopper
statement end
statemen…
Xliff m: say "198" ~~ / \d+ <?{ $/.Int ~~ ( 0.. 255}> /
camelia ===SORRY!=== Error while compiling <tmp>
Unable to parse expression in parenthesized expression; couldn't find final ')' (corresponding starter was at line 1)
at <tmp>:1
------> y "198" ~~ / \d+ <?{ $/.Int ~~ ( 0.. 255⏏}> /
Xliff m: say "198" ~~ / \d+ <?{ $/.Int ~~ ( 0.. 255)}> /
camelia 「198」
grondilu I just tried and it did 07:12
grondilu Hi. Few days ago I watched a YT vid about "5 fastest programming languages". To my surprise the winner was Zig, a language I had never heard about. 07:14
grondilu Also it won by quit a large margin. Beating C and Rust, notably. 07:14
Apparently zig provides its own C compiler, which is called as 'zig cc' 07:15
Out of curiosity I tried to compile rakudo with it. 07:16
So I edited the makefile to 'M_CC=zig cc' and 'M_LD=zig cc' 07:17
and apparently that worked.
grondilu thought this was worth pointing out 07:18
lizmat was it able to run the spectest ?
grondilu that I don't know
I'm not even sure it really used zig and not gcc for some reason
is there a way to check from the raku exec? 07:19
in any case I can run 'make test' and see what that gives
it seems to work fine
'All tests successful' 07:20
I suppose I could also time it and see if there is a speed gain
grondilu does that 07:24
lizmat m: say "$_.raku()\n" for Compiler.verbose-config<moar><>.sort(*.key) 07:25
camelia :ar("ar")

:arflags("rcs")

:arout("")

:as("as")

:asm(".s")

:asmout("-o ")

:asmswitch("-S")

:auxclean("\@:")

:be("0")

:bindir("/home/camelia/rakudo-m-inst-1/bin")

:booltype("_Bool")

:can_specific_we…
lizmat it's probably in there somewhere
grondilu I don't see any real speed gain 07:26
though moarvm was not compiled with zig in my test
lizmat I guess it needs more makefile tweaking than you did 07:27
grondilu How can I specify the C compiler from the Configure.pl scrip call?
--compiler option perhaps? 07:29
grondilu tries --moar-option='--compiler="zig cc"' 07:31
lizmat doesn't know 07:33
grondilu nevermind, I get "FAIL, unsupported compiler 'zig cc'"
I do know that it's possible to compile moarvm with zig though, as I had tried and succeeded to do it from the separated moarvm repo 07:34
by editing the makefile the same way as described above 07:35
grondilu I even did it after uninstalling gcc on my system to make sure I was actually using zig 07:36
I was kind of suprised that it worked 07:37
lizmat perhaps leave an issue in the MoarVM repo for someone to investigate? 07:42
Nemokosch When you look at it, Zig is... really not a nice language. BUT. If it integrates with existing systems programming toolchains this well, and it is actually insanely fast in return for the boilerplate-ish syntax, that's a very solid offer. 07:47
Voldenet grondilu: zig is faster, but zig cc might not be – the simplest reason is that zig is a lot more modern 08:47
than C
Nemokosch: zig introduces a lot of good ideas into the language, for instance @frame/suspend, slices, comptime things, function pointers compared to C… 08:51
tellable6 Voldenet, I'll pass your message to Nemokosch
Nemokosch yes but that's not really a "killer feature" when the gazillion of C killer languages all do the same, in more concise (much more concise, even) ways 08:53
Voldenet The problem with "C killer languages" is that they don't aim to adhere to C philosophy too much 08:54
tbh. zig's power is in creating firmwares for hardware 08:55
there's not a single better language for this
Nemokosch you definitely do have a point there 08:56
Zig's motto could be something like "nothing is obvious, except what you type out" 08:57
ziglang.org/documentation/master/#Zen this is the polar opposite of Raku on all points, lol 09:00
lizmat
.oO( think like a computer )
09:01
Voldenet there's also points that signify what zig isn't for 09:04
> Runtime crashes are better than bugs.
that's not great for http servers, perhaps
Nemokosch Yep, clearly it doesn't try to be a language for everything 09:05
although to be frank, "let it crash" has worked once in telecommunications 😛 09:06
Voldenet erlang doesn't crash in c language sense 09:07
;>
Nemokosch well, if you meant http servers as in Apache nginx stuff, those should probably rather crash than have bugs tbh 09:14
if you meant apps behind a http server, those crash rather the erlang sense
Voldenet I meant http server with the app as a single binary – it's common practice in java or C# 09:31
Nemokosch well that's interesting because ASP.NET Core stuff with Kestrel had the usual "run this behind a reverse proxy" disclaimer 09:38
but at the end of the day, it probably doesn't matter how the crashes > bugs take should be interpreted in a web backend story - the language is kinda unfriendly for this sort of tedious but not very critical task 09:39
Zig seems to be a language that doesn't necessarily try to impress "the masses", it rather has a very specific goal, and I suppose if it does meet that goal, the target audience will be pleased by the working systems created, rather than the language being fun and stuff 09:42
Voldenet In that aspect it's a bit like golang, which isn't fun either 09:52
Nemokosch yes, I just started talking about it to someone and had the same idea 09:53
Go was the only one among the "C killer languages" that even attempted to keep it simple
then it turned out that "keeping it simple" does work, with a different audience in the case of that language 09:54
El_Che Voldenet: Go is a lot of fun because you can program like you do with dynamic languages, while keeping static typing 09:57
(because of the fast compilation)
Nemokosch except maybe that there isn't a dynamic language as ugly 10:03
holmdunc it will refuse to compile any time there is an unused variable or import, so not that light and breezy to use 10:08
Nemokosch to be fair, they treat that as a feature 10:09
Go's killer feature is this insane extent of opinionatedness 10:10
holmdunc the thing I mentioned manifests itself as many times you comment out some code, you're probably going to be met with a spurious failed compile and have to go and fiddle with the import statements at the top of the file 10:15
Nemokosch I mean, we are talking about a language that thinks of dependency management as "go get" 10:17
like they didn't even try xD 10:18
holmdunc like you said, prime example of extreme opinionation... namely "we aren't having compiler warnings, period, so it has to be an error" 10:23
El_Che Nemokosch: with Perl family background etc, let's say the eye of the beholder applies :) 10:38
tellable6 El_Che, I'll pass your message to Nemokosch
ugexe Go is kind of fun to me, because the tooling around it makes you feel powerful 11:50
at least until i reach some code that i need to test through multiple levels of abstractions, then i want to die 11:52
im also jealous their standard library has a https client and tar client 11:56
El_Che ugexe: lol :) 12:52
true dat, the abstraction thing
uzl[m] stackoverflow.blog/2023/05/08/the-...-now-live/ 12:56
Yup that was me lol. I tried to resurface it haha 12:57
lizmat note that the survey lists Raku as a language! 12:58
uzl[m] Yes, it does!!! 13:02
sjn submitted in the survey, making sure to mention Comma as an editor :-) 13:22
lizmat as did I :-) 13:31
tbrowder__ uh, for retired folks, better check former professional or hobbyist. if you select other it says goodbye, no do overs or back button 14:02
lizmat meh 14:14
Voldenet El_Che: golang is not fun because it doesn't let me construct things that are impossible to debug 14:29
tonyo could merge tar from fez in to core 14:34
ugexe to be more clear: go has tar + gz extraction in core 15:14
tonyo i have a BST index persisting to a file that could speed up the module resolution 15:16
ugexe i'm not sure we can speed up module resolution for the core. the goal with the core at least is to get close enough to our current resolution speed that its a reasonable tradeoff for the potential features / easy-of-use it enables 15:21
it can speed up module resolution for something like zef though 15:22
tonyo does module resolution just hash the X in `use X`? i thought it still had to go through resolution in core 15:25
ugexe speed it up eventually anyway... at the current ecosystem sizes zef is pretty fast at that
basically yeah basically it can hash the name and then use that hash to lookup a small subset of meta data in a file name using that hash 15:26
so it does not usually need to read or parse the json for whatever distributions 15:27
tonyo guessing that takes first available then
ugexe the hash that is generated involves a file that contains the meta data subset for all dists matching that short-name 15:28
ugexe the thing is, its all incredibly confusing even though it really isnt 15:32
so if the performance was close enough, it might be worth using it in the core to make that area of code more accessible
tonyo ah i see 15:34
once you have an index file it's pretty quick 15:35
indexing the current fez eco takes less than a second
here's the timings for searching through an index file vs searching through the BST in memory: 15:36
empty: 0.144 wallclock secs (0.130 usr 0.016 sys 0.146 cpu) @ 69433.836/s (n=10000)
empty-file: 1.342 wallclock secs (1.081 usr 0.284 sys 1.365 cpu) @ 7448.867/s (n=10000)
not-empty: 0.124 wallclock secs (0.109 usr 0.015 sys 0.124 cpu) @ 80942.822/s (n=10000)
not-empty-file: 1.111 wallclock secs (0.825 usr 0.284 sys 1.110 cpu) @ 8999.896/s (n=10000)
ugexe i dunno what that would mean in the real world. for instance any increase for `raku -e ''` would be unacceptable, and an increase in like 0.2+ for `raku -e 'use Some::Module'` would probably be too much as well 15:37
tonyo empty is an exhaustive search, not-empty finds one that is pretty well buried in the tree
well, it's .124 seconds for all 10000 searches, so it's resolving in .0000124s 15:38
ugexe i wonder if there is a way to avoid parsing even the entire namespaces part
tonyo what do you mean
ugexe for instance if the index was sorted a certain way then it can stop searching once it finds the first match 15:39
tonyo it is a sorted tree
if the root node is Green, and it's right is empty, you're looking for Text::CSV, it'll halt after the first node
for it to be useful in zef it needs to be able to do an exhaustive search for partials, no? 15:40
ugexe partial as in the short name (`zef search Foo::`)? that can just use a slow path 15:43
tonyo it's difficult to know, though which to use..if someone does `zef se Fo` that should tell you Foo also exists 15:45
?
ugexe `zef search Foo` isnt an important command and thus its fine to be slow. inside of zef itself it is easy to know if the search needs to do an exact search or not because a parameter :$strict is passed in github.com/ugexe/zef/blob/710034fe...C5-L146C32 15:47
tonyo got it
where do you want me to put this bst? 15:48
ugexe `zef install Foo` (and the dependency lookups) use strict = true, `zef search Foo` uses strict = false
tonyo it'd be easy enough to add a partial search to this tree too, btw - it's pretty quick 15:49
ugexe no idea. inside of zef it would be implementing a Repository like lib/Zef/Repository/Ecosystems.rakumod
and adding the appropriate config to resources/config.json, and probably disabling lib/Zef/Repository/Ecosystems.rakumod in the config 15:50
tonyo i'll take a look after implementing a non-strict search 15:51
fez could just provide the index file as well, rather than the huge json blob
ugexe right 16:09
tonyo the exhaustive partial returns in 1/90th of a second 16:13
running these benchmarks against the entire fez meta index 16:14
gfldex m: role R[T] { method ::(T.^name)() { $.value } } 20:01
camelia ===SORRY!=== Error while compiling <tmp>
Invalid typename 'T' in parameter declaration.
at <tmp>:1
------> role R[T⏏] { method ::(T.^name)() { $.value } }
gfldex m: role R[::T] { method ::(T.^name)() { $.value } }
camelia ===SORRY!===
Name ::(T.^name) is not compile-time known, and can not serve as a method name
gfldex Is there any way to make that work. The MOP is not helpful because ParametricRole doesn't sport .^add_method. 20:02
tonyo m: role R[::T] { has $.value; submethod TWEAK(|) { self.^add_method(T.^name, sub (\self) { self.value; }); }; }; R[Int].new(value=>5).Int.say 20:27
camelia 5
tonyo gfldex: ^ 20:28
m: role R[::T] { has T $.value; submethod TWEAK(|) { self.^add_method(T.^name, sub (\self) { self.value; }); }; }; R[Int].new(value=>5).Int.say; R[Str].new(value=>"test").Str.say R[Str].new(value=>'str').Int.say; 20:32
camelia ===SORRY!=== Error while compiling <tmp>
Missing infix inside S
at <tmp>:1
------> ; R[Str].new(value=>"test").Str.say R[S⏏tr].new(value=>'str').Int.say;
expecting any of:
bracketed infix
infix
tonyo works as expected with the param
m: role R[::T] { has T $.value; submethod TWEAK(|) { self.^add_method(T.^name, sub (\self) { self.value; }); }; }; R[Int].new(value=>5).Int.say; R[Str].new(value=>"test").Str.say; R[Str].new(value=>'str').Int.say;
camelia 5
Package 'R[Str]' already has a sub 'Str' (did you mean to declare a multi method?)
in submethod TWEAK at <tmp> line 1
in block <unit> at <tmp> line 1

test
tonyo oop, guess you need to check for it first
gfldex tonyo: thanks, I ended doing something similar in COERCE and got odd results. Didn't think of TWEAK. 20:33
My version solves that, blog post incomming. 20:34
I'm messing with .^method_table . And yes, I'm doing something really wild. :-> 20:35
tonyo the orm i wrote in raku used it extensively, something was tweaked a few years ago and now it's just unusable but the mop is wild (in a cool way) 20:44
tonyo hmm..thinking about it that was 6 years ago 20:49
gfldex m: role R[::T] { method ::T() { T } }; my R[Str] \type; type.^method.say; 21:00
camelia ===SORRY!=== Error while compiling <tmp>
Term definition requires an initializer
at <tmp>:1
------> { method ::T() { T } }; my R[Str] \type⏏; type.^method.say;
gfldex m: role R[::T] { method ::T() { } }; my R[Str] \type; type.^method.say; 21:01
camelia ===SORRY!=== Error while compiling <tmp>
Term definition requires an initializer
at <tmp>:1
------> T] { method ::T() { } }; my R[Str] \type⏏; type.^method.say;
gfldex m: role R[::T] { method ::T() { } }; my R[Str] $type; $type.^method.say;
camelia No such method 'method' for invocant of type
'Perl6::Metamodel::CurriedRoleHOW'
in block <unit> at <tmp> line 1
gfldex m: role R[::T] { method ::T() { } }; my R[Str] $type; $type.^methods.say;
camelia No such method 'methods' for invocant of type
'Perl6::Metamodel::CurriedRoleHOW'
in block <unit> at <tmp> line 1
gfldex m: role R[::T] { method ::T() { } }; my $type = R[Str]; $type.^methods.say;
camelia No such method 'methods' for invocant of type
'Perl6::Metamodel::CurriedRoleHOW'
in block <unit> at <tmp> line 1
gfldex m: role R[::T] { method ::T() { } }; my $type = R[Str].new; $type.^methods.say; 21:02
camelia (T)
gfldex I think that should work.
tonyo m: role R[::T] { method ::T() { } }; my $type = R[Str].new; say $type.Str 21:08
camelia R[Str]<6229179804320>
Nemokosch well a method name is not a type object, that much is for sure 21:13
tonyo m: role R[::T] { method ::T() { } }; my $type = R[Int].new; say $type.Int 21:43
camelia Cannot resolve caller Int(R[Int]:D: ); none of these signatures matches:
(Mu:U \v: *%_)
in block <unit> at <tmp> line 1
tonyo yea that's a weird way for that to work 21:43
esp since that role can't be composed until T is of a known type