»ö« 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.
00:00 reportable6 left 00:03 |oLa| left 00:04 reportable6 joined 00:21 |oLa| joined 00:22 |oLa| left, |oLa|1 joined 00:23 aindilis joined
SmokeMachine vrurg: the tests are broken... 00:34
vrurg SmokeMachine: passing on my side. Er, what PR is breaking them? 00:38
I see, travis... Dunno, I'm running on HEAD, this could be the reason. 00:40
00:50 Voldenet joined, Voldenet left, Voldenet joined 00:55 lucasb left 01:00 ufobat_ joined 01:04 ufobat left 01:11 wildtrees left
pilne yanno 01:17
perl6 might be the language to build a fantastic irc client
01:20 SCHAPiE left 01:23 Cabanossi left
pilne would reliance on the moarvm make the program larger than say something hacked together in electron/kivy/java like, would the size of the vm make it a "ridiculous" dependency? 01:25
01:26 SCHAPiE joined
discord6 <Tyler (Aearnus)> pilne: libmoar.so is 8.0269012 megabytes on my system 01:30
<Tyler (Aearnus)> i guarentee that's smaller than electron at the very least
Elronnd 7.7m on mine 01:33
pilne sweeet 01:37
01:38 Cabanossi joined
discord6 <Tyler (Aearnus)> the irc bridge is already written in perl6 pilne 01:38
<Tyler (Aearnus)> it's just not very stable
01:45 Voldenet left
pilne so it's low hanging fruit for a hobbyist/noob? :D 01:48
01:51 Voldenet joined, Voldenet left, Voldenet joined
Elronnd pilne: there's not really a good way to build UI yet in perl6. Terminal::Print sucks, and gtk is afaik immature 01:58
discord6 <Tyler (Aearnus)> github.com/azawawi/perl6-ncurses ? 01:59
<Tyler (Aearnus)> might be a good time to start on a perl6 bindgen
Elronnd I started working on a c compiler in perl6 a while back
pretty much finished the tokenizer, but burnt out on the preprocessor 02:00
discord6 <Tyler (Aearnus)> Elronnd: much easier to just make a yacc clone and use the C yacc/lex rules 02:01
Elronnd ncurses is awful
discord6: I wanted to have super pretty error messages
discord6 <Tyler (Aearnus)> that's what they did here github.com/gmasching/cl-c-parse
Elronnd and do, like, static analysis and stuff
02:01 Manifest0 left 02:02 Manifest0 joined
discord6 <Tyler (Aearnus)> it's a cool diea 02:02
<Tyler (Aearnus)> idea
Elronnd I also wanted to do pipelined compilation, where you start at the top, keep munching characters until you get a preprocessor token, munch preprocessor tokens until you get a lex token, munch lex tokens until you get something you can parse, etc. 02:03
discord6 <Tyler (Aearnus)> i don't know why we don't have automatic bindings generators
Elronnd so it's almost like it's single-pass
discord6 <Tyler (Aearnus)> huh, that's interesting. never heard of that
<Tyler (Aearnus)> i'm pretty firmly in the camp of parser combinators being the most elegant parsing solution 02:04
02:05 adu_ joined, adu left, adu_ is now known as adu
Elronnd parser combinators sound cool, but I've never really gotten into them 02:05
02:13 kaare__ left, kaare__ joined 02:26 kaare__ left, kaare__ joined 02:29 Cabanossi left 02:34 Cabanossi joined 02:36 discoD joined 02:51 aborazmeh left 03:31 molaf joined 03:40 molaf left 03:53 curan joined
cpan-p6 New module released to CPAN! App::nm2perl6 (0.0.1) by 03JGOFF 04:09
New module released to CPAN! Sparrow6 (0.0.8) by 03MELEZHIK 04:14
04:14 dudz left 04:35 discoD left
discord6 <Tyler (Aearnus)> do literal arguments to nativecall functions get GC'ed? 05:13
<Tyler (Aearnus)> i have a tight loop for this game project i'm working on, and the only things I do in it are call like 3 nativecall functions
<Tyler (Aearnus)> but every 10-ish seconds the framerate drops from an already iffy 60fps to 1fps for a frame or so 05:14
05:18 dudz joined, tilpner joined 05:19 SCHAPiE left 05:21 cpan-p6 left, SCHAPiE joined, Technaton joined 05:24 sauvin joined 05:44 AlexDaniel joined 05:45 jmerelo joined 05:46 Sgeo__ joined
AlexDaniel El_Che: yeah, it was 05:48
05:49 Sgeo_ left
AlexDaniel El_Che: github.com/rakudo/rakudo/commit/bd...6b0449ab01 05:50
El_Che: part of the 2019.07.1 release
El_Che: is it still flapping for you?
05:56 Itaipu left 06:00 reportable6 left, reportable6 joined, ChanServ sets mode: +v reportable6
Geth doc: 722b41dee3 | (JJ Merelo)++ | doc/Language/contexts.pod6
Adds section on list contexts, refs #1225
06:22
synopsebot Link: doc.perl6.org/language/contexts
jmerelo Both links to logs above are wrong. Is there a way to change them? 06:24
06:39 reach_satori_ left
jmerelo Does anyone think we should release another survey just in time for the PerlCon? (And maybe swiss perl workshop too) 06:43
06:47 dyske joined
AlexDaniel 🤷 07:06
07:06 reach_satori_ joined 07:14 patrickb joined 07:29 Coffee-N-Donuts joined, Coffee-N-Donuts left 07:32 nepugia joined 07:34 jaldhar joined 07:40 MARTIMM joined 07:46 chloekek joined 07:54 Marcool joined 07:56 zakharyas joined 07:59 dolmen joined, ravenousmoose left 08:00 ravenousmoose joined
chloekek jmerelo: I finished a prototype of the Nix expressions, although I wrote them by hand instead of generating them. Now I can build a Perl 6 program that has dependencies on some ecosystem libraries and it generates a script that sets up PERL6LIB and execs Rakudo. :) 08:00
08:01 satori__ joined 08:02 robertle joined
jmerelo chloekek: cool! 08:03
08:04 reach_satori_ left 08:05 dudz left, dudz joined 08:07 scimon joined 08:09 MARTIMM left, marcel_ joined
chloekek jmerelo: They look like this, and I want to generate them automatically from META6.json files: github.com/chloekek/meta62nix/blob.../META6.nix github.com/chloekek/meta62nix/blob...system.nix 08:10
Generating ecosystem.nix will be a little tricky since I need to download all the tarballs to find their hashes. But once that works I can set up CI and test all the packages automatically and test that they're compatible with each other. :) 08:11
08:18 nepugia left
jmerelo chloekek: much cleaner than JSON. 08:22
chloekek: the problem is that for the ecosystem there's no such thing as a fixed hash. That was in the issue. 08:23
08:24 dakkar joined
chloekek If a new version of a package is available then ecosystem.nix must be updated. 08:25
I'll take another look at the issue. 08:26
Nix can't cope with sudden changes in downloaded artifacts. They must be exactly the same each time, otherwise the build won't be reproducible. This means you need to give a hash. 08:28
Which is what I want anyway, even if I'd be using something else. Not knowing what you'll get, and then executing it, is a big security issue (which we see happen often in then npm ecosystem). 08:29
What I imagine is having a cronjob that automatically checks for new versions of packages, computes their hashes, and commits to the repo a new ecosystem.nix file. Then it's always up-to-date. But indeed the question is, how do you efficiently check for new versions of packages? 08:30
Regarding security, it might be that this automatically committed ecosystem.nix file now points to malware. But that won't affect users who are currently using an old version of the ecosystem.nix file (unless they too automatically update that, but that would be foolish). 08:31
08:32 domidumont joined
jmerelo chloekek: if there's no explicit version in META.list, zef download whatever is there. It checks the version in META6.json against what's installed, but not the rest of the source. 08:33
08:33 domidumont left
jmerelo chloekek: that's why I proposed that releases should be tagged, and maybe announced too in META.list 08:33
chloekek Yeah that would be a good idea.
Still, Git allows removal of tags, and then you can create a new tag for a different commit. So even then, it should point to commits directly by hash.
jmerelo chloekek: then you could compute hashes, for instance, and (roughly) guarantee that the sources for a particular version are constant. 08:34
chloekek For example: today v1.0.0 points to commit abcdef. And tomorrow, v1.0.0 points to commit 123456 which contains malware.
08:35 rindolf joined
jmerelo chloekek: well, you can check the commit hash, and bind it to the tag. If you remove and replace the tag later, that's not a big deal. 08:35
chloekek Yeah but those hashes would need to be in META.list for Zef to download them safely. Otherwise if you run Zef on a new machine, or deleted ~/.zef before downloading the package a second time, it won't be the same.
jmerelo chloekek: so you could retrieve the tagged release, note down the commit hash, hash it too so that you can check them... 08:36
chloekek: I'm not thinking about zef. zef is not going to do that.
chloekek Well, or any package manager that derives the package list from META.list.
08:37 Marcool left
jmerelo chloekek: right now, there's a zef spider that indexes CPAN and ecosystem every two hours and creates an index out of that. The new sytem, let's call it fez, would store the commit hash and the distro hash and never change it. 08:37
chloekek: as a matter of fact, it could check periodically that what's in a tag is effectively what's indexed and flag a distro if it's not. 08:38
chloekek Ah right, yeah that would work.
jmerelo chloekek: zef right now stores everything in a .json in a repo; same could be done here. Or maybe store it in a .nix somewhere...
chloekek Could generate a Nix expression for each version of each package, and don't touch them if they already exist. 08:39
jmerelo chloekek: right
chloekek: that would be cool.
chloekek Yeah that makes sense.
jmerelo chloekek: are you attending PerlCon?
chloekek No I don't think I am.
jmerelo chloekek: I was thinking about doing a BoF with this 08:40
chloekek: there're a couple of functionalities in zef that are quite interesting and could be spun off. First, the logic to find dependencies. Second, the testing logic, which uses one of several systems available.
chloekek By the way, Nix also doesn't care about package versions. If you have two packages that are similar but have different version numbers, Nix treats them as completely independent packages. Which is usually what you want for executables on a workstation, but I don't know how Rakudo copes with different versions of packages that use the same package names (e.g. Foo::Bar). I believe you can pass a version number 08:41
to use?
jmerelo chloekek: also auth
chloekek Can you have multiple libraries in PERL6LIB that expose packages with the same name?
jmerelo chloekek: yep, as long as they use different versions and/or different authors. 08:42
chloekek Ah that's nice. :)
jmerelo chloekek: you can also specify the API and let perl 6 find out which one does that API.
chloekek: (not seen anyone using that in the wild, but still...)
chloekek That's neat, could be useful for libraries with platform-specific implementations. 08:43
Thanks for the tips, I'll give some more thought to how to generate ecosystem.nix and deal with (version, auth) pairs.
jmerelo chloekek: hadn't thought about that, but that's right. :api is in principle (and in examples) taking a number, but I guess it could be anything in principle.
chloekek: my pleasure.
chloekek What's a BoF? 08:44
patrickb chloekek: en.wikipedia.org/wiki/Birds_of_a_f...computing) 08:51
chloekek Thanks.
jmerelo: When Foo depends on Baz, Bar depends on Baz:ver<1.2.3>, and Qux depends on Foo and Bar, which version of Baz should be used in PERL6LIB? Both the latest version and version 1.2.3? 09:01
in PERL6LIB when running Qux*
Because that would be rather easy. :D 09:02
It seems that depends can specify version ranges, so I suppose it's not that simple and actually needs some resolution. 09:03
If Rakudo can cope with multiple versions of a package then I think you can just find all upper bounds that satisfy the constraints and then put those in PERL6LIB. 09:11
09:14 ravenousmoose left
chloekek In the first version I'll just completely ignore versions and get something working. vOv 09:14
09:18 ravenousmoose joined 09:24 Cabanossi left 09:35 dyske left 09:38 Cabanossi joined, Itaipu joined 09:44 pilne left
jmerelo chloekek: I think so, both. But I would have to look it up. 09:49
chloekek: it's probably OK to ignore versions :-)
09:59 scimon_ joined 10:00 dyske joined 10:02 scimon left 10:03 sena_kun joined 10:09 Black_Ribbon left 10:13 pat_js joined 10:20 [Sno] left 10:27 dolmen left 10:43 aborazmeh joined, aborazmeh left, aborazmeh joined 10:58 epony left 11:04 aborazmeh left 11:12 epony joined 11:14 zakharyas left
chloekek jmerelo: I've been looking at META.list and META6.json and I see what's the problem. 11:20
All you have is source-url and version and there's no connection between the two.
11:23 dolmen joined
chloekek I think it'd work a lot better if people had to make releases and upload tarballs somewhere, like with CPAN Perl 5. 11:26
In fact I think I'll not bother with automatically generating ecosystem.nix for now, and just add packages to it manually whenever I need one. Or at best integrate it with CPAN only. 11:27
11:27 ravenousmoose left 11:28 ravenousmoose joined
chloekek Making release tarballs is also a process which can do arbitrary things such as generating code, which is currently not possible unless you want to commit that to your git repo. 11:30
Separating releases from version control avoids a lot of problems.
ugexe Uh a git tag in META6 json has no extra protections against changes 11:31
jmerelo chloekek: as a matter of fact the version in source-url and in META6.json can be different, as just happened in a question in perl6-users 11:32
ugexe i wish we’d quit making shit up
chloekek jmerelo: yes, hence "no connection between the two"
jmerelo chloekek: right, that's what you meant. Sorry. 11:33
chloekek The problem boils down to: you have a URL, and if you fetch the resource it points to twice, you might get something different each time.
jmerelo chloekek: we could encourage people to tag a release _and_ upload a release tarball too. 11:34
chloekek: as a matter of fact, GitHub (and probably gitlab) do that automatically for you, even from the command line.
Geth perl6.org: 505b5152f8 | (Elizabeth Mattijsen)++ | source/index.html
Give Perl 6 a more adult intro

  - de-emphasize being the sister of Perl 5
  - emphasize part of the Perl community
  - emphasize continued development, rather than being just new
perl6.org: ef32dfc071 | (Elizabeth Mattijsen)++ (committed using GitHub Web editor) | source/index.html
Merge pull request #132 from perl6/more-adult-intro

Give Perl 6 a more adult intro
chloekek With GitHub you can get a tarball for anything that rev-parse can parse.
jmerelo chloekek: come to think of it, I think it does it even if you don't ask explicitly.
11:35 scimon_ left
chloekek Yeah it just generates the tarball on the fly when requested. 11:35
ugexe ...which I’ve pointed out in the issue stating using gut tags is superior
chloekek The URL template is github.com/<user>/<repo&g...gt;.tar.gz
I think you can even do stuff like HEAD@{2019-01-01} to get the version at that date (although it's a bad idea). 11:36
jmerelo chloekek: still, it can change if you remove the tag and assign it somewhere else; but that would be byzantine.
chloekek: as said above, we can hash the tarball and the commit and bind it to the release. If you move the tag, it would be noticed.
chloekek Hash validation is a requirement, I can't live without it. 11:37
jmerelo chloekek: right, date not a good idea. Tagging at least is a (more) human way to refer to specific commits.
chloekek Even if you got the tarball for a commit hash, you still want to verify the hash of the tarball after downloading, because GitHub itself may be compromised. :) 11:38
jmerelo chloekek: right, you can have different levels of checking. As long as you store the hash associated to the release somewhere, not a big deal.
chloekek Yeah then it's fine. 11:39
The problem with META.list is that it doesn't store any of this information. What you'd have preferably would be a file/database with information about each release as (name, rev, auth, archive URL, archive hash) tuples. 11:40
jmerelo chloekek: right. You can store it anywhere, in another git repo, for instance.
chloekek And when making a release, this database must somehow be updated (perhaps as an extra step as with CPAN, or automatically by scraping Git repositories).
ugexe You can’t just find the upper bounds. Two modules may depend on a two different but specific versions
chloekek The database can also include dependency information to aid resolution and allow parallel downloads. 11:41
jmerelo chloekek: right now it's scraped.
chloekek Do we have one already? Where is it?
jmerelo chloekek: in one of ugexe's repos, github.com/ugexe/Perl6-ecosystems The scraping tool is here: github.com/ugexe/Perl6-App--ecogen 11:42
chloekek Cool1
jmerelo ugexe++
11:42 marcel_ left
jmerelo sorry, off to cook. 11:42
11:43 jmerelo left
chloekek Thanks, I'll look more into how CPAN works and update the list for non-CPAN packages manually. 11:45
11:58 satori__ left 12:00 reportable6 left 12:04 reportable6 joined, ChanServ sets mode: +v reportable6 12:06 epony left 12:11 cpan-p6 joined, cpan-p6 left, cpan-p6 joined
El_Che v2017.07.1 packages build is being triggered from Bruges :) 12:27
timotimo oooh, like a fuckin' fairy tale! 12:28
did they tell you about the alcoves? 12:29
12:29 pat_js left
El_Che timotimo: hehe 12:31
(I am semi local, about 120 km further east :) ) 12:32
(the flopping failting test for performance is mostly hitting i386 of my builds) 12:33
12:41 scimon joined 12:42 molaf joined 12:44 zakharyas joined 12:47 discord6 joined 12:50 MilkmanDan left 12:51 MilkmanDan joined 12:53 chloekek left, sena_kun left
Xliff \o 13:06
13:12 pat_js joined 13:19 pamplemousse joined
El_Che lo 13:19
13:27 sena_kun joined 13:29 chloekek joined 13:36 epony joined 13:39 lucasb joined 13:41 curan left 13:43 pmurias joined
pmurias timotimo: is you livecoding spaceship drawing thing available somewhere 13:43
?
timotimo yep 13:44
pmurias timotimo: I have been thinking about porting it over to rakudo.js
timotimo bitbucket.org/gtkshooter/p6-gtk-shooter/src
El_Che pretty neat stuff
pmurias timotimo: thanks 13:46
13:54 Itaipu_ joined 13:56 Itaipu left 13:58 Itaipu joined 14:01 Itaipu_ left 14:04 Itaipu left, Itaipu joined
pmurias timotimo: the spaceship snippet just draw a static spaceship image? 14:20
timotimo yes 14:21
there's a branch that you may want to check out, too 14:22
14:24 jaldhar left, jaldhar joined 14:27 pmurias left, Itaipu_ joined 14:28 pmurias joined 14:30 Itaipu left 14:31 dyske left
tony-o_ any of you guys around zürich know of an inexpensive place to stay? 14:31
14:33 pmurias left
SmokeMachine is there any plan to make comma accept custom keywords as `model` for Red, for example? 14:48
timotimo there's already "monitor" and "actor" in it
i'd imagine adding "model" wouldn't be a big deal
sena_kun SmokeMachine, the dirty way is very fast, can add it to next complete release, the proper way is not so easy and, more like, very not easy. 14:49
El_Che it pretty much depends on how many people use p6 to create DSL 14:51
I have SparrowDo in mind (and indeed Red)
14:53 marcel_ joined
SmokeMachine sena_kun: how dirty would be the dirty way? 14:53
sena_kun well, a self-modifying language means we either execute it and look at how it looks like(which we must not, of course) or we just try to be as good in assuming things as we can.
timotimo literally just add "model" to the list of accepted thingies
maybe with a check (or suggestion) that Red is use'd 14:54
sena_kun SmokeMachine, not really, I guess.
I have a feeling that a proper way will be something of a framework support, e.g. you can add some groovy to your java project, that'd be nice to tick `Red` or something else of this sort in project creator / project settings and have additional keywords, checks and such. 14:55
chloekek Add some Perl 6 to your Java project!
sena_kun chloekek, we do have Perl 6 parts in our Java-based Comma. ;) 14:56
SmokeMachine sena_kun: would it be possible add something on META6.json of a module saying that it "exports" the model keyword and when a project includes (as dependency) that module comma automatically accepts model? 14:57
sena_kun SmokeMachine, I think that a metamodel symbol is exported anyway and we do look into that, so... the question is how to nicely tie it into the parser. I can't say much, unfortunately, as I didn't work with it a lot. 15:00
SmokeMachine sena_kun: Oh! Sorry I've misunderstood... I thought comma would not look at the exported symbols... 15:01
sena_kun SmokeMachine, anyway, creating a ticket for it right now...
SmokeMachine sena_kun: :) thanks!
sena_kun SmokeMachine, well, Comma does completion for e.g. variables, subs from outside, no? If it's not for you, it should to. Of course, there is a lot of work to do for it to become better and more useful. 15:03
SmokeMachine sena_kun: I meant metamodel symbols... 15:04
I've tried to use comma to write Red... but: usercontent.irccloud-cdn.com/file/.../image.png
15:05 sauvin left
sena_kun SmokeMachine, this is a mis-parse for sure. Anyway, a ticket is created, thanks for your interest in Comma. 15:06
15:06 patrickb left
SmokeMachine thanks! 15:07
timotimo SmokeMachine: it does look like comma lets you write lots of Red 15:09
Red words, Red squiggly lines, Red background 15:10
SmokeMachine timotimo: :P
15:16 jmerelo joined 15:21 pat_js left 15:27 dolmen left 15:30 dolmen joined, robertle left 15:34 wildtrees joined
cpan-p6 New module released to CPAN! Gnome::Gdk3 (0.14.7) by 03MARTIMM 15:37
15:43 chloekek left
cpan-p6 New module released to CPAN! Gnome::Gdk3 (0.14.9) by 03MARTIMM 15:48
zostay How is it possible for a uint16 value to hold a -256? That's the value I seem to be getting out of a native type when I'm trying to convert what should be 65280 to a UInt. 15:53
15:55 dolmen left
zostay Since the impossible has happened, I'm not even sure where to begin. 15:55
tobs zostay: 65280 is 0xff00 which is also how -256 looks in two's complement in a 16-bit integer 16:02
so the data is correct, the one who's printing the data has a wrong idea about the data being signed or unsigned though 16:03
zostay Yes, I actually inferred the 65280 from the -256.
All I'm doing is using NativeCall to pull in a CStruct and then using dd $obj.value and it comes out -256. 16:04
I can only assume it must actually mean the 2's complement.
As I don't know what this data is supposed to look like yet.
But it mustn't be negative. 16:05
tobs m: use NativeCall; my uint16 $x = -256; dd $x
16:05 evalable6 left
camelia 65280 16:05
16:08 evalable6 joined, ChanServ sets mode: +v evalable6
zostay Right. I'm letting NativeCall convert a pointer to an object and then trying to wrap that in something easier to work with in pure Perl, github.com/zostay/p6-Device-HIDAPI...PI.pm6#L73 16:08
That dd line is just me trying to figure out what's going on and it outputting what shouldn't be possible on my machine. I don't know if it will happen if you install hidapi and then try it on yours because it would depend on the usage-pages of the devices connected to your machine (and I'm only barely familiar with HID at this point to know whether this is a common one or not). 16:09
16:10 MilkmanDan left
zostay I'm probably doing something wrong at this point since I just drafted this code last night while at my son's taekwondo, but suringly uint16 should never be able to store -256. 16:10
*surely 16:11
16:11 MilkmanDan joined
tobs m: use NativeCall; class X is repr<CStruct> { has uint16 $.x }; with X.new(:x<-256>) { dd .x; dd .x.UInt } 16:14
16:14 evalable6 left
camelia -256
Failure.new(exception => X::OutOfRange.new(what => "Coercion to UInt", got => -256, range => "0..^Inf", comment => Any), backtrace => Backtrace.new)
16:14
tobs I have no real idea about the issue but this at least reduces the amount of code you need to get -256 out of an uint16 16:15
(and was I killing evalable6 with every `m:`?)
m: say «test»
camelia test
16:16 evalable6 joined
tobs m: say «test» 16:17
16:17 evalable6 left
camelia test 16:17
tobs AlexDaniel: ↑ there seems to be an issue with evalable
AlexDaniel e: say 42
tobs it's not back yet 16:18
AlexDaniel indeed
Attempt to return outside of immediately-enclosing Routine
zostay Botocide.
AlexDaniel github.com/perl6/whateverable/blob...le.pm6#L39 16:19
zostay I'll dig into this again when I have some time, but finding a -256 in a uint16 was the weirdest thing I'd encountered in awhile and I just sat there trying to figure out if my brain broke or that really did just happen. :-p 16:20
AlexDaniel zostay: it's a known issue. Most uint bugs were fixed though 16:21
but if you want to break you brain even more
m: my int @x[-2**63]; say +@x
camelia -9223372036854775808
AlexDaniel that's an array with a negative size :) 16:22
16:22 evalable6 joined
tobs that's one way to cheat at memory consumption 16:22
16:27 chloekek joined 16:29 scimon left 16:32 pamplemousse left, Cabanossi left 16:38 dogbert17 joined 16:40 dakkar left
jaldhar Hello. Take a look at this code: @suffixes.sort( { $^a.chars <=> $^b.chars }).reverse.grep({ @strings.grep(/$_/) ~~ @strings }).first 16:42
It is for finding the longest common substring in @strings. It works but I feel it could be more idiomatic/efficient. In particular I don't like the grep part. I feel I should be using junctions (i.e. all) but I couldn't get it to work. 16:43
Any advice? 16:44
AlexDaniel jaldhar: sort(*.chars) 16:45
that's for the first part :)
jaldhar AlexDaniel: ah yes. ok.
tony-o_ jaldhar: there is also codegolf.stackexchange.com/a/182141 16:46
jaldhar tony-o_: interesting but thats a different approach and i don't want to just copy someone elses code, I want to get mine working. 16:48
16:49 Cabanossi joined, jmerelo left
AlexDaniel jaldhar: what about @strings.all.contains($_) 16:49
jaldhar I was trying to do @strings.all ~~ /$_/ but the error is that you cannot coerce a junction to a string 16:50
but that might do the trick...
AlexDaniel so: @suffixes.sort(*.chars).reverse.grep({ @strings.all.contains($_) }).first
ugexe dont do that
m: my @a = <hello world>; say @a.contains("o w")
16:50 evalable6 left
camelia True 16:50
AlexDaniel ».contains
or not
ok now I'm getting confused :) 16:51
16:51 evalable6 joined
AlexDaniel m: my @a = <hello world>; say @a.all.contains("o w") 16:51
16:51 evalable6 left
camelia all(False, False) 16:51
AlexDaniel ugexe: so?
ugexe i didn't expect that to do that
AlexDaniel what else is it supposed to do then :)
16:52 evalable6 joined
ugexe i expected it to try and do contains on a stringified version of all(hello, world) 16:53
"expect" based on how contains otherwise works 16:54
jaldhar btw it does work though
ugexe as honestly i'd expect @a.contains to not do what it does currently
AlexDaniel jaldhar: I'd assume the performance is not that great but yes, technically it should work :)
tony-o_ you can get rid of the reverse by doing $^b <=> $^a rather than $^a <=> $^b 16:55
16:55 molaf left
ugexe -*.chars 16:55
tony-o_ yea
jaldhar tony-o_: it's a habit from perl5 because "Perl Best Practices" recommends it. 16:56
lizmat weekly: medium.com/@jcoterhals/perl-6-smal...469252724f
notable6 lizmat, Noted! (weekly)
chloekek Is there a nice way to turn a two-element Seq into a Pair? 16:58
tony-o_ jaldhar: gist.github.com/tony-o/f3d9378eb0d...a5afe5e2d2 16:59
not using reverse is faster and it's easier to grok imo
but, then again, i'm just some guy on the internet 17:00
jaldhar tony-o_: interesting. I'll have to bear that in mind for the future. 17:01
chloekek Ah, this works: my Str:D % = $path.lines».split(‘ ’).map({ $_[0] => $_[1] });
jaldhar tony-o_: though of course if I use sort (*.chars) I'll still need the .reverse 17:03
tony-o_ i'm not recommending *.chars
AlexDaniel jaldhar: as ugexe++ mentioned, -*.chars should work 17:04
chloekek: maybe `[=>] $seq` works too
jaldhar oh I didn't see that - there
tony-o_ m: my @a = qw<abc cd e d defg>; my @b = qw<abcdef cdefg>; say @a.sort(-*.chars).grep({ @b.contains: $_ }).first;
17:04 evalable6 left
camelia defg 17:04
tony-o_ m: my @a = qw<abc cd e d>; my @b = qw<abcdef cdefg>; say @a.sort(-*.chars).grep({ @b.contains: $_ }).first;
camelia abc
tony-o_ seems concise enough 17:05
17:06 evalable6 joined
AlexDaniel tony-o_: wrong 17:06
zostay Schwartzian transform does not buy you much on object attributes lookup. In fact, it probably buys you nothing in that case.
AlexDaniel tony-o_: as ugexe++ mentioned, you can't do that 17:07
zostay If you used some calculation instead of .chars, though, the Schwartzian will probably be faster.
AlexDaniel tony-o_: can't .contains without .all
ugexe .reverse has like no overhead 17:08
say @a and say @a.reverse should take the same time
zostay Right, I'm suggesting the Schwartzian is actually costing you in this case. 17:09
chloekek AlexDaniel: wouldn't that create pairs that have pairs as keys?
ugexe for some reason i interpreted your point as the opposite 17:10
zostay sort(*.chars) is like .map({ (.chars, $_) }).sort({ $^a[0] <=> $^b[0] }).map({ .[1] }), but just using .chars should be super fast already.
chloekek p6: [=>] ((1, 2).Seq, (3, 4).Seq, (5, 6).Seq).Seq
17:10 evalable6 left
camelia Potential difficulties:
Useless use of [=>] in sink context
at <tmp>:1
------> 3<BOL>7⏏5[=>] ((1, 2).Seq, (3, 4).Seq, (5, 6).Seq
17:10
AlexDaniel m: dd [=>] ‘fo’.comb
camelia :f("o")
chloekek p6: say [=>] ((1, 2).Seq, (3, 4).Seq, (5, 6).Seq).Seq
camelia (1 2) => (3 4) => (5 6)
AlexDaniel m: dd ([=>] ‘fo’.comb)
camelia :f("o")
AlexDaniel chloekek: yes, but if you know you only have two elements… :)
chloekek Oh, right.
p6: ((1, 2).Seq, (3, 4).Seq, (5, 6).Seq).Seq.map([=>] *).say
camelia Too few positionals passed; expected 2 arguments but got 1
in block <unit> at <tmp> line 1
chloekek p6: ((1, 2).Seq, (3, 4).Seq, (5, 6).Seq).Seq.map({[=>] $_}).say 17:11
camelia (1 => 2 3 => 4 5 => 6)
chloekek Lol neat.
Yeah I like { .[0] => .[1] } better but thanks anyway. :D
Geth whateverable: dc02c9d801 | (Aleks-Daniel Jakimenko-Aleksejev)++ | xt/evalable.t
Remove r: shortcut from tests

It's no longer used, see 0df60933433a9becd7dfff73f913ef24f2c0312c.
17:12
whateverable: ce2fde35a5 | (Aleks-Daniel Jakimenko-Aleksejev)++ | lib/Whateverable/Replaceable.pm6
Remove use of `return` outside a routine

After rakudo upgrade it now correctly says:
   Attempt to return outside of immediately-enclosing Routine
And I'm surprised it didn't cause any issues before.
17:12 evalable6 joined, ChanServ sets mode: +v evalable6
AlexDaniel m: say ‘die one more time please’
17:12 evalable6 left
camelia die one more time please 17:12
AlexDaniel tobs: thank you, it should be fixed now, I think 17:13
17:13 evalable6 joined
AlexDaniel m: say 42 17:13
camelia 42
AlexDaniel e: say 42
evalable6 42
AlexDaniel \o/
it is
tobs AlexDaniel++
what was it? Can't you return immediately from a `start {}` block? Did that change? 17:14
AlexDaniel tobs: start block is not a routine, you can't return from it
m: start { return 42 }; sleep 1
camelia Unhandled exception in code scheduled on thread 4
Attempt to return outside of any Routine
in block at <tmp> line 1
AlexDaniel 6c: start { return 42 }; sleep 1 17:15
let's see when that was fixed
tony-o_ AlexDaniel: do you have a case where that is wrong?
committable6 AlexDaniel, gist.github.com/84404e5abde6ff2932...b74fa5166f
AlexDaniel m: my @a = ‘f’, ‘f c’; @b = qw<abcdef cdefg>; say @a.sort(-*.chars).grep({ @b.contains: $_ }).first; 17:16
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '@b' is not declared
at <tmp>:1
------> 3my @a = ‘f’, ‘f c’; 7⏏5@b = qw<abcdef cdefg>; say @a.sort(-*.ch
AlexDaniel m: my @a = ‘f’, ‘f c’; my @b = qw<abcdef cdefg>; say @a.sort(-*.chars).grep({ @b.contains: $_ }).first;
camelia f c
AlexDaniel tony-o_: there
tony-o_ ah 17:18
AlexDaniel tobs: yeah, seems like it was somewhat okay previously
bisect: start { return 42 }; sleep 1
bisectable6 AlexDaniel, Bisecting by exit code (old=2015.12 new=082c09e). Old exit code: 0
tony-o_ then add the .all back in - it's still fewer double greps
bisectable6 AlexDaniel, bisect log: gist.github.com/6310ed86c9481e9d87...621f3189fa
AlexDaniel, (2018-11-02) github.com/rakudo/rakudo/commit/15...590e2d87c1
tobs I mean that's what you pointed at in the Replaceable source code. 17:19
AlexDaniel tobs: yeah, there was a `return` in the start block, and looking at the commit mentioned by bisectable, I think it was throwing an exception that was not shown anywhere instead of actually returning 17:20
tobs aha, 2018-01. In terms of Rakudo releases (my unit of change), that's not too long ago.
AlexDaniel 2018-*11*, indeed not too long ago :)
tobs oh yeah
AlexDaniel c: 2018.10 start { return 42; CATCH { default { .say } } }; sleep 1 17:21
committable6 AlexDaniel, ¦2018.10: «Attempt to return outside of any Routine␤ in block at /tmp/Far1pDmxUE line 1␤␤»
AlexDaniel tobs: yeeeep
jnthn: this is amazing. `return;` out of a start block used to work because it was throwing an exception that wasn't shown anywhere 17:22
or at least that's my understanding of what happened there :)
17:29 sauvin joined 17:55 zakharyas left
vrurg SmokeMachine: BTW, what is the status of caching? 17:55
SmokeMachine vrurg: incomplete... but what’s done is working... 17:56
It do not invalidade cache yet... 17:57
vrurg Had to ask before implementing own variant... :)
SmokeMachine There is a memory cache example...
vrurg Ah, then ok. I need invalidation. That's actually where the phasers issue came from. :)
17:58 robertle joined, [Sno] joined
SmokeMachine vrurg: and this: github.com/FCO/Red-Driver-Cache-Redis 17:59
18:00 reportable6 left
SmokeMachine It do not invalidate when you insert or update, but invalidate by time... 18:00
vrurg BTW, what do you use as cache key? id?
SmokeMachine This module uses redis, and the memory one just uses a hash... 18:02
18:02 pamplemousse joined
vrurg I mean, how does it work with complex searches? Say, I have a DB of districts, searching by district-type => 'county', name => 'Palm Beach', updistrict-id => state-id 18:03
SmokeMachine It uses the generated AST as the key... 18:04
18:04 reportable6 joined
vrurg Yes! :D 18:04
SmokeMachine There is a role that can transform that ast into a string (that’s what I use on redis) 18:05
vrurg Simple and ingenious!
SmokeMachine vrurg: github.com/FCO/Red/blob/master/lib...he.pm6#L71 18:06
vrurg Thanks! Will be waiting for invalidation.
I see. Really like the idea. 18:07
vrurg did not forget about the tests. 18:08
SmokeMachine and this is how I translate to string: github.com/FCO/Red/blob/master/lib...ey.pm6#L21 18:13
its not invalidating yet, but: github.com/FCO/Red/blob/master/lib...nWrite.pm6 18:15
18:18 marcel_ left
Geth doc: 30d16ad3d3 | Alexander++ (committed using GitHub Web editor) | doc/Language/regexes.pod6
Correction of minor errors introduced in recent update

Consistency in discussion order of 'm' and 'rx'; inserted missing word "This"; correction of link to adverb section (link should not only be to regex advers); inserted missing word 'named'.
18:18
synopsebot Link: doc.perl6.org/language/regexes
18:20 pilne joined 18:25 sauvin left 18:31 Black_Ribbon joined 18:33 pecastro joined, Black_Ribbon left, Black_Ribbon joined 18:55 satori__ joined 19:02 jaldhar left
cpan-p6 New module released to CPAN! App::nm2perl6 (0.0.2) by 03JGOFF 19:16
19:20 Black_Ribbon left, Black_Ribbon joined 19:28 lichtkind joined
SmokeMachine m: my Array[Int] $a .= new(1,2,3); dd $a>>.Str # that seems odd... should it be a typed array? a Int typed array? 19:29
camelia Array[Int].new("1", "2", "3")
SmokeMachine m: my Array[Int] $a .= new(1,2,3); .^name.say for $a>>.Str 19:30
camelia Array[Int]
SmokeMachine m: my Array[Int] $a .= new(1,2,3); .^name.say for |$a>>.Str
camelia Str
Str
Str
lichtkind i have issue with an AoA which i can assign onle to element [0][0] rest is immutable 19:33
19:33 Itaipu joined 19:35 Itaipu_ left 19:41 Black_Ribbon left 19:46 zakharyas joined 19:47 pamplemousse left 19:48 pamplemousse joined 19:52 Black_Ribbon joined, pamplemousse left 19:59 candr joined
candr maybe more of a unix question, but how can I redirect a never ending stream of 'y\n' to a perl6 script... 20:00
El_Che yes | my-script.p6 20:04
20:05 molaf joined
candr ha.. i actually wrote a yes.p6 that did that.... didn't know there war a /usr/bin/yes 20:07
my script crashes with it though. prob bad design on my behalf 20:08
El_Che yes, a simple yes loop is a lot of imput. It depends how you cache or handle rh input 20:10
what are you trying to do? a yes implementation or something that can handle lots of fast input?
candr part of my code uses Term::ReadKey for interactive and unbuffered input and that is where thee yes pipe is failing i think 20:15
i have an integration test that periodically requires user input and i want to be able to run it in the laziest way possible =)
El_Che I tend to test that kind of stuff by generating data in the test and have the sub in question accept different kind of outputs (e.g. wrap it) 20:20
some people here may have different strategies
but I try to avoid extrernal programs, inckuding the shell 20:21
(too situation/environment dependant)
candr good advice 20:23
thx
El_Che also, I expect the external lib to do their own testing, so I don't want to have tests specific for the functionality of that lib 20:29
if I need them (e.g my app need huge input) I'll send the test upstream
most people appreciate it
20:31 wildtrees left 20:34 candr left 20:35 candr joined
candr ok. i ended up creating a $test-mode bool that can be set by the integration test. i generate the test input and the bool switches off any user acknowledgment code that was annoying when running the tests. 20:36
20:36 molaf left
El_Che candr: make it a multi sub/method? 20:37
candr: that call the *real* sub/method?
(and document only the "real" one, as part of the API)
I haven't done it one p6 yet, but I remember overwriting methods in perl 5 and test those, so the real source code did get extra code 20:39
candr hmm.. .could do that... i was thinking the $test-mode bool might come on useful later, but i do hate having global stuff...
El_Che candr: sure, you know your code layout best 20:40
candr I always welcome outside ideas. Easy to start coding with blinders on. 20:43
20:45 Xliff joined 20:46 zakharyas left
Xliff m: sub fits-into-num32(Num $n, $precision = $*TOLERANCE) { my num32 $x = $n; abs($x - $n) < $precision }; my $n = Num(3.14159265359); for 1e-7, 1e-8 { say fits-into-num32($n, $_); } 20:58
camelia True
False
20:59 lichtkind left 21:10 pamplemousse joined 21:13 chloekek left 21:15 pamplemousse left 21:19 rindolf left, rindolf joined
El_Che AlexDaniel: make sure to add the misc 99 test fix to the next release :) 21:51
relaunching rakudo i386 build ...
:)
21:59 rindolf left 22:10 jx3 joined
Geth doc: threadless-screw++ created pull request #2927:
Rewrite of regex interpolation section
22:20
El_Che $ for i in rakudo rakudo-star perl ; do echo -ne "$i: "; brew info $i| grep install_on_request; done 22:22
rakudo: install_on_request: 17 (30 days), 39 (90 days), 141 (365 days)
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3install_on_request: 177⏏5 (30 days), 39 (90 days), 141 (365 days)
expecting any of:
infix
infix stopper
statement end…
El_Che rakudo-star: install_on_request: 172 (30 days), 579 (90 days), 3,979 (365 days)
perl: install_on_request: 3,044 (30 days), 14,576 (90 days), 44,310 (365 days)
rakudo is new in comparison with rakudo-star, hence the difference
22:22 pecastro left
El_Che the interesting part is the comparison with perl 22:22
if people want to get depressed: 22:24
$ for i in python ruby golang ; do echo -ne "$i: "; brew info $i| grep install_on_request; done
python: install_on_request: 241,178 (30 days), 583,949 (90 days), 2,457,702 (365 days)
ruby: install_on_request: 23,962 (30 days), 79,659 (90 days), 417,300 (365 days)
golang: install_on_request: 75,776 (30 days), 223,157 (90 days), 845,192 (365 days)
22:25 Cabanossi left 22:27 Cabanossi joined
sena_kun El_Che, this is not so bad, considering that OSX is not a primary OS for a lot of people and all the implications by "a relatively young implementation", "what is perl 6, a new version" etc etc. 22:31
El_Che of course, even homebrew is just a subset of how people get software 22:32
sena_kun: nevertheless the same argument applies for the other languages there
sena_kun El_Che, if you want to be more depressed, you can e.g. look at vlang and observe how a transpiler into horrible C that leaks memory even for hellp world gets attention. ;) 22:34
El_Che anyway, my point is kind of positive. Perl 6, hopefully with a new name, must be marketed as a new interesting languages, not as the Perl5 sister language or succesor
sena_kun El_Che, for all the other languages, well, a bandwagon effect is a scary thing.
El_Che macos is not my primary os
I have a test machine I use on the train (and now on holiday) 22:35
I am thinking of adding macos to rakudo-pkg, but I wonder if it's worth the effort
22:35 pecastro joined
El_Che (having now rakudo standalone in homebrew) 22:35
sena_kun needs to add some slides to ASN.1 talk 22:36
El_Che sena_kun: is it progressing?
sena_kun: make a references to certificates, it may ring a bell for some people 22:37
sena_kun El_Che, LDAP talk is ready, ASN.1 one is almost ready too, though I think it is a bit too short, though I suspect it'll be worse/slower for me before people. 22:38
El_Che, well, a spoiler ahead, I'll mention ASN.1 works in space, cell phones, laptops... ;)
El_Che sena_kun: I time my talks. When nervious is always shorter than timed :)
sena_kun: looking forward for the video 22:39
sena_kun El_Che, while using written English daily, my speaking English is something that I rarely have to use, so I add some time for additional "Eeeh, Eeeeeh" for me to say. ;) 22:40
El_Che yeah, it's better to talk slowly and "overdo" the pronounciation thing 22:41
thing it sounds exaggerated to us, non native-speakers, but the audience will thank you for that
(and certainly non-native english speakers in the audience)
(most of the audience probably)
22:42 nepugia joined
sena_kun El_Che, won't people kill me for occasional mistakes? 22:42
d'oh, I guess they won't, of course.
El_Che sena_kun: they only kill you for syntax errors in your slides :) 22:43
sena_kun El_Che, English syntax or Perl 6 syntax? ;)
Kaiepi man whenever i'll probably eventually speak at a perlcon non-native speakers may have trouble understanding me since i don't really enunciate very well and have a pretty monotone voice 22:44
El_Che Most programmers are crappy writers, so code :)
sena_kun well, I already did quite a mistake when used the "metacompilation" word, because I meant a totally other thing and jnthn has said it is suitable here, but a couple of days ago I re-checked it and "Oh wow, that's a great failure I have here".
El_Che yeah, sometimes native speakers (one of the many variations) are hard to understand
22:45 telex joined
El_Che and some use very localized references (e.g. television on another continent from 40 years ago) that are hard to grasp 22:45
sena_kun I copy my code straight from the editor with a working version, at least it should work for me if not for others... 22:46
Kaiepi never live code, your audience will thank you for it
El_Che yeah, it explodes more often than not
don't rely on the wifi 22:47
sena_kun no demonstration, and I have only 20 minutes each, so should be sa-a-afe
El_Che (a counter points: non-native english speakers that speak several languages are usually quiete capable of understanding accents) 22:48
a big part of the audience if this type of conference is multilingual, so that's a plus
Kaiepi you should hear the dialect some people speak where i live, it's just as bad as boomhauer's from king of the hill 22:49
El_Che lol
(luckily I get *that* reference)
Kaiepi like can you understand this: "she's a pisscuttin' er ainshewha?"
(that means "it's going fast, isn't it?") 22:50
El_Che (I did get that, wow) 22:51
most trouble I had was in the Australian outback, in Belice and with an english speaking South-African client with a Cockney accent (we agreed he could speak Afrikaans to me) 22:52
(close enough to dutch)
23:02 khisanth_ left
Kaiepi i should talk here more often, the reason i don't is i keep hexchat on a separate desktop from the one i usually use 23:04
maybe i should get a second monitor
23:05 pecastro left 23:07 uzl joined
El_Che :) 23:07
uzl o/ Is there difference between placing 'use' before (use SomeModule; unit class A;) a unit-scoped package and placing it within it (unit class A; use SomeModule)? 23:09
timotimo modules are able to change the parser
in that case it can make a difference if it's before the unit declaration
Kaiepi yeah, like if the module were a slang 23:10
timotimo or something like Red or OO::Monitors that introduce a new kind of package, like "model" or "monitor" instead of "class" 23:11
23:11 sena_kun left
uzl For basic usage (e.g, modules that don't change the parser), what's the recommended way of doing it if any? 23:12
23:12 Elronnd joined 23:15 khisanth_ joined, gfldex left
uzl ...Or most common usage? 23:17
23:18 nepugia left
timotimo shruuuuug 23:19
Xliff Slangs are the most common usage.
github.com/tony-o/perl6-slang-sql 23:20
23:21 gfldex joined
Xliff timotimo: Would EXPORT be the best place to initialize parser changes like in Slang::SQL or would INIT be a better choice? 23:21
timotimo i don't think INIT would work? 23:25
Xliff Oh? 23:30
Crap.. gotta restart...
23:30 Xliff left 23:31 Xliff joined 23:37 Xliff left 23:42 astronavt joined, Xliff joined 23:45 jx3 left
astronavt alright im finally gonna give perl 6 a shot. especially interested in the type system. does rakudo check types at compile time? 23:45
Xliff m: my \Δ = (4, 4); my $a = "(1, 1)\n(2, 2)\n(3, 3)"; $a ~~ s:g/'(' (\+d) ',' \s* (\d+) ')'/({$0.Int + Δ[0]}, {$1.Int + Δ})/; $a.say
camelia (1, 1)
(2, 2)
(3, 3)
Xliff m: my \Δ = (4, 4); my $a = "(1, 1)\n(2, 2)\n(3, 3)"; $a ~~ s:g/'(' (\+d) ',' \s* (\d+) ')'/({$0.Int + Δ[0]}, {$1.Int + Δ[1]})/; $a.say 23:46
camelia (1, 1)
(2, 2)
(3, 3)
23:46 [particle]1 left
Xliff my $a = "(1, 1)\n(2, 2)\n(3, 3)"; say $a ~~ /'(' (\+d) ',' \s* (\d+) ')'/; 23:46
evalable6 Nil
timotimo astronavt: in some cases, yes. anything involving non-private methods won't compile-time-type-check because the object is responsible to decide what "a method call" means
Xliff my $a = "(1, 1)\n(2, 2)\n(3, 3)"; say $a ~~ m:g/'(' (\+d) ',' \s* (\d+) ')'/;
evalable6 ()
astronavt timotimo thats.... more complicated than i expected 23:47
Xliff my $a = "(1, 1) (2, 2) (3, 3)"; say $a ~~ m:g/'(' (\+d) ',' \s* (\d+) ')'/;
evalable6 ()
timotimo perl6 OO is closer to the original concept of OO where "call a method" is a little more like "send a message"
Xliff my $a = "(1, 1) (2, 2) (3, 3)"; say $a ~~ m:g/'(' (\d+) ',' \s* (\d+) ')'/;
evalable6 (「(1, 1)」
0 => 「1」
1 => 「1」 「(2, 2)」
0 => 「2」
1 => 「2」 「(3, 3)」
0 => 「3」
1 => 「3」)
Xliff /o\
m: my \Δ = (4, 4); my $a = "(1, 1)\n(2, 2)\n(3, 3)"; $a ~~ s:g/'(' (\d+) ',' \s* (\d+) ')'/({$0.Int + Δ[0]}, {$1.Int + Δ[1]})/; $a.say 23:48
camelia (5, 5)
(6, 6)
(7, 7)
astronavt timotimo interesting. but at the end of the day its still calling functions ("sending messages"), which have typed signatures. right?
23:48 lucasb left
timotimo well, there's multiple phases to a method call; first is method resolution to get from a method name to a callable, then usually multiple dispatch happens to get the right candidate 23:49
astronavt Xliff this looks like "unpacked" APL
timotimo a class may implement its own ^find_method, which lets it generate new methods on the fly based on method names
astronavt timotimo what about subroutines? or whatever perl calls functions that arent methods
timotimo they are lexically scoped, so at compile time their signatures are fixed, type checks will happen for them 23:50
astronavt ah. interesting. python has the ability to override attribute lookup as well, but i daresay its considered bad practice nowadays
timotimo m: sub do-the-thing(Int $foo) { }; do-the-thing("hello")
camelia 5===SORRY!5=== Error while compiling <tmp>
Calling do-the-thing(Str) will never work with declared signature (Int $foo)
at <tmp>:1
------> 3sub do-the-thing(Int $foo) { }; 7⏏5do-the-thing("hello")
Xliff astronavt: HAH! Ah... APL
astronavt great timotimo thats the kind of error id want to see
timotimo if you see a "===SORRY!===" that almost always means you're looking at a compile-time error 23:51
astronavt Xliff perl 6 still seems easier to me than learning J, so here i am
timotimo rakudo will not compile-time-typecheck things with "where" clauses, though
astronavt thats because 'where' can be arbitrary code right? youd need a whole dynamic type system for that
timotimo that's right 23:52
astronavt im ok with that, data contract vs type system
timotimo for a subset of that stuff, it could be implemented; i would however claim that that could lead to unhappy surprises
Elronnd astronavt: yeah, I pretty much gave up on learning J
seemed cool, though
timotimo i.e. when a minor version of rakudo comes out that implements checks against more "where" expressions, and you have some dead code that used to never cause trouble, and suddenly your module doesn't compile any more
astronavt yeah, i wouldnt expect them to 23:53
Xliff "J"? What's up with that? Were all the cool letters taken?!
Xliff thunks...
astronavt thats getting into like... template programming
Xliff Yeah... that seems about right.
Wait.. what about calling a language "X"! X" is a cool letter! 23:54
astronavt timotimo i would ask them to check that the expression (is that the word?) after 'where' is validly typed though
as in, it returns something boolean (or castable to boolean) and all the function calls have the correct types 23:55
s/them/the compiler/
23:55 Xliff left
timotimo where does smartmatch, though, which is a bit more than boolean stuff 23:55
astronavt i should have guessed thered be more to it
timotimo :) 23:56
Elronnd there's a website somewhere that collected all the languages with single-letter names
forget where it is though
timotimo often you'll want a whatevercode, but ranges are also a good thing to put in there
astronavt ~~ is smartmatch?
timotimo yeah, that's how you get a smart match operation explicitly
some things do it implicitly; grep for example will perform a smartmatch against list elements for you
m: say (1, 2, 3, 4, 5, 6).grep(3..^5) 23:57
camelia (3 4)
astronavt m: say "a" ~~ "b"
camelia False
astronavt m: say "b".ACCEPTS("a")
timotimo "when" statements (often found inside of "given") will also do smartmatch for you
camelia False
Elronnd you can use when without given? 23:58
timotimo yep
Elronnd ohh, right, it just does smartmatch on $_
*that*'s clever
astronavt m: multi factorial(Int $ where 0) { 1 }; multi factorial(Int $x) { $x * factorial($x - 1) }; say factorial(5);
camelia 120
astronavt yep i can get used to this
and how hard is it to call C from perl 6? thinking about implementing scientific stuff built on C and Fortran libs 23:59
Elronnd except you probably want the second one to say when >0
ugexe multi factorial(0) { 1 }
astronavt Elronnd i got that from the docs :)
timotimo it's super easy to call C from p6
Elronnd astronavt: it's really easy for trivial functions