»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_log/perl6 | UTF-8 is our friend! 🦋
Set by Zoffix on 25 July 2018.
jnthn Kaiepi: You can't; a hash is unordered. You perhaps want modules.perl6.org/dist/ArrayHash:cpan:HANENKAMP 00:00
Kaiepi i can't use that for what i'm doing 00:01
00:03 zachk left
TreyHarris Kaiepi: Why not? What are you doing? 00:05
00:11 cpan-p6 left, cpan-p6 joined 00:14 RaycatWhoDat left
Kaiepi i'm writing a module for creating custom enums that can take a hash as an argument TreyHarris 00:18
i want to ensure the order of the pairs stays the same so it can match the behaviour of native enums
timotimo maybe you can change the api to take a list of pairs instead? or is that exactly what you don't want? 00:19
00:25 leont joined, cpan-p6 left, cpan-p6 joined
Kaiepi i'd rather avoid it if possible 00:28
00:30 Kaiepi left, Kaiepi joined
Kaiepi would it be possible to somehow coerce a hash to a list of pairs in the method's signature timotimo? 00:32
timotimo can't think of a way off-hand 00:34
i think unpacking syntax only likes attributes
m: my %foo = :1a, :2b; sub test-it($has (:$pairs)) { say $pairs.perl }; test-it %foo 00:35
camelia 2 unexpected named arguments passed (a,b) in sub-signature of parameter $has
in sub test-it at <tmp> line 1
in block <unit> at <tmp> line 1
timotimo ah, it implements its own .Capture, which makes a whole lot of sense
Kaiepi m: my %foo = :1a, :2b, :3c; sub foo(%foo is copy) { .say for %foo }; foo %foo 00:37
camelia b => 2
c => 3
a => 1
Kaiepi m: my %foo = :1a, :2b, :3c; sub foo(%foo is copy) { .say for %foo.sort }; foo %foo
camelia a => 1
b => 2
c => 3
Kaiepi ok maybe i could allow passing a sort callback to it 00:38
00:39 cpan-p6 left, cpan-p6 joined
ugexe seems like you could wire something up fairly simple using Associative role, AT|BIND|etc-KEY, and an array to remember the order new keys are added 00:46
timotimo does the default whence on the containers returned from a hash go through the "official" methods?
00:50 aborazmeh left 00:53 isomorphismes left 00:55 isomorphismes joined 01:01 cpan-p6 left 01:02 cpan-p6 joined
Kaiepi wdym ugexe? 01:12
timotimo Hash::Agnostic or something like that is a module in the ecosystem that'll make it easier to build your own custom hashes 01:14
01:16 rindolf left, cpan-p6 left, cpan-p6 joined
Kaiepi wait a second 01:21
m: my %foo = :1a, :2b, :3c; enum Foo (|%foo); say a.succ
camelia 5===SORRY!5===
Undeclared routine:
a used at line 1

Other potential difficulties:
No values supplied to enum (does |%foo need to be declared constant?)
at <tmp>:1
------> 3y %foo = :1a, :2b, :3c; enum Foo (|%foo)7…
Kaiepi m: enum Foo (|%(:1a, :2b, :3c)); say a.succ 01:23
camelia c
Kaiepi m: enum Foo (|%(:1a, :2b, :3c)); say a.succ
camelia a
Kaiepi m: enum Foo (|%(:1a, :2b, :3c)); say a.succ
camelia a
Kaiepi ok so i don't have to care about the hash values' order
01:34 lucasb left
Kaiepi what are the nqp serialization context ops for, and do i need to use them for my custom enum package the same way declaring enums normally does? 01:36
01:38 cpan-p6 left 01:39 cpan-p6 joined 02:02 dmaestro joined, cpan-p6 left, cpan-p6 joined
dmaestro m: say "foobaz" ~~ / foo <!before bar> /; 02:03
camelia 「foo」
dmaestro m: 'C' ~~ / \w <!before a..z> / 02:04
camelia ( no output )
dmaestro m: say 'C' ~~ / \w <!before a..z> /
camelia 「C」
dmaestro m: say 'C' ~~ / \w <!before \w> /
camelia Nil
dmaestro m: say 'C' ~~ / \w <!before <[a..z]> > / 02:05
camelia Nil
dmaestro Thought you could use any pattern in a 'before' zero-width assertion? What am I missing?
m: say 'C0' ~~ / \w <!before <[a..z]> > / 02:06
camelia 「C」
dmaestro m: say 'Cc' ~~ / \w <!before <[a..z]> > /
camelia Nil
dmaestro m: say 'Cc' ~~ / \w <before <[a..z]> > /
camelia 「C」
before => 「」
dmaestro m: say 'Cc' ~~ / \w <[a..z]> / 02:07
camelia 「Cc」
dmaestro m: say 'Cc' ~~ / \w <?before <[a..z]> > / 02:08
camelia 「C」
dmaestro m: say 'Cc' ~~ / \w <!before <[a..z]> > /
camelia Nil
dmaestro m: say 'C0' ~~ / \w <!before <[a..z]> > /
camelia 「C」
dmaestro m: say 'C' ~~ / \w <!before <[a..z]> > / 02:09
camelia Nil
dmaestro Why would that last one be a non-match ?? 02:10
02:10 netrino left 02:21 leont left 02:25 cpan-p6 left 02:26 cpan-p6 joined
vrurg dmaestro: because you need explicitly define $ in before. 02:32
m: say 'C' ~~ / \w <!before [<[a..z]> | $] > / 02:33
camelia Nil
vrurg oops, its !before. 02:35
02:50 cpan-p6 left, cpan-p6 joined 02:55 kurahaupo joined 03:04 cibs left 03:06 cibs joined 03:11 cpan-p6 left 03:12 cpan-p6 joined 03:21 ufobat_ joined
kybr is there a channel for Comma IDE? 03:24
03:25 ufobat__ left 03:26 RaycatWhoDat joined
RaycatWhoDat Hello again. 03:27
Is there an easy way to generate a sequence of the same character?
Of course, I can make a variable and concatenate but I was wondering if there was a more Perl-like way to do it. 03:28
ryanth m: say 'A' x 50; 03:32
camelia AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
RaycatWhoDat Oh. It's just that easy.
ryanth :-)
RaycatWhoDat Thanks, friendo.
03:33 cpan-p6 left, cpan-p6 joined 03:34 MilkmanDan left 03:36 MilkmanDan joined
ryanth And then if you want an array, you can use 'xx', like @a = 'A' xx 10; # @a = [A A A A A A A A A A] 03:36
RaycatWhoDat That's sick. 03:37
03:38 Black_Ribbon left, Black_Ribbon joined
RaycatWhoDat My God... 03:50
I started looking at my code the Perl way and so many lines were optimized
ryanth Yup, you can write C code in almost any language. :-) 03:51
RaycatWhoDat I went from 28 sloc to like, 10.
That's insane. And the code is still readable.
ryanth: I'm realizing that now. 03:52
03:55 cpan-p6 left 03:56 cpan-p6 joined 04:12 cpan-p6 left 04:14 kurahaupo left, kurahaupo joined 04:17 zacts joined 04:18 zacts left 04:45 RaycatWhoDat left 04:49 dominix joined 05:49 notable6 left, unicodable6 left, statisfiable6 left, evalable6 left, bisectable6 left, benchable6 left, greppable6 left, committable6 left, undersightable6 left, releasable6 left, nativecallable6 left, bloatable6 left, squashable6 left, reportable6 left, quotable6 left, coverable6 left, shareable6 left, committable6 joined, ChanServ sets mode: +v committable6, releasable6 joined, ChanServ sets mode: +v releasable6, bisectable6 joined 05:50 greppable6 joined, ChanServ sets mode: +v greppable6, benchable6 joined, unicodable6 joined, ChanServ sets mode: +v unicodable6, squashable6 joined, ChanServ sets mode: +v squashable6, notable6 joined, evalable6 joined, coverable6 joined 05:51 shareable6 joined 05:52 undersightable6 joined, ChanServ sets mode: +v undersightable6, quotable6 joined, bloatable6 joined, ChanServ sets mode: +v bloatable6 05:53 statisfiable6 joined, ChanServ sets mode: +v statisfiable6, nativecallable6 joined 05:54 reportable6 joined, ChanServ sets mode: +v reportable6 06:00 dominix left 06:21 molaf joined 07:10 mowotter left 07:36 jmerelo joined 07:38 epony left 07:42 grondilu joined
grondilu m: say [pi] ~~ Array[Real]; 07:42
camelia False
grondilu was expecting True here
m: subset Vector of Array where *.all ~~ Real; say [pi] ~~ Vector; 07:49
camelia False
grondilu m: subset Vector of Array where [&&] * >>~~>> Real; say [pi] ~~ Vector; 07:51
camelia True
grondilu m: subset Vector of Array where [&&] * >>~~>> Real; say [pi, 7] ~~ Vector;
camelia True
grondilu m: subset Vector of Array where [&&] * >>~~>> Real; say [pi, 7, "foo"] ~~ Vector;
camelia True
grondilu m: subset Vector of Array where -> $x { [&&] $x >>~~>> Real }; say [pi, 7] ~~ Vector; 07:54
camelia True
grondilu m: subset Vector of Array where -> $x { [&&] $x >>~~>> Real }; say [pi, 7, "foo"] ~~ Vector;
camelia True
grondilu m: subset Vector of Array where -> $x { [&&] @$x >>~~>> Real }; say [pi, 7, "foo"] ~~ Vector; 07:55
camelia False
grondilu m: subset Vector of Array where -> $x { [&&] @$x >>~~>> Real }; say [pi, 7] ~~ Vector;
camelia True
08:03 epony joined 08:12 holyghost left 08:13 holyghost joined 08:36 rindolf joined 08:37 rindolf left 08:38 molaf left 08:40 sena_kun joined
dmaestro vrurg: thanks for looking at that - so it's surprising to you, too? 08:46
08:46 rindolf joined
dmaestro m: say 'C' ~~ / \w [ <!before <[a..z]> > | $ ] / 08:48
camelia 「C」
dmaestro m: say 'Cc' ~~ / \w [ <!before <[a..z]> > | $ ] /
camelia 「c」
dmaestro m: say 'Cc' ~~ / \w <!before \w > / 08:50
camelia Nil
dmaestro m: say 'Cc' ~~ / :r \w <!before \w > / 08:51
camelia Nil
dmaestro m: say 'C ' ~~ / \w <!before \w > /
camelia 「C」
08:52 kurahaupo left 08:53 kurahaupo joined
dmaestro m: say 'C' ~~ / :r \w <!before c > / 08:53
camelia 「C」
dmaestro m: say 'C' ~~ / :r \w <!before <[ c ]> > / 08:54
camelia 「C」
dmaestro m: say 'C' ~~ / :r \w <!before <[ cd ]> > /
camelia 「C」
dmaestro m: say 'C' ~~ / :r \w <!before <[ \w ]> > /
camelia Nil
dmaestro m: say 'C' ~~ / \w <!before <[ cd ]> > / 08:55
camelia 「C」
08:55 grondilu left
dmaestro m: say 'C' ~~ / \w <!before <[ \w ]> > / 08:55
camelia Nil
dmaestro m: say 'C' ~~ / \w <!before \w > / 08:56
camelia Nil
dmaestro m: say 'C' ~~ / :r \w [ <!before \w > | $ ] / 08:57
camelia 「C」
dmaestro m: say 'C ' ~~ / :r \w [ <!before \w > | $ ] / 08:58
camelia 「C」
dmaestro m: say 'Cc' ~~ / :r \w [ <!before \w > | $ ] /
camelia 「c」
dmaestro m: say 'Cc' ~~ / :r <Lu> [ <!before \w > | $ ] / 08:59
camelia No such method 'Lu' for invocant of type 'Match'
in block <unit> at <tmp> line 1
dmaestro m: say 'Cc' ~~ / :r <:Lu> [ <!before \w > | $ ] /
camelia Nil
dmaestro m: say 'C0' ~~ / :r <:Lu> [ <!before \w > | $ ] /
camelia Nil
dmaestro m: 'C' ~~ / <:Lu> / 09:00
camelia ( no output )
dmaestro m: say 'C' ~~ / <:Lu> /
camelia 「C」
dmaestro m: say 'c' ~~ / <:Lu> /
camelia Nil
dmaestro m: say 'C0' ~~ / :r <:Lu> [ <!before <:Lu> > | $ ] / 09:02
camelia 「C」
dmaestro m: say 'C0' ~~ / <:Lu> <!before <:Lu> > /
camelia 「C」
dmaestro m: say 'C0' ~~ / <:Lu> <!before <:L> > / 09:03
camelia 「C」
dmaestro m: say 'C' ~~ / <:Lu> <!before <:L> > /
camelia 「C」
dmaestro Zero-width negative assertion works with simple patterns and property tests, but not with character classes when testing against end-of-string ... seems like a bug to me ... 09:06
timotimo sounds like you just won an all-expenses-paid trip to the source code of the regex compiler <3 09:17
just kidding, you don't have to, of course
09:18 Black_Ribbon left 09:33 zakharyas joined
dmaestro timotimo: There's a regex debugger somewhere isn't there? I'd like to see what it says about this ... 09:41
before filing an issue :-) 09:42
jmerelo dmaestro: there's a rakudo debugger, and a grammar debugger... I don't think there's a regex-only debugger. 09:48
dmaestro Where is the grammar debugger, do you know? 09:49
jmerelo dmaestro: you have to "use" a specific module. Let me see if I find it.
dmaestro: I think it's Grammar::Tracer
dmaestro: github.com/jnthn/grammar-debugger actually, two modules, one of them actually called Grammar::Debugger 09:50
dmaestro jmerelo: sounds like I could try that, thanks!
jmerelo dmaestro: sure :-)
09:53 netrino joined
timotimo there's not really enough of a difference between regex and grammar 10:09
10:09 MidCheck joined 10:17 zakharyas left 10:23 molaf joined 10:26 kurahaupo left, kurahaupo joined 10:54 kurahaupo left 10:58 zacts joined 10:59 pecastro joined 11:02 zacts left 11:10 kurahaupo joined 11:12 kurahaupo left 11:15 kurahaupo joined
jmerelo .seen cpan-p6 11:22
yoleaux I saw cpan-p6 23 Mar 2019 21:44Z in #perl6: <cpan-p6> New module released to CPAN! FindBin (0.2.0) by 03LEMBARK
11:28 holyghost left 11:31 molaf left 12:00 natrys joined 12:16 kurahaupo left, kurahaupo joined 12:17 Kaiepi left 12:18 Kaiepi joined 12:21 tadzik left 12:27 tadzik joined 12:46 sno left 12:47 leont joined 12:48 sno joined
jmerelo Just in case anyone's interested, here's a draft of the objectives of the redesign of the Perl documentation system: github.com/perl6/doc/wiki/Ultimate...on-tooling 13:02
Mainly for the Google Summer of Code prospects, but also, well, in general for everyone. 13:03
El_Che jmerelo: how is the GSC going? 13:04
I was fairly surprise Perl got accepted after all these years 13:05
jmerelo El_Che: well, we put together a good proposal, I guess
hahainternet i've grown so tired with python i'm back writing Perl 5 or 6 wherever I can 13:06
El_Che jmerelo's grant superpower
jmerelo El_Che: we have a few students interested, but actually I just know about the ones that are interested in the project ideas I have proposed. We won't know until it opens tomorrow
hahainternet need an inventory script for Ansible and I can't bring myself to write it in python again
and what else is there? Ruby? it's like a perl that had an accident
jmerelo hahainternet: use Sparrowdo
hahainternet: that's rich :-)
hahainternet jmerelo: with the greatest respect, i doubt sparrowdo has what i'm after either 13:07
El_Che hahainternet: I mostly try to stick with perl6 and go
hahainternet but as i did say respect, i'm going to go read :)
El_Che: yeah good choice imho, Go is what i'm trying to make my day job
can't wait till i can embed p6 in my Go code
El_Che depending on the exitence of modules and deployment strategy
hahainternet yeah sparrowdo reminds me of cfengine i think
but 'master host', 'target host', i'm not happy about that 13:08
El_Che I am probably more fluent in Go (it's a very small language), but perl 6 code is written way faster.
hahainternet with ansible, i can't encode the concept of 'a container in X'
El_Che certainly for smaller stuff
hahainternet every ansible target must be reachable over ssh, and if you want to disable facts you need to do that in a different place
it's tiresome, and El_Che Go is beautifully simple isn't it
it amuses me when people say they have to 'learn Go' because you learn it differently to everything else 13:09
most language tutorials try and carefully shove you into the right way to do things, wheras Go is mostly 'here is how you do all the common stuff, now read this page of tips and you're grand'
El_Che If you know some other languages (like C or Java) I don't think you learn much with Go
it's not revolutionary at all 13:10
hahainternet i think the principles of embedding and implicit interfaces are very valuable, but yeah as a language it's so basic it's wonderful
El_Che it's simple and handy
hahainternet anyway Python is dead to me after broken assigment expressions
El_Che some colleagues with a Ruby background have trouble with pointers
hahainternet that is a broken language and a broken process
El_Che I don't because I thinkg of Perl 5's references :) 13:11
jmerelo hahainternet: what's happened with assignment expression?
hahainternet jmerelo: it was introduced into the language
jmerelo: it is strictly against the zen of python
but it was introduced to avoid parsing ambiguity, because their parser is crap too
jmerelo hahainternet: link?
hahainternet it's hack on hack on hack, it's like perl but without even a good minimal core set
jmerelo: www.python.org/dev/peps/pep-0572/ 13:12
it's why what's his face quit
El_Che www.python.org/dev/peps/pep-0572/
hahainternet because he pushed this through regardless of how non-pythonic it is
and then complained people fought against it
it deeply irritates me, the pythonic mantra has always been 'one way to do it, explicitly' 13:13
but now there's like 4 different string formatting methods, two different ways of assigning variables etc 13:14
jmerelo hahainternet: right... 13:15
El_Che hahainternet: pretty much like perl6 :P
hahainternet i dunno, other than limitations on strict typing, 6 feels pretty coherent to me
jmerelo hahainternet: there are many ways to do it. But at least we're honest about it.
hahainternet honestly i can't think how many different ways 6 has 13:16
but the problem with python's diff ways is they're all distinct features
so f strings, .format, % operator
at the least
jmerelo hahainternet: but Python has a nice documentation system, versioned and all. We don't. Have I mentioned we need help writing the Perl 6 documentation? 13:18
hahainternet I assure you that documentation for python and python modules are amongst the worst that exists
jmerelo: do you know Go?
and if i can help with documentation i'd love to, but i don't have an authoritative understanding of how rakudo does its thing 13:19
jmerelo hahainternet: Yep, I've used it from time to time. More familiar with Python (among non-perl things)
tadzik eh, the zen of python is a bit like the pirate codex
it's only followed when it fits the decision already made, it seems
jmerelo hahainternet: you don't need to in most cases. Just check out the issues in the doc repo.
hahainternet the problem with python docs is that they're always designed as a tutorial, but there are few lists of methods and the types they return etc
tadzik "explicit is better than implicit, except when we implicitely pass `self` to the method being called"
hahainternet in fact listing types seems discouraged in general, and it's rare to see a list of exceptions a method can throw 13:20
tadzik: @property, explicit my ass :(
jmerelo: rgr that
tadzik hahainternet: hehe, that's even better
but hey, you decorate these explicitely! :P 13:21
hahainternet cries
tadzik anyway, I'm not too mad about assignment expressions
hahainternet i explained to a guy the other day why Go's 'whatever, err := some_call()' is far superior to exceptions, but i think it fell on deaf ears
tadzik but I'd be happier if someone made the closure scoping not garbage
hahainternet tadzik: they're just assignments, but the parser is incapable of distinguishing them so i understand
well there's no scoping in conditionals either, which is quite annoying 13:22
tadzik no scoping in blocks except if it's a try block :>
hahainternet hah i had forgotten that was the case, haven't done pro python in a couple years now
tadzik: there's also the issue that you can't reliably distinguish a list from a string in a generic way 13:23
because both can be iterated or what-have-you
tadzik but eh, saying that multiple assignment is superior to exceptions is a *very* long shot
hahainternet tadzik: it's certainly much more pythonic
El_Che tadzik: I find it easier to understand, personnaly
tadzik it's not even really an alternative to them: at best you can use them as an ersatz of proper exceptions
hahainternet: oh, pythonic. I don't care about that P
:P
hahainternet tadzik: the issue with exceptions is undocumented control flow
when will your function return? well, in Go, it's when you tell it to or it panics 13:24
tadzik El_Che: oh, absolutely. But they serve a completely different purpose imho
hahainternet wheras in Python it's: literally any exception that you didn't handle
programming resiliently in the face of potential failures is seriously hard in python 13:25
and it's practically mandatory and automatic in Go
tadzik eeh
hahainternet Failure in p6 is a wonderful approach
tadzik have you tried Rust? :)
hahainternet best of both worlds
hah, not to the extent i'm managing exceptions across stack frames
it is on my list however
tadzik Failure, Error or whatever you call it is perfectly fine if your code is functional-ish
but if function have side effects, ignoring the return value is a perfectly normal thing 13:26
which is when Failures and Errors are useless
hahainternet i'm so used to Go now that ignoring return values is exceptionally rare
El_Che I wouldn't say say
hahainternet i'm pretty sure if you sink a failure that it becomes an Exception too 13:27
El_Che result, _ := funcThatAlsoReturnsAnError()
tadzik hmm, I don't know about that. Perhaps
El_Che that's pretty common
tadzik El_Che: well, but then at least you're explicitely doing the wrong thing :P
El_Che yeah, but it's pretty common
tadzik true 13:28
hahainternet tadzik: yeah try it in the repl
it'll throw
tadzik hahainternet: yeah, indeed
cool :)
hahainternet El_Che: metalinters will also bitch at you for that
right i gotta brb, i dunno if Failure was inspired by another language, but it is one of the things in p6 that changed how i think about things, and that is the most valuable thing in the world: a new perspective 13:31
13:31 lucasb joined
El_Che hahainternet: try wearing your underwear on top of your pants! 13:32
new perspective all right :)
hahainternet El_Che: 'pants' means underwear, British :)
El_Che damn :)
trousers, my dear
hahainternet one agrees
El_Che it reminds me of Australian friends that hated the word "kids" with passion 13:33
13:38 jmerelo left
tbrowder SmokeMachine: are you available? 13:54
yoleaux 23 Mar 2019 15:01Z <SmokeMachine> tbrowder: ive fixed your code... there was also another Red bug... please pull last Red master and try it again...
SmokeMachine Sorry, I’m going to the super marketing... 13:59
tbrowder SmokeMachine: good news: your last bug fix did the trick! after making one more set of changes to the models i got a successful total db load. now i am pushing all to the PR. then, later today, i will work on the queries and better docs in README.md plus internal in the models.
SmokeMachine tbrowder: but, please let me know if I can help...
tbrowder okay, will do
SmokeMachine Great!!! 14:00
Looking forward!
tbrowder oops i have a conflict so will have to push to PR later, got to go for a while... 14:02
14:18 Xliff_ left 14:29 reach_satori left 14:30 Sgeo__ joined 14:31 Sgeo__ left, Sgeo__ joined 14:33 kerrhau joined, Sgeo_ left, Sgeo joined 14:37 Sgeo__ left 14:38 kerrhau is now known as jaja
AlexDaniel .tell RaycatWhoDat actually, if you show us your code maybe we'll be able to optimize it further to like… one or two lines maybe :) 14:40
yoleaux AlexDaniel: I'll pass your message to RaycatWhoDat.
14:45 mowcat joined 14:53 uzl joined, antoniogamiz joined
uzl .seen moritz 14:54
yoleaux 20 Mar 2019 22:52Z <tbrowder> uzl: fwiw i say "on" website most of the time around techies, "at" mostly around non-techies, and
I saw moritz 22 Mar 2019 21:08Z in #perl6: <moritz> but checking with (elem) would reify @foo, which blocks the 'gather', so deadlock
14:55 imcsk8 left
antoniogamiz \o/ 14:55
what tests should have a module? in general, I know that specific ones depends on the module 14:56
14:56 imcsk8 joined
uzl tbrowder: Oh, I see. Now that I think about it, I probably only use "at" with email addresses ;-). 14:57
14:57 reach_satori joined
uzl .tell moritz Do you mind looking at this PR( github.com/perl6/doc/pull/2691 )? Thanks! 14:58
yoleaux uzl: I'll pass your message to moritz.
15:01 uzl left 15:27 Kaiepi left, Kaiepi joined
tbrowder antoniogamiz: hi 15:36
look at my most recent module for my use of tests as one example: Date::Names. the first few tests are applicable to most modules i think. 15:38
search on modules.docs.org 15:39
antoniogamiz tbrowder: oh I will take a look at it, thanks :) 15:44
15:48 leont left 15:52 leont joined 16:08 MidCheck left 16:11 jmerelo joined
Geth doc: ad049302b7 | (JJ Merelo)++ | doc/Language/performance.pod6
Reflow while (unnecessarily) checking #2695
16:11
doc: d1e0c450c5 | (JJ Merelo)++ | 3 files
Just reflow, re-check #2695
synopsebot Link: doc.perl6.org/language/performance
16:22 molaf joined, molaf left
tbrowder .tell SmokeMachine working PR has been pushed 16:23
yoleaux tbrowder: I'll pass your message to SmokeMachine.
16:29 scovit_ left 16:41 Xliff joined 16:50 SCHAPiE left, jmerelo left 16:54 SCHAAP137 joined 17:00 patrickb joined 17:06 RaycatWhoDat joined
RaycatWhoDat Hello again. 17:06
yoleaux 14:40Z <AlexDaniel> RaycatWhoDat: actually, if you show us your code maybe we'll be able to optimize it further to like… one or two lines maybe :)
RaycatWhoDat wait what
Ooh, they must have said this when I left. 17:07
AlexDaniel yes :) hello
RaycatWhoDat Right then. So, this was the code I was working on last night: github.com/RayMPerry/kitchen-sink/...t-files.p6 17:08
This is what I'm working on today. Would love any tips or optimizations you have for either. gist.github.com/RayMPerry/677d71e1...a3f27a5257
AlexDaniel RaycatWhoDat: maybe you can use IO() instead of Str 17:10
like sub list_files(IO() $directory = './',
RaycatWhoDat Oh, weird. That just works 1:! 17:11
1:1*
Thought I was passing in strings.
leont You might want to try Path::Finder, it would make your code easier
AlexDaniel m: say ‘foo’.indent(2) 17:12
camelia foo
AlexDaniel RaycatWhoDat: maybe also make use of this ↑
RaycatWhoDat: `my Str @foo` is probably just as good, no need to do `Str[]` 17:13
RaycatWhoDat Got it.
So, for the second snippet of code, I'm trying to embrace the Perl way but I find myself falling back on C-style constructs. 17:15
AlexDaniel `for $directory.dir.grep({.basename ~~ none @ignored-paths}) -> $current-file` 17:17
I wonder if that works
not any more readable, so probably not worth it
ah wait 17:18
there's a test thingie in `dir`, right?
`for $directory.dir(test => none @ignored-paths) -> $current-file` 17:19
does that work?
RaycatWhoDat Ooh. Lemme see.
Yep, that works! 17:21
AlexDaniel but okay, maybe I lied that it will be two lines, that's already pretty short :) 17:23
of course you can use a module to do that, but that's different
RaycatWhoDat Right, right. 17:24
AlexDaniel `if so %card_face{'mana_cost'}` why not `if %card_face<mana_cost>` 17:26
RaycatWhoDat Oh, we can do that? 17:30
Yep, that works. 17:31
sena_kun only for strings though.
<$foo> won't work unless you have literal `$foo` key. 17:32
RaycatWhoDat Got it. 17:33
18:03 kurahaupo left 18:04 kurahaupo joined 18:05 kurahaupo left, kurahaupo joined 18:07 antoniogamiz left 18:09 adu joined 18:23 TreyHarris left
AlexDaniel RaycatWhoDat: `if ! so` can be written as `if not` 18:23
RaycatWhoDat Got it. 18:24
AlexDaniel RaycatWhoDat: `if (so %card{'card_faces'}) {` no need here for so and no need for () too :)
sorry I was away for a bit :)
RaycatWhoDat Yep. I actually updated it a little. 18:25
github.com/RayMPerry/kitchen-sink/...cryfall.p6
18:25 kurahaupo left, kurahaupo joined 18:26 Black_Ribbon joined
AlexDaniel RaycatWhoDat: in perl 6, it's a bit unusual to see “print_card” instead of “print-card” 18:26
RaycatWhoDat: it's preference, and it's your choice, but just saying that kebab case is somewhat more common 18:27
RaycatWhoDat Oh, do you use kebab-case her- Ah, I see.
AlexDaniel RaycatWhoDat: also, if I was writing that code, I'd probably use `put` instead of `say` 18:29
the difference is discussed here: docs.perl6.org/language/faq#How_an...nt_differ?
for simple strings it doesn't matter, but in other cases it does 18:30
like
m: say 1..20
camelia 1..20
AlexDaniel m: put 1..20
camelia 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
18:30 netrino_ joined
RaycatWhoDat Ah. Got it. Updated. 18:31
18:32 kurahaupo left, netrino left, kurahaupo joined
AlexDaniel oh wow URI::Encode doesn't have kebab-case variants… 18:36
18:37 TreyHarris joined
Geth doc: 1dad2d78b7 | cfa++ | doc/Language/nativetypes.pod6
Remove leading m:
18:37
synopsebot Link: doc.perl6.org/language/nativetypes
AlexDaniel sena_kun: is there a Crolternative for URI::Encode?
sena_kun AlexDaniel, we have an URI implementation, though I wonder how nice it is compared to URI::Encode. 18:38
give me a minute 18:39
18:39 domidumont joined
AlexDaniel URI::Encode is just 45 lines of code, one of which is `use v6.c` on the very top… I don't like it 18:40
sena_kun I don't think we have "encode". We do have "decode" though.
AlexDaniel oooooh github.com/perl6-community-modules.../issues/12
sena_kun yes, that's likely a better thing 18:41
AlexDaniel RaycatWhoDat: check it out ↑
RaycatWhoDat: seems like it's better to use uri-escape and uri-unescape from URI module 18:42
RaycatWhoDat: github.com/perl6-community-modules/uri
RaycatWhoDat Got it.
Thank you for the insight. 18:43
18:58 kurahaupo left, kurahaupo joined 19:14 jmerelo joined, adu left 19:15 brainbuz joined
MasterDuke anybody up for helping me with a git problem? 19:18
19:21 Black_Ribbon left 19:22 Black_Ribbon joined
jmerelo MasterDuke: shoot 19:23
MasterDuke i need to rebase github.com/perl6/nqp/pull/518 onto master's HEAD
jmerelo MasterDuke: but the binary files are the ones in conflict. 19:24
MasterDuke but the merge conflicts are in the binary boostrap files
jmerelo MasterDuke: but those binary files shouldn't be in the repo
MasterDuke yes, those are the bootstraps 19:25
jmerelo MasterDuke: you want _your_ files to overwrite theirs?
MasterDuke i need to generate new ones after the first commit in my branch (and then again after another couple commits) 19:26
jmerelo MasterDuke: (anyway, for the future you should keep binary files outside the repo, using "releases", for instance)
MasterDuke: you can create a branch from a checkout
MasterDuke i'm not adding new binary files, just replacing new ones that are required to build nqp at all 19:27
jmerelo MasterDuke:
MasterDuke: let me see. You have to generate new binary files from an old commit, and then merge those with another old commit, right? 19:28
19:28 RaycatWhoDat left
jmerelo MasterDuke: then generate again those binary files from that new-old commit, and merge I guess with Master 19:28
MasterDuke well, i want to rebase my first commit onto master's HEAD, then generate new bootstraps. then rebase the next couple commits, then generate another new bootstrap. then continue rebasing the final commits 19:29
jmerelo first starting with the last one? 19:30
that is, HEAD^
MasterDuke so start a rebase, pause in the middle and replace some of the commits, continue
first is HEAD~13 or so on my branch 19:31
jmerelo MasterDuke: you know about git checkout --theirs / --ours, right?
MasterDuke yeah, but my branch will break if i just take master's bootstrap files. i have to create new ones 19:32
jmerelo MasterDuke: then I think it's back again to create branches from commits
MasterDuke: check out first commit, convert it into a branch, generate bootstraps, merge, take your generated files, check out next commit, create branch, merge, take whatever files are the correct ones, and so on... 19:34
MasterDuke yeah, i was hoping there was an easier way. but i guess not 19:35
jmerelo MasterDuke: can't think of one...
MasterDuke: sorry... 19:38
AlexDaniel why rebase it? 19:45
just merge master into your branch, generate new binary files, done 19:46
no?
MasterDuke: silence :) 19:52
maybe my question is that stupid xD
MasterDuke AlexDaniel: maybe that would work. but wouldn't the merge back into master of my branch then look quite odd? 19:59
AlexDaniel MasterDuke: no 20:03
20:10 SergiusUA joined
MasterDuke anyway, i don't know what i was thinking. when i do start a rebase it does in fact pause at the conflicting commits. i generate new files and add them and just --continue 20:11
20:12 kensanata joined 20:19 domidumont left 20:31 jmerelo left 20:39 natrys left 20:42 natrys joined 20:55 choiboi left 20:56 choiboi joined 20:59 kensanata left
TreyHarris MasterDuke: I didn't look at your issue before you force-pushed (unless that's a common ocurrence, you should follow it with another commit saying "FORCE PUSHED TO GITHUB", btw, as well as notifying any channels or mailing lists that may have people working on their own branch that's now going to conflict), but git rerere should've worked well for this... 21:06
So on another note: I just managed to use Signature.new to create a routine at runtime. What I'm wondering is, can I use a signature (either with Signature.new or with the :(...) syntax) to abstract out a repeated set of named options that always occur together, e.g. in doing a complex set of App::Cmd subcommands (think git's many recurring flags)? 21:08
moritz not really, I think 21:09
yoleaux 14:58Z <uzl> moritz: Do you mind looking at this PR( github.com/perl6/doc/pull/2691 )? Thanks!
moritz left my comment there 21:12
TreyHarris moritz: I can do `my $textargs = :(Encoding :$encoding, Int $:buffering, Bool :$overwrite);` or whatever, but I can't re-use $textargs in a declaration in any way? So copy-paste's my only alternative short of using (|) and then dispatching to a middleman multi that unpacks the args before returning control (which is how it's often done in other languages but always leaves a bad taste in my mouth)? 21:13
21:14 bobby left
TreyHarris (Erm, not sure why I said "middleman multi". The alliteration, maybe. "Shim routine" of whatever kind.) 21:14
21:14 bobby joined 21:15 [Sno] joined
TreyHarris This may be better as a mailing list question, it might be one of those "not quite but almost nearly as good" things that tend to be handled better in email... 21:15
moritz TreyHarris: I understand what you want, but I know no good way 21:18
21:18 sno left
TreyHarris moritz: I'm sure you do, but somebody might have a clever thought. Isn't there a way to augment (English sense, not P6 sense) the argument list of a method when subclassing? I seem to recall it, but I can't find an example now 21:20
21:24 sena_kun left 21:28 bobby left 21:30 bobby joined 21:43 bobby left 21:44 bobby joined
ugexe if its a shim then you just sub MAIN(*%_) { my-shim(|%_) }; and let the shim take care of the typing errors. of course you also want the auto code generation from multi main i imagine which makes things more complicated. 21:46
if you need to reference items in MAIN then %_<item> or whatnot
alternatively maybe you could figure out something with macros. 21:47
not sure technically why would couldnt let someone create a signature and attach it to their subs to avoid redundancy. but it comes up every so often and the answer doesn't seem like it will change anytime soon. 21:50
21:50 kurahaupo left
TreyHarris ugexe: I didn't consider macros, that's a good idea. I'd really very much like the subcommand to self-document as much as possible, so that seems better than the slurpy--I hopefully can keep the flag handling as before 21:50
21:50 kurahaupo joined
TreyHarris A macro could potentially preserve the auto-USAGE stuff even 21:50
Is this expected behavior and, if yes, can I workaround it? 22:06
m: sub MAIN(Str :$flag) { say $flag.perl }; BEGIN @*ARGS="--flag=False"
camelia Usage:
<tmp> [--flag=<Str>]
TreyHarris m: sub MAIN(Str :$flag) { say $flag.perl }; BEGIN @*ARGS="--flag=false"
camelia "false"
TreyHarris I was trying a test sequence of strings that happened to include the word False 22:07
ugexe looks like a bug to me 22:08
TreyHarris m: sub MAIN(Str() :$flag) { say $flag.perl }; BEGIN @*ARGS="--flag=False" 22:18
camelia "False"
TreyHarris In the context of MAIN, Str should be equivalent to `Str()`, I think?
(In effect--it obviously is not in practice.) 22:19
ugexe that is what allmorphs are for 22:25
and sub MAIN(Int $a) { } can work even though everything on the command line is a string
m: sub MAIN($a) { say $a.WHAT }; BEGIN @*ARGS = "1" 22:26
camelia (IntStr)
ugexe m: sub MAIN(:$foo) { say $foo.WHAT }; BEGIN @*ARGS = "--/foo=True"; 22:29
camelia (Bool)
ugexe m: sub MAIN(:$foo) { say $foo.WHAT }; BEGIN @*ARGS = "--/foo=true";
camelia (Str+{<anon|1>})
ugexe the bool stuff should be handled like the last example 22:30
TreyHarris There is no BoolStr though 22:31
ugexe no, but the last example mixes in False to the string value of "true"
TreyHarris Right.
ugexe: what is the function of the slash in `--/foo=`? 22:36
I can't find it documented 22:37
japhb TreyHarris: It's like --no-foo in some other argument parsers. The slash is just a boolean negator that doesn't annoy command shells. 22:42
yoleaux 21 Mar 2019 18:22Z <ab6tract> japhb: sent a followup email :)
japhb .tell ab6tract Saw the follow up email, thanks! SGTM, but can't work on it right now because of $day-job stuff. I'll keep it on my back burner for fun coding time though. :-) 22:44
yoleaux japhb: I'll pass your message to ab6tract.
22:45 natrys left
TreyHarris japhb: thanks--I knew --no- didn't work but I wasn't aware that existed 22:45
22:46 pecastro left
TreyHarris m: sub MAIN(:$foo) { say $foo.WHAT.perl }; BEGIN @*ARGS = "--/foo=true"; 22:47
camelia Str+{<anon|1>}
TreyHarris The above makes me think that "Str+<mumble>" should work as a type constraint in code; does it? The naive tries I've attempted don't 22:48
timotimo nah, that's just a fun way to stringify it
you'd have to use "but" or something like that
TreyHarris m: my $x where Int|Bool; for (3, True, 3.5, 'hi') -> $v { $x = $v; say "YES to $x"; CATCH { when X::TypeCheck { say "NO to $v"; } } } 23:00
camelia YES to 3
YES to True
NO to 3.5
NO to hi
TreyHarris you can do it as a where, but not as a type constraint. I see. 23:01
23:01 lucasb left
TreyHarris m: my Int|Bool $x = False; 23:01
camelia 5===SORRY!5=== Error while compiling <tmp>
Malformed my
at <tmp>:1
------> 3my Int7⏏5|Bool $x = False;
TreyHarris thanks, I submitted github.com/rakudo/rakudo/issues/2794 23:11
leont «Incompatible MROs in P6opaque rebless for types Perl6::Metamodel::PackageHOW and Stash» 23:17
Now that is a new error
(for me) 23:18
timotimo since the latest stable release you can only mix mixins into other things 23:20
committable6: 2018.12,2019.03 my $a = 99 but Scalar
committable6 timotimo, ¦2018.12,2019.03: «Cannot mix in non-composable type Scalar into object of type Int␤ in block <unit> at /tmp/9h_AGCzRbJ line 1␤␤ «exit code = 1»»
timotimo committable6: 2018.6,2019.03 my $a = 99 but Scalar
committable6 timotimo, ¦2018.6: «Cannot find this revision (did you mean “2018.06”?)» ¦2019.03: «Cannot mix in non-composable type Scalar into object of type Int␤ in block <unit> at /tmp/mXvzzVhx9W line 1␤␤ «exit code = 1»»
timotimo committable6: 2018.06,2019.03 my $a = 99 but Scalar
committable6 timotimo, ¦2018.06,2019.03: «Cannot mix in non-composable type Scalar into object of type Int␤ in block <unit> at /tmp/AncylkByDD line 1␤␤ «exit code = 1»»
timotimo oh, type objects
committable6: 2018.06,2019.03 my $a = 99 but Scalar.new 23:21
committable6 timotimo, ¦2018.06,2019.03: «Cannot make a Scalar object using .new␤ in block <unit> at /tmp/akwIrtq1SV line 1␤␤ «exit code = 1»»
timotimo committable6: 2018.06,2019.03 my $a = 99 but (my $).VAR
committable6 timotimo, ¦2018.06,2019.03: «»
timotimo hum.
leont This error happens during compilation
23:21 rindolf left
timotimo yeah 23:21
probably during class definition somewhere
leont paste.scsys.co.uk/583621
But only in one of my test files 23:22
TreyHarris committable6: my $x = 99 but 3
committable6 TreyHarris, ¦my: «Cannot find this revision (did you mean “all”?)»
leont That doesn't contain but or does
TreyHarris oops
committable6: 2018.12,2019.03 my $x = 99 but 3 23:23
committable6 TreyHarris, ¦2018.12,2019.03: «»
TreyHarris I thought that gave a warning at one point
leont Ah, It seems my problem is File::Temp related 23:26
What. This is bizarre. 23:28
If I move the File::Temp below my «use lib» line, everything works. But above it, it fails.
TreyHarris .tell grondilu I think you want `.ACCEPTS(Array) && .all ~~ Num given [pi]`
yoleaux TreyHarris: I'll pass your message to grondilu.
TreyHarris m: .ACCEPTS(Array) && .all ~~ Num given [pi] 23:29
camelia ( no output )
TreyHarris m: say so (.ACCEPTS(Array) && .all ~~ Num given [pi])
camelia True
leont Latest error: «No such method 'reify-until-lazy' for invocant of type 'NQPArray'»… 23:32
MasterDuke TreyHarris: i force pushed to my own branch in my own fork, so i doubt it'd mess anybody up. but yeah, i don't force push to master of the main repo
leont: huh, NPQArrays aren't really supposed to leak out 23:33
TreyHarris MasterDuke: Oh! I followed your link by launching it from IRC and didn't notice it wasn't the canonical. Sorry! 23:34
leont Yeah, I would imagine so 23:35
It appears the issue is «use lib» is the issue. Or at least loading something from that dir
Sometimes
The dir contains a lib A that loads a lib B. 23:36
TreyHarris MasterDuke: If you haven't played with git-rerere, I highly recommend it--one of those hidden git gems
MasterDuke TreyHarris: np, it isn't obvious
leont Loading B before the use lib causes really weird errors
MasterDuke never heard of it, i'll take a look
leont Loading B after works fine
23:36 SergiusUA left
TreyHarris It's like git-stash or git-wip, one of those things that can really be a revelation before you know it exists. More so than git-wip, maybe, since it's built-in to the Git distro and doesn't need config fiddling and editor integration like git-wip does 23:38
23:43 entonian joined 23:48 entonian left
leont My problem was solved by manually removing my t/lib/.precomp 23:51
TreyHarris leont: ouch. I've never needed to do that so it would've taken forever to occur to me 23:52