🦋 Welcome to Raku! raku.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: colabti.org/irclogger/irclogger_log/raku
Set by ChanServ on 14 October 2019.
00:05 markong left, rir joined
rir Hi all, In the comments of DBIish it states "There is a long term Rakudo based project to develop a new,# comprehensive DBI architecture for Rakudo and Perl 6.# DBIish is not that ..." Is 'that' somewhere? 00:13
00:20 leont left 00:21 MasterDuke left 00:29 wamba left 00:38 rir left, finanalyst left 00:57 __jrjsmrtn__ joined 00:59 _jrjsmrtn left, daxim left
guifa2 .tell rir Yes, the "that" is Red 01:05
tellable6 guifa2, and I oop! Backtrace: gist.github.com/27f6f6489f9c29ad49...a80afd93f2
AlexDaniel looks
guifa2 apologizes for breaking things
AlexDaniel it's not you I'm pretty sure 01:06
hmm
codesections I'm a bit confused about best practice around sigils. My general understanding was that `%` is the Associative sigil, and thus should (generally) be used for any class that does Associative (e.g., Hash, Set, Bag, etc)
guifa2 there's no way in a method call to replace self, right? 01:07
codesections (I'm not talking about what's required, just what best communicates intent/is clear)
but now I'm starting to wonder if `%` is really more the *Hash* sigil, and Sets etc. are best with `$` 01:08
The docs mostly show Sets with `$` and then, at the end, say «Finally, you can create Set masquerading as a hash by using the is trait: my %s is Set = <a b c>;» 01:09
guifa2 It's true that a lot of people use Sets/Bags/Hashes with scalars, although I never fully understand that practice
% = Hash[Str,Any] by default and obligatorily Associative; @ = Array[Any] by default and obligatorily Positional 01:10
AlexDaniel codesections: neither works well 01:11
guifa2 My guess is that conceptually, sets/bags/mixes kind of hover in the grey zone between being conceptually fully associative and fully scalar
codesections Yeah, I understand that rule. I guess I'm wondering if, given that I have a Set, would the name `%name` confuse readers into thinking it was a Hash? Or would the name `$name` confuse readers into thinking it's a non-Associative scalar? 01:12
principle of least surprise, and all of that.
guifa2 that's where I'd use variable naming to clear it up 01:13
01:13 aborazmeh joined, aborazmeh left, aborazmeh joined 01:14 Altai-man_ joined
guifa2 still thinks it would be possible to add new sigils. Like ƒ for a IOs or something 01:14
codesections hmmm, I *generally* think of adding type info to variable names as a bit of a code smell. (`let people-array = ['bob', 'jo']` doesn't feel great in other languages) 01:15
(Not quite sure what other language I had in mind there, with the odd combination of syntax and kebab case, but whatever) 01:16
01:16 sena_kun left
AlexDaniel last time I used sets in raku I regretted it a lot. No longer remember the details, just that it was so clunky that I wished I just used hashes instead. 01:16
I did use $ though, maybe that is related 01:17
codesections AlexDaniel, I'm kind of feeling that way too. But I'm new enough to Raku that I'm assuming the problem is on my end :D
AlexDaniel I did that too, yeah 01:18
guifa2 codesections: you don't need to do it via literal ones
but like
%ingredientes 01:19
ingredients*
lol
for a weighted recipe
AlexDaniel guifa2: weighted? Did you want a bag or a mix?
or maybe a BagHash or a MixHash?
guifa2 yeah, the naming issues are a big problem with them 01:20
codesections Yeah, maybe for Bags. But a Set has very similar semantics to a Hash
guifa2 the Bag vs Mix feels very … arbitrary
codesections And a Map even more so, since it's literally just an immutable Hash 01:21
guifa2 I think using Mix with Numeric might have made a bit more sense, but I'd have to look back at the original rationales for why the two were made separate
Don't forget we have Tuples now too :-) lizmat++
AlexDaniel Tuples?
I hope not? 01:22
m: say Tuple 01:23
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared name:
Tuple used at line 1
guifa2 github.com/lizmat/Tuple
github.com/Raku/problem-solving/issues/135 01:25
Basically, allow for a value type listy/hashy thing
Value typing is something I need to look into for LanguageTag, one of my pending things. Right now you can create a set that includes 10 'en' language tags, because they have unique WHICH 01:26
codesections (this is the sort of thing that makes me feel like `%` and Sets don't get along: 01:27
m: my %s is Set = Set.new(<a b c>); say %s.WHAT # looks good 01:28
camelia (Set)
codesections m: my %s is Set = Set.new(<a b c>); dd %s # isn't good
camelia Set.new(Set.new("c","a","b"))
01:34 daxim joined
AlexDaniel hmm tellable6 sorta trashed itself a bit… restoring from a backup… 01:34
codesections or, even worse/less obvious (at least to me): 01:35
m: my %s is Set = (1, 2, 3) (-) (2,); dd %s
camelia Set.new(Set.new(1,3))
guifa2 Yeah, they don't play nicely with list assignment 01:36
but that feels more buggy to me that anything else
m: my @a is Array = Array.new: 1,2,3,4; say @a 01:37
camelia [1 2 3 4]
guifa2 because Arrays work okay there (I think on the single argument principle) 01:38
That set example is probably a bad artifact left over from the great list refactor I'd bet
codesections Maybe. But I guess that's part of why I was asking about style/best practice. If most people use $ for Sets, then odd/buggy behavior with %sets is probably a low priority 01:39
AlexDaniel well, what isn't 01:40
codesections Which is the sense I'm getting – I think I should mostly label `%` as the Hash sigil in my head, and not have any assumption that a $-sigiled variable is a (true) scalar 01:41
guifa2 I just ran a random roundtirp test with a few thousand POSIX times and a dozen or so timezones. Victory is mine. I might even get my sonic screwdriver now
codesections Congrats :)
guifa2 scalar just means "holds a value" and nothing more. Really @ and % are just special short hands for the two most common data structures (I mean, there's a bit more to it, but that's a decent sumary) 01:42
AlexDaniel that's a good summary 01:43
codesections yeah, I know. That's what my "(true)" was about. I know that's what "scalar" means in the Raku context, and I just should forget/set aside what in means in math/other contexts
AlexDaniel Set aside :) 01:44
codesections :)
guifa2 this isn't too snarky for a test file comment is it? 01:46
# Reference POSIX time: 1599310800 (when the author was *supposed* to walk across a stage to get his doctorate, but COVID-19)
01:47 molaf left
AlexDaniel it's perfect :) 01:47
guifa2 I need to start doing the write up for this DateTime extension though
codesections Just snarky enough :) 01:48
guifa2 There's a lot of cool stuff I'm taking advantage of to make it work without preventing precompilation and not needing MONKEY-TYPING
Which means that everything is fully compatible with every other module and all extant code too :D :D :D 01:49
guifa2 . o O ( unless someone does something weird like DateTime.new(now).timezone.Str.Numeric )
is the github user jforget on IRC ever? 01:50
AlexDaniel guifa2: we could've used the bot to figure it out, but I'm still fixing it…
guifa2 some people have different names (I'm alabamenhu on github because someone squatted my name grrrr) 01:51
even worse, I'm tenesianu on on blogspot because someone squatted BOTH alabamenhu AND guifa grrr xx 2
01:56 aborazmeh left 01:58 molaf joined 01:59 gnufr33dom joined 02:05 Manifest0 left 02:06 Manifest0 joined
codesections Wait, how does this typecheck successfully? 02:15
my Map $m := Hash.new('key', 0); $m.WHAT
timotimo m: say Hash ~~ Map
camelia True
codesections …Why?! 02:16
AlexDaniel m: my Cool $m := Hash.new('key', 0); $m.WHAT
camelia ( no output )
AlexDaniel m: my Cool $m := Hash.new('key', 0); say $m.WHAT
camelia (Hash)
AlexDaniel codesections: docs.raku.org/type/Hash#Type_Graph
codesections not mechanically, I get that it's because of ACCEPTS
That seems … odd. The directionality of that type graph suggests that Hashes are a type of Map. But that's not really the case in Raku: Maps are a subset of Hashes – of the immutable variety 02:21
Compare docs.raku.org/type/Real#Type_Graph which makes much more sense, semantically
So, if I want to guarantee that a Hash-like thing is actually immutable, what do I do? Clearly `my Map $foo` won't cut it. 02:23
02:23 Chi1thangoo joined
codesections m: say Hash.isa('Map') # Grrr 02:24
camelia True
guifa2 There must be some kind of special foo going on in the background
because 02:25
m: class A {}; class B is A {}; my B $b = A.new; 02:26
camelia Type check failed in assignment to $b; expected B but got A (A.new)
in block <unit> at <tmp> line 1
guifa2 m: class A {}; class B is A {}; my B $b := A.new;
camelia Type check failed in binding; expected B but got A (A.new)
in block <unit> at <tmp> line 1
02:28 zacts left
codesections isn't that just the other direction? 02:35
m: class A {}; class B is A {}; my A $a = B.new;
camelia ( no output )
cpan-raku New module released to CPAN! Abbreviations (0.3.0) by 03TBROWDER 02:41
guifa2 It's the same relationship between Hash and Map. Map (B) is a Hash (A)
codesections No, that's the problem. That's how it *should* be, semantically. But Hash is a Map! 02:43
That's what AlexDaniel was pointing out with the type graph
guifa2 oh, I misread the graph 02:44
nm me lol
timotimo what was the problem right now?
AlexDaniel oh, so you're saying that Map should be an immutable Hash instead of Hash being a mutable Map?
codesections yeah
timotimo any hash is an acceptable map, because whatever you can do with a map, you can do with a hash
AlexDaniel timotimo: yeah, that makes sense. What about Set and SetHash though? 02:46
codesections But that's not how other types work. A SetHash isn't a Set, a Rat isn't an Int
timotimo for those we have Real, the equivalent is Associative 02:47
02:47 toppo joined
codesections Well, the practical point of using a Map (instead of a Hash) is that the user wants a guarantee of immutability, right? Doesn't that kind of disappear if Hashes typecheck as Maps? 02:48
AlexDaniel hah. Interesting point 02:49
codesections Like you said, "whatever you can do with a Map, you can do with a Hash" – the whole point of using a Map is to place limits on yourself, and get the typechecker to enforce those limits
guifa2 The problem is as someone (I think you) had mentioned a while back, the question is whether conceptually it's that a Hash is a mutable map, or a map is an immutable Hash
I guess you could also do something like 02:50
AlexDaniel codesections: but what if I want to mutate whatever I get, then I want to make sure that it's mutable, so I typecheck for Hash and Maps won't pass through
02:50 toppo left
codesections I can see arguments either way, conceptually. But I still want the typechecker guaranteeing immutablilty :D 02:51
02:51 toppo joined
codesections It seems like the Setty/SetHash/Set setup solves that? A Set hash isn't a Set and a Set isn't a SetHash 02:51
Composition over inheritance, right? 02:52
guifa2 subset FrozenMap of Map where *.WHAT === Map;
:-)
[Coke] spends 2 hours setting up a universal remote control, and wonders how long it will take to recoup that time. 02:53
AlexDaniel [Coke]: you're assuming that it will keep working and won't require maintenance :) 02:54
the joy of having things working the way you need is priceless though
[Coke] (maintenance) AIIIGH 03:01
[Coke] ponders combining www.youtube.com/watch?v=LYKn0yUTIU4 with Lingua::Number for some homework. 03:02
timotimo liskov substitution principle says if "map is a hash plus immutable", then you can typecheck-pass a Map where a Hash is expected and the code will blow if/because it expected to mutate it 03:03
AlexDaniel hmm
tellable6: seen AlexDaniel
tellable6 AlexDaniel, I saw AlexDaniel 2020-08-07T03:03:50Z in #raku: <AlexDaniel> hmm
AlexDaniel guifa2: it's mostly restored now 03:04
guifa2 [Coke]: how about add some RBNF support for Intl:: ;-) 03:05
03:07 epony left
guifa2 (I'm not kidding btw, I've been needing to get on that at some point but DateTime took priority) 03:11
[Coke] ugh, lingua::number's borked. 03:15
I have no love for RBNF, so, no thanks. :) 03:16
guifa2 Yeah I'm not looking forward to it 03:18
03:20 lucasb left 03:33 toppo left, toppo joined 03:36 epony joined 03:47 rir joined, rir left 03:48 rir joined
guifa2 hello rir 03:52
You asked before about DBIsh 03:53
The insanely awesmoe and comprehensive module that's been made to handle things is called Red
timotimo isn't that more or less closer to what the DBIx namespace covers? 03:55
guifa2 timotimo: I admit I haven't used it (although I will soon for a new project), but I have heard very good things about it 03:58
rir That was my impression, timotimo. At first look I thought it interesting but wanted something close to DBI. I'm just getting a bit serious with Raku so have enough to learn without ORMing now. 04:00
timotimo there's a good postgres module, but DBI is of course about accessing all databases with a common interface
rir I am having a problem with DBIish. I want to delegate to what is commonly named $dbh but am stumbling over where the Connect type is coming from. 04:02
What is the Postgres module?
timotimo i think Db::Pg or so? DB::PG? DB::Pg? 04:05
$dbh will be what the common "create a connection" sub will give you
it's the "database handle" if that wasn't clear
maybe if it isn't clear the docs should explain that prominently 04:06
my $dbh = DBIish.connect("SQLite", :database<example-db.sqlite3>, :RaiseError);
rir Yes, I understand that but WHAT it is is a Connection which isn't declared anywhere that I find. 04:07
04:07 rir left
timotimo may have to call .^long_name or what it is to get it to also say what package it's from 04:08
04:10 rir joined
rir ^ s/Connection/Connect/ 04:10
timotimo there are multiple
each database has one
github.com/abraxxa/DBIish/blob/mas...ection.pm6 Postgres 04:11
github.com/abraxxa/DBIish/blob/mas...ection.pm6 sqlite
etc
04:14 sena_kun joined 04:16 Altai-man_ left
rir timotimo, I don't find long_name anywhere, but the error gives me DBDish::Pg::Connection. I'm should I tried that, but being tired I can't say that I use-d it, That was naive I guess. Good localtime to you, good night for me. Thanks. 04:28
04:38 toppo left, toppo joined 04:47 toppo left 04:48 toppo joined
guifa2 jjmerelo: lizmat: I just did a write up on my DateTime work, but not sure if it would be best to hold off and make it an advent article. It goes over dynamic vars, wrapping, dispatch control, and paramterized roles, so it feels like one of those show-offy advent ones 05:03
( gist.github.com/alabamenhu/d9a4652...ef78928bac for preview )
05:14 cpan-raku left 05:15 cpan-raku joined, cpan-raku left, cpan-raku joined 05:32 vike left 05:52 bocaneri joined 06:14 Altai-man_ joined, wamba joined 06:16 sena_kun left 06:18 toppo left 06:22 skids left 06:40 cgfbee left 06:59 molaf left 07:06 Manifest0 left 07:09 Manifest0 joined 07:24 vike joined 07:38 ab5tract joined 07:49 leont joined 07:56 ensamvarg left 07:58 oddp joined 07:59 ensamvarg joined, patrickb joined 08:33 JJMerelo joined 08:47 rindolf joined 09:00 JJMerelo left
moon-child how should I interpret this error? 'No exception handler located for catch', followed by a traceback 09:04
ab5tract .tell JJMerelo so the good news is that my last few days have been deeply steeped in rational numbers. just need to get it all down now :)
tellable6 ab5tract, I'll pass your message to JJMerelo
moon-child only line of my code in the traceback is a write to a Proc::Async
possibly the problem is I'm writing concurrently from multiple threads? 09:05
09:05 synthmeat left 09:07 synthmeat joined
ab5tract .tell JJMerelo working on examples that use Hilbert matrices for demonstration purposes, inspired by a great presentation by Roger Hui on (still as of yet unreleased today) rational numbers in Dyalog APL: www.youtube.com/watch?v=CkaQQYcxpfM 09:09
tellable6 ab5tract, I'll pass your message to JJMerelo
09:14 Altai-man joined
oddp m: say "ay".succ.succ.succ 09:16
camelia bb
oddp Okay, but isn't this a bit unexpected?
m: ("ay".."bb").elems
camelia ( no output )
oddp m: say ("ay".."bb").elems
camelia 48
09:16 Altai-man_ left
oddp m: say ("ay".."bb").head(10) 09:17
camelia (ay ax aw av au at as ar aq ap)
moon-child mm: say "ay".succ, "ay".succ.succ, "ay".succ.succ.succ
m: say "ay".succ, "ay".succ.succ, "ay".succ.succ.succ
camelia azbabb
moon-child hmm
sjn that's odd, yeah
moon-child m: say "ay".succ, " ", "ay".succ.succ, ' ', "ay".succ.succ.succ
camelia az ba bb
moon-child oh, here's something even weirder 09:18
sjn I'd assume "ay".."bb" didn't count down
moon-child m: say 'z'.succ
camelia aa
ab5tract moon-child, what's wrong with that?
oddp Yeah, that's expected. Same as in ruby.
sjn 'z'.succ should be 'aa'; that's as expected
same in perl6
same in perl5* 09:19
moon-child hmmm
ab5tract oddp, ah, I see what you mean there
oddp Ruby gives me 4 elems for that range.
sjn file a bugreport :-D
ab5tract yeah and as demonstrated by moon-child++ that the explicit calls for the successor work as expected 09:20
m: say ^15.head(4)
camelia Potential difficulties:
Precedence of ^ is looser than method call; please parenthesize
at <tmp>:1
------> 3say ^157⏏5.head(4)
^1
ab5tract m: say ^15 .head(4)
camelia (0 1 2 3)
ab5tract m: say ^"bb" .head(10) 09:21
camelia Cannot convert string to number: base-10 number must begin with valid digits or '.' in '3⏏5bb' (indicated by ⏏)
in block <unit> at <tmp> line 1
ab5tract ok, that's quite fair camelia :) 09:22
m: "a".."bb".head(10).say
camelia WARNINGS for <tmp>:
(bb)
Useless use of ".." in expression "\"a\"..\"bb\".head(10).say" in sink context (line 1)
ab5tract m: "aa".."bb".head(10).say
camelia WARNINGS for <tmp>:
(bb)
Useless use of ".." in expression "\"aa\"..\"bb\".head(10).say" in sink context (line 1)
ab5tract m: say "aa".."bb".head(10)
camelia Seq objects are not valid endpoints for Ranges
in block <unit> at <tmp> line 1
ab5tract m: say "aa".."bb" .head(10)
camelia Seq objects are not valid endpoints for Ranges
in block <unit> at <tmp> line 1
ab5tract m: say ("aa".."bb").head(10) 09:23
camelia (aa ab ba bb)
ab5tract :S
I guess the heuristic is a cross-product of the endpoints
09:23 xinming left 09:24 xinming joined
ab5tract or, rather, the inner product? I need remedial math for a reason and I'm working on it (and will write about it to explain at some point) 09:24
oddp m: ("11".."22").head(10).say 09:25
camelia (11 12 21 22)
ab5tract definitely not the outer product
oddp Okay, I see. Thanks for the input, everyone!
ab5tract cross product of individual elements of the string? 09:26
m: say ("pretty".."cool").tail(20)
camelia ()
ab5tract m: say ("tt".."zz").tail(20)
camelia (xu xv xw xx xy xz yt yu yv yw yx yy yz zt zu zv zw zx zy zz)
ab5tract m: say ("tt".."zz").head(20) 09:27
camelia (tt tu tv tw tx ty tz ut uu uv uw ux uy uz vt vu vv vw vx vy)
moon-child m: say ("cool".."pret").tail(20)
camelia (prgs prgt prfl prfm prfn prfo prfp prfq prfr prfs prft prel prem pren preo prep preq prer pres pret)
ab5tract m: say ("tt".."vv").head(20)
camelia (tt tu tv ut uu uv vt vu vv)
ab5tract m: say ("tt".comb Z "vv".comb).head(20) 09:28
camelia ((t v) (t v))
ab5tract m: say ("tt".comb X "vv".comb).head(20)
camelia ((t v) (t v) (t v) (t v))
ab5tract m: say ((|"tt".comb) X (|"vv".comb)).head(20) 09:29
camelia ((t t v v))
ab5tract m: say ((|"tt".comb) X~ (|"vv".comb)).head(20)
camelia (ttvv)
ab5tract ok I will go to my own repl now :)
09:33 JJMerelo joined 09:40 Black_Ribbon joined 09:44 Black_Ribbon left 09:48 finanalyst joined 09:51 dolmen joined 10:02 Sgeo left
Kaiepi m: my Int:D $obj = 1; say role ::[Mu ::T] { has T $.obj; method type-of-obj(::?CLASS:D: --> Mu) { T } }[$obj].new(:$obj).type-of-obj 10:08
camelia Could not instantiate role '<anon|1>':
Too few positionals passed; expected 2 arguments but got 1
in any protect at gen/moar/stage2/NQPCORE.setting line 1216
in block <unit> at <tmp> line 1
Kaiepi m: my Int:D $obj = 1; role Foo[Mu ::T] { has T $.obj; method type-of-obj(::?CLASS:D: --> Mu) { T } }; say Foo[$obj].new(:$obj).type-of-obj 10:09
camelia (Int)
Kaiepi m: my Int:D $obj = 1; say class { has Mu $.obj; method type-of-obj(::?CLASS:D (::T :obj($)!): --> Mu) { T } }.new(:$obj).type-of-obj
camelia (Int)
Kaiepi m: my Str:D $obj = "a"; say class { has Mu $.obj; method type-of-obj(::?CLASS:D (::T :obj($)!): --> Mu) { T } }.new(:$obj).type-of-obj 10:10
camelia (Str)
Kaiepi interesting way to avoid type parameters in some cases 10:11
10:22 markong joined
tbrowder ah, a good Raku day to all! 10:26
i've finally discovered the joy of using App::Mi6: 10:27
and "release early, release often!"
10:28 markong left 10:29 markoong joined
JJMerelo tbrowder congrats! 10:35
10:35 pecastro joined
cpan-raku New module released to CPAN! Abbreviations (0.3.1) by 03TBROWDER 10:36
10:36 m_athias left 10:37 ribasushi left
tbrowder thnx, but i just saw an artifact in my generated readme that i'm trying to find the source of. it may be an mi6ism. going to tweak and release again. 10:38
10:39 moony left 10:40 moony joined 10:41 pecastro left, ribasushi joined 10:44 finanalyst left
tbrowder the "artifact" was produced by mi6 capturing some pod trailing declaration and showing at the end of the readme as a class Mu. 10:47
in my module i have the begin/end pod at the top of the file. i wonder if moving it to the bottom would change that behavior. 10:48
10:49 xinming left
tbrowder speaking of pod, i can't find p6doc nor rakupod on my machine!! 10:49
*or 10:50
10:51 xinming joined
tbrowder ach, re mi6, all i need do for now is put pod i want in the readme in its own file and name it in the dist.ini file or remove the trailing docs. with some published mi6 conventions mi6 could just extract the first chunk and leave all below the first chunk alone. 11:01
all pod below the first begin/end pod block. 11:02
11:05 holyghost left
cpan-raku New module released to CPAN! Abbreviations (0.3.2) by 03TBROWDER 11:06
11:14 sena_kun joined 11:16 Altai-man left 11:17 wamba left 11:18 wamba joined 11:33 JJMerelo left 11:50 fluca1978 left 11:55 Voldenet left 11:58 demostanis joined
demostanis Hello guys! I've been improving my code for my little project: github.com/demostanis/hubtodate I was wondering, where could I find people up to contribute? Should I publish it to p6c? 11:59
sena_kun demostanis, people who contribute are usually actual software users who have some free time. 12:03
demostanis Yeah, but where can I find people to use my software 12:06
?
sena_kun I am afraid there is no crowd of people who have nothing to do and waiting for projects to work on. It is usually people who have lots on their shoulders already and they contribute their time if they find it interesting or worthy in some way. 12:08
You can ask people who usually are here for help with some code, because some here enjoy helping out others and playing with code examples. 12:09
jnthn demostanis: Publishing it to p6c would probably make it easier for at least other Raku users to install and try out. 12:14
sena_kun Oh, if you are asking about using: well, there are various ways to promote things. Posting about it on SNS, writing blog posts, rakudo weekly etc. If it is nice, people will use it. 12:16
rockxloose A mention on HN will get you eyeballs. 12:23
tbrowder HN? 12:35
sena_kun HackerNews, news.ycombinator.com/ 12:37
tbrowder ah, another multiuse acro, thnx 12:39
rockxloose Eight doublings from one gets you 100 users. 12:42
demostanis I'll probably write up some stuff and publish it on p6c on I exit from the beta phase 12:44
sena_kun: What's SNS 12:45
?
s/on/once
Fuck, I'm tired today...
12:48 zacts joined 12:49 stoned75 joined
sena_kun SNS == social network sites, yet another abbreviation I used without thinking. :S 12:52
demostanis, ^
12:52 zacts left 12:53 zacts joined 12:54 aborazmeh joined, aborazmeh left, aborazmeh joined 13:01 wamba1 joined, wamba left 13:14 Altai-man joined 13:16 sena_kun left 13:21 ab5tract left 13:30 lucasb joined 13:31 stoned75 left 13:33 stoned75 joined 13:42 ab5tract joined 13:44 aborazmeh left 13:55 stux|RC left 13:56 dolmen left
jdv79 guifa2 its not red 13:57
it was tim bunce's JDBC type thingee iirc 13:58
rir: ^
13:58 stux|RC joined
jdv79 and i think it might be dead - repo hasnt been touched in a decade... blog.timbunce.org/2010/07/16/java2...d-whereto/ 14:03
14:04 Voldenet joined, Voldenet left, Voldenet joined, patrickb left
[Coke] wonders if it's confusing that the REPL doesn't output the result of 'say 3', but does output the result of 'note 3' (since we're only tracking stdout) 14:07
Geth_ doc/xref-x-nyi: 6df01fab06 | (Stoned Elipot)++ | doc/Type/IO/CatHandle.pod6
xref X::NYI
14:11
doc: stoned++ created pull request #3551:
xref X::NYI
14:14 patrickb joined 14:17 patrickb left 14:21 zacts left
demostanis My code can't compile and exits with 'Died' and saying it's at the line 2 of a file, which contains an import... 14:26
Everywhere where my code as a 'die', a log should appear before, but it doesn't 14:27
Error while compiling: Died at ............pm6 (My::Package):@ 14:28
s/'@'/2
El_Che missing ';' at the end? 14:34
demostanis There's no such error 14:35
But I just realized before getting those errors that I was using the old version of my code...
My code sucked all the time and I didn't even realize 14:37
El_Che that sounds like all code :) 14:38
demostanis My code wasn't good* 14:39
Missing serialize REPR function for REPR MVMContext (BOOTContext) 14:40
What does this even mean?
14:42 zacts joined 14:45 wamba1 left
El_Che demostanis: old rakudo? 14:46
github.com/rakudo/rakudo/issues/2544 14:47
demostanis I'm using 2020.07 14:53
I'm lost 14:55
Altai-man demostanis, can you provide some of your code?
demostanis My code is at github.com/demostanis/hubtodate/tree/broken 14:58
I cannot only give some parts, I don't even know where the errors come from
To prevent the compilation from dying, one needs to remove ', &die' from hubtodate/lib/HubToDate/Log.pm6
Oh wait, I think it wasn't logging when dying because of the «» 15:01
Altai-man demostanis, what if you remove `&` from `&die`?
demostanis Removing the & from die calls die?
Altai-man Yes.
demostanis Why would I do that? 15:02
Altai-man & sigil before routine name allows to refer to it, not call it.
15:02 natrys joined
demostanis Yep, I don't want to call it, I want to refer it 15:02
Altai-man Hmmm. 15:03
demostanis, how can I run it to reproduce your error?
15:03 gnufr33dom left
demostanis I've made a script in ./scripts/run.sh to run it inside of a docker container 15:03
./scripts/run.sh build 15:04
Builds the docker container
./scripts/run.sh run
Runs the docker container
Importing HubToDate::Release only makes the process die
Using the REPL
And removing the &die in HubToDate::Log only produces the weird error Missing serialize REPR function for REPR MVMContext (BOOTContext) 15:06
15:10 MilkmanDan left
demostanis [!!!] Failed to parse configuration file! 15:10
===SORRY!=== Error while compiling:
Died
yy
Probably why it dies. Why isn't this logged if I only import HubToDate::Release? 15:11
I think it's because the parser won't allow only a comment 15:13
Thus making HubToDate::Config fail
and every other module depending on it 15:14
But it doesn't log the errors
15:14 sena_kun joined 15:16 Altai-man left 15:34 rir left
ab5tract I'm not sure I will ever understand why it can be so difficult to get a gist to have the file I want on top. anyway, here is the basis for what I hope will be a decent argument for Raku's decision to have Rat as the default fractional representation gist.github.com/ab5tract/3e25e4a2c...01a85b6993 15:35
tellable6 2020-08-07T09:36:46Z #raku-dev <JJMerelo> ab5tract amazing. Good luck.
15:36 rir joined
ab5tract .tell lichtkind I think there may be an uninintentional falling back to rational math when matrices of nums are involved in Math::Matrix? gist.github.com/ab5tract/3e25e4a2c...01a85b6993 15:38
tellable6 ab5tract, I'll pass your message to lichtkind
15:38 rir left
ab5tract .tell lichtkind a bit unfair for Num to be "wrong", but also slow at being so :) 15:40
tellable6 ab5tract, I'll pass your message to lichtkind
demostanis My code now dies with Died with X::TypeCheck::Assignment... How do I get more info about what's wrong?? 15:41
A CATCH literally doesn't change anything 15:42
ab5tract .tell JJMerelo check scrollback for a gist that I'll be using tomorrow to finally _write_ this thing instead of researching it :) ... that gist will be all for today tho, I expect 15:43
tellable6 ab5tract, I'll pass your message to JJMerelo 15:44
guifa2 demostanis: the topic of a CATCH block is the exception. But an assignment typecheck should be fairly easy to diagnose based on the line it occured at 15:48
15:49 zacts left
demostanis I checked, the wanted type was List:D, I replaced it by Array:D but the same error still happens at the same line 15:50
role A { has Array:D @.arr; submethod BUILD(:@!arr) {} }; A.new: arr => <hello world>; 15:51
When running into a REPL, it says arr is of type Str?? 15:52
%(arr => <hello world>){"arr"}.^name # OUTPUT: List 15:54
p6: role A { has Array:D @.arr; submethod BUILD(:@!arr) {} }; A.new: arr => <hello world>;
camelia Type check failed in assignment to @!arr; expected Array:D but got Str ("hello")
in submethod BUILD at <tmp> line 1
in block <unit> at <tmp> line 1
demostanis ^
sena_kun demostanis, `@` sigil implies Positional, typed as Array creates a Positional of Arrays. 15:56
m: role A { has @.arr; submethod BUILD(:@!arr) {} }; A.new: arr => <hello world>;
camelia ( no output )
sena_kun m: role A { has @.arr; submethod BUILD(:@!arr) {} }; say A.new: arr => <hello world>;
camelia A.new(arr => ["hello", "world"])
sena_kun m: role A { has Str @.arr; submethod BUILD(:@!arr) {} }; say A.new: arr => <hello world>;
camelia A.new(arr => Array[Str].new("hello", "world"))
16:01 Sgeo joined
demostanis Ohhh ok, thanks 16:01
Geth_ doc: 30dc5dddc6 | stoned++ (committed using GitHub Web editor) | doc/Type/IO/CatHandle.pod6
xref X::NYI (#3551)

Thanks!
linkable6 Link: docs.raku.org/type/IO::CatHandle
DOC#3551 [closed]: github.com/Raku/doc/pull/3551 xref X::NYI
16:03 ptrcmd left
Geth_ doc/xref-x-nyi: 6df01fab06 | (Stoned Elipot)++ | doc/Type/IO/CatHandle.pod6
xref X::NYI
16:07
demostanis I was still having the same error at the same line for some reason... I've found a way to finally get the full exception: X::TypeCheck::Assignment: Something went wrong in (Assignment) 16:15
What does the "Something went wrong" mean?
16:18 JJMerelo joined
demostanis There are so much errors. Howcome I didn't see I was using an older version of my code? 16:25
rypervenche Reading through moritz's Parsing with Perl 6 Regexes and Grammars... TIL token doesn't just match a single white space but rather uses <.ws>, which can even match a newline. 16:30
So if I only wanted to match a single white space in between each word, I would either hardcode ' ' between each word or change ws to only be \s instead of \s* ? 16:31
moritz careful, 'rule' implies <.ws>, 'token' does not 16:32
rypervenche: better to use \h for a single *horizontal* space
m: say so "\n" ~~ /\s/ 16:33
camelia True
rypervenche Ah yes.
I'd use \s if I also want to match vertical spacing, gotcha. 16:34
stoned75 hi JJMereloq 16:37
JJMerelo Hi! 16:40
tellable6 2020-08-07T15:44:03Z #raku <ab5tract> JJMerelo check scrollback for a gist that I'll be using tomorrow to finally _write_ this thing instead of researching it :) ... that gist will be all for today tho, I expect
JJMerelo .tell ab5tract you mean this one? gist.github.com/ab5tract/3e25e4a2c...01a85b6993 16:44
tellable6 JJMerelo, I'll pass your message to ab5tract
16:53 MilkmanDan joined, Celelibi joined
cpan-raku New module released to CPAN! Opt::Handler (0.0.1) by 03TBROWDER 16:58
17:00 skids joined 17:01 JJMerelo left 17:06 zacts joined
cpan-raku New module released to CPAN! Opt::Handler (0.0.2) by 03TBROWDER 17:14
demostanis How do I reference a class' method? Even when using &, it calls it... 17:32
&$object.method
17:33 ab5tract left 17:39 MilkmanDan left 17:40 cpan-raku left 17:53 natrys left 18:03 cpan-raku joined, cpan-raku left, cpan-raku joined
guifa2 $object.^find_method('foo') 18:08
or store it in a variable and
$object."$name"()
demostanis The first method seems to work, but then calling it throws an error because the first argument isn't $object 18:12
I have a big list of classes' methods: my @methods = $class1.^find_method('foo'), $class2.^find_method('bar'), ... 18:13
And I need to call all methods in @methods with as signature last method's return value
18:14 Altai-man joined
demostanis But as they return promises, I need to pass the $promise.result 18:14
guifa Yeah, remember method signatures by default require the object of that type
demostanis So how should I do it? 18:15
guifa it’d be rare for me to write a method signature as method (Any $foo: ) { }
demostanis my \curr = (); for @methods -> &method { curr = await method(curr); }
18:17 sena_kun left
guifa but are the methods for a list type object? 18:17
demostanis @methods is an array of references of classes' methods 18:18
guifa For which class? 18:21
Methods have to act on an invocant
demostanis class A { method a() { ... } }; class B { b() { ... } } 18:22
guifa you when you say method(curr), it’s equivalent to doing curr.&method
demostanis @methods is an array which should refer to A.a and B.b 18:23
guifa Right
But when you call method(curr), the invocant isn’t of type A or type B
it’s of type List
you’d need to say something like 18:24
method(A.new)
demostanis Oh yeah, but how can I make it be A or B?
Yes but..
Oh wait I explained wrong
I meant that @methods is an array with an instance of A (A.new) 's method a 18:25
same for B
sorry
guifa methods are identical though whether they’re attached to an instance or type object 18:26
when you say $a = A.new.^find_method(‘foo’), you get the same thing as A.^find_method(“foo”)
When you call it, you have to give it an object to act upon
demostanis So I need to remake the @methods array as @(A.new, 'foo'), @(B.new, 'bar') 18:27
guifa that’s one way potentially
demostanis and for each, call the first element's ^find_method with the second argument? 18:28
And call it with the second argument?
guifa if @methods were as you listed your loop would be
for @methods -> ($obj, $method-name) { curr = await $obj.^find_method($method-name)(curr) } 18:29
or more simply because of interpolation
for @methods -> ($obj, $method-name) { curr = await $obj.”$method-name”(curr) } 18:30
err
top one should be
for @methods -> ($obj, $method-name) { curr = await $obj.^find_method($method-name)($obj, curr) }
demostanis Ok thank you! 18:32
guifa You might think of methods as being (to use Java terminology) static members of a class 18:33
if that helps
rather than attributes of an instantiation
18:45 Dasein777 joined 18:46 MasterDuke joined 18:49 Don__ joined 19:02 Dasein777 left, Don__ left 19:04 zacts left 19:05 dolmen joined 19:12 finsternis joined 19:25 m_athias joined 19:35 molaf joined 19:39 guifa2 left 19:42 dolmen left 19:43 dolmen joined 19:49 lichtkind joined 19:52 dolmen left 20:02 wamba joined 20:07 MilkmanDan joined 20:14 sena_kun joined 20:16 zacts joined 20:17 Altai-man left 20:26 wamba left 20:44 Xliff joined
Xliff \o 20:44
Anyone here good at deciphering perl6-valgrind-m output? 20:45
Running into memory issues with my NativeCall code.
gist.github.com/Xliff/cc82f1361d2b...a4a1c41c22 20:48
After the 'Unicode Escape' section, there are 2 errors. I can't seem to get beyond the first, without running under valgrind. 20:49
I'd like to fix the second, but have no idea where to start. 20:50
MasterDuke Xliff: i don't know anything about nativecall, but did you compile your moarvm with --valgrind? sometimes that gives more info 20:51
Xliff Unfortunately, no.
What's the best way to do that using rakudobrew?
20:52 hvxgr left
MasterDuke i also don't use rakudobrew, but i think it's something like --rakudo-option='--moar-option="--valgrind"' 20:53
Xliff Thanks, will try.
MasterDuke you could search the irc logs for --moar-option, i remember someone showing how to do it with rakudobrew a (probably long) while ago 20:54
demostanis guifa: Sorry I was away. Thanks for the explanations, it helped me and I fixed most of the bugs. 20:57
However now, the promises are inside of a loop, and sometimes it seems like it's not waiting for the promise to end to continue the loop. 20:58
Thus passing wrong arguments to functions and failing. 20:59
Type check failed in binding to parameter '$archive'; expected Str but got "/usr/share/hubtodate...
20:59 wamba joined
demostanis And next time I run this command, the error comes back 21:00
It seems random
Or Too few positionals passed to 'download'; expected 2 arguments but got 1 21:01
21:02 hvxgr joined
demostanis How can I make sure the promise was kept before keeping on the loop? 21:05
MasterDuke are you `await`ing it? 21:08
Xliff MasterDuke: Thanks for your help. It turned out to be:
rakudobrew build moar-blead --configure-opts='--gen-moar --moar-option="--valgrind" --force-rebuild'
MasterDuke good to have it the logs more recently 21:09
demostanis I'm using .then() otherwise I don't know how to handle breaks 21:11
21:11 oddp left
Xliff Rakudo is crashing a lot around where this line is in valgrind output: --653123-- WARNING: unhandled amd64-linux syscall: 315 21:12
Anyone have any idea what that means?
21:13 oddp joined
MasterDuke bugs.kde.org/show_bug.cgi?id=369029#c14 might need to wait for an updated valgrind 21:16
Xliff Is there a reason why rakudo would crash in that particular place? 21:19
It's a flapper, so....
21:23 guifa2 joined
rypervenche How can I get the reverse numerical order for this? for %conversions.sort(*.values).kv 21:25
21:27 vike left
rypervenche I thought that using `.sort(-*.values)` might do it, but no luck, it's different every time. 21:27
jnthn Did you mean -*.value, since .sort gets pairs?
Also that .kv is probably not what you want either, since it'll be .kv on the list of pairs 21:28
[Coke] -*.value.Int , maybe?
... too slow
jnthn++
rypervenche Oh, right you are on both points. 21:29
guifa2 As much as having NativeCall can be awesome, the lack of pure Raku modules is making some basic stuff annoying 21:31
Namely… FTP download a tar.gz and expand it. 21:32
(I could use system calls, but I'm trying to keep it as OS independent as possible)
21:33 demostanis left
rypervenche Hmmm, how would I get access to the pairs' data like one would with a hash using .kv then? 21:33
21:35 vike joined
guifa2 %foo.map( -> ($k, $v) { ... } ) 21:35
err
%foo.kvmap( -> ($k, $v) { ... } )
guifa2 sighs
m: my %foo = :1a, :2b, :3c; %foo.kv.map( -> ($k, $v) { say " $k=$v; " } ) 21:36
camelia Cannot unpack or Capture `a`.
To create a Capture, add parentheses: \(...)
If unpacking in a signature, perhaps you needlessly used parentheses? -> ($x) {} vs. -> $x {}
or missed `:` in signature unpacking? -> &c:(Int) {}
in block <unit> at …
guifa2 m: my %foo = :1a, :2b, :3c; %foo.kv.map( -> $k, $v { say " $k=$v; " } ) 21:37
camelia b=2;
c=3;
a=1;
guifa2 there we go
21:39 markong joined 21:40 markoong left, zacts left 21:46 astronavt left 21:47 astronavt___ joined
rypervenche I'm looking for something like... 21:48
m: my %conv = I => 1, V => 5, X => 10, L => 50; say %conv.sort(-*.value).kv.map: -> $key, $value { say "$key: $value" };
camelia 0: L 50
1: X 10
2: V 5
3: I 1
(True True True True)
rypervenche m: my %conv = I => 1, V => 5, X => 10, L => 50; say %conv.sort(-*.value);
camelia (L => 50 X => 10 V => 5 I => 1)
rypervenche Not sure how to get that list of pairs to give me their key and value pairs so I can then use them in my for loop or map. 21:49
guifa2 But you did get them :-) 21:50
The (True True True True) is because you said the results of a say operation 21:51
rypervenche But $key here is the sort number, not the actual key of the pairs.
21:52 wamba left
rypervenche Oh! I left that say in there. 21:52
21:53 wamba joined
[Coke] so, the sort is giving you the pairs sorted. whare you trying to do after that?? 21:54
m: my %conv = I => 1, V => 5, X => 10, L => 50; dd %conv.sort(-*.value)
camelia (:L(50), :X(10), :V(5), :I(1)).Seq
guifa2 m: my %conv = I => 1, V => 5, X => 10, L => 50; %conv.sort(-*.value).map: -> (:$key, :$value) { say "$key: $value" }; 21:55
camelia L: 50
X: 10
V: 5
I: 1
rypervenche It looks like it works. I guess my extra "say" and the REPL outputting the (True True True True) were messing me up.
guifa2 deconstructing in the signature is the easiest way
but then you don't get the index (not sure if you wanted that or not, it sounded like you didn't)
rypervenche I didn't. I just wanted the correct order. 21:56
I'll have to read up on deconstruction.
guifa2 yup, that'll get it for you
rypervenche Thanks.
22:14 Altai-man joined 22:16 sena_kun left, guifa2 left 22:18 rindolf left
moon-child I want to split on newlines, but not inside of parentheses. Is there a good way of doing this without going character-by-character? 22:19
Xliff moon-child: Grammars 22:22
I don't think you can do that with a single split.
22:24 lichtkind left
guifa There’s gotta be a regex for it, but grammars would look much cleaner 22:33
Xliff guifa: Not without a mess of lookahead and lookbehind, I thnk. 22:35
guifa yeah exactly. And writing it might be sensitive to how split actually employs the regex 22:36
moon-child hmmm. I came up with 0x0.st/i3Vz.txt, but it errors
in '| <-[\n]> { @.lines[*-1] ~= $<ch> }', index '-1' out of range 22:37
guifa moon-child: tio.run/##TY9NTsMwEIXX9SmeQpFtfrxk...gbpS7FMI5/ 22:47
23:06 leont left 23:10 markong left, markong joined 23:17 wamba left 23:32 vike left 23:39 vike joined 23:51 MilkmanDan left