»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:, or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend!
Set by moritz on 22 December 2015.
agentzh otherwise we have to stick with $!foo for all those containers for optimal perforance. 00:00
*performance
00:00 lukaramu_ left
agentzh because the compiler cannot generally avoid array/hash copying with the semantics dictate so. 00:00
raschipi The semantics don't dictate that at all. 00:01
agentzh i mean the default semantics in new() for @.foo and %.bar.
raschipi I said above, it's possible to pass things as copies, or to alias them, both ro and rw.
agentzh it's a value copying instead of binding.
raschipi Well, the default signature for 'new' is made to enforce a bit of hygiene. Especially because there are modules that use simple classes to do parallel computation. 00:02
agentzh yes, you said that. my point is that writing a generic custom version of new() would require MOP which might void any performance benefits if the compiler is not smart enough to optimize that away and writing specialized version of new() for every class is too much a burden for p6 programmers. 00:03
that's why i'm proposing the `if ref` attribute trait. 00:04
raschipi It doesn't require messing with the MOP. Just write a class and inherit from that. Can be done directly.
You don't need to change Mu's new. Write a new one.
agentzh but it need to know what attributes each class has and which are containers and etc.
*needs
raschipi And then inheritance makes sure every other class get's it.
Look at how the existing Mu's new does it. 00:05
It can build any object, doesn't it?
agentzh mind to give me a hint on which rakudo file i should look at? ;) 00:06
raschipi It uses named parameters for it. If you put a parameter that doesn't exist, it will fail because of missing parameter.
agentzh i see it only contains a single call: nqp::invokewithcapture(nqp::findmethod(self, 'bless'), nqp::usecapture()) 00:08
am i looking at the right place?
raschipi github.com/rakudo/rakudo/blob/nom/...core/Mu.pm
agentzh seems like most of the logic is in BUILDALL, right? 00:09
nqp stuff all over that method.
raschipi: i cannot use nqp in my p6 code. so what's my new() method will look like then? 00:10
*what
speaking of all those nqp::* calls which seem to construct some kind of AST structure, maybe you guys can use some macro language to make that Mu.pm file look much nicer? 00:12
like Haskell's QuasiQuote. 00:13
MasterDuke agentzh: may be relevant, quote from timotimo over in #moarvm today, "in the future, we'll actually generate a proper code object for executing the buildplan. i tried to do that already, but i got quite mysterious errors"
agentzh MasterDuke: oh, that sounds very interesting.
MasterDuke we were talking about it, but for completely different reasons
(than you are)
agentzh k
MasterDuke: so what's your opinion on my "is ref" proposal? 00:14
just want to know if it's a horrible idea.
:)
raschipi MasterDuke: Macros is comming, but it's complicated and will take time. 00:15
MasterDuke agentzh: i'm afraid i don't know enough (about OO, P6's MOP, etc) to even have an opinion
agentzh raschipi: oh really?
raschipi We want something as powerful as Lisp has.
agentzh raschipi: sweet! where can i find the design doc?
00:15 pmurias left
MasterDuke agentzh: i'd mention it over in #perl6-dev to jnthn and lizmat, see what they have to say 00:15
agentzh MasterDuke: okay, thank you all the same.
raschipi People think Lisp has modifiable syntax as Perl6 has, but it's all macros.
agentzh MasterDuke: sounds cool. 00:16
thanks!
MasterDuke agentzh: pretty much all the macro work is being done by masak, in his 007 repo
agentzh url?
raschipi agentzh: I don't know enough to help you more, you'll need to ask again some other time. I was just helping you understand what's going on.
agentzh raschipi: thank you.
raschipi np
MasterDuke github.com/masak/007 00:17
agentzh: it might be nice to see a couple line example of what you have to do now, and what it would look like with your new trait 00:20
raschipi Anyway, "new" is hygienic by design. Monitors and Actors (github.com/jnthn/oo-monitors, github.com/jnthn/oo-actors) need it and it's important to make those easier to use than to avoid a few copies. 00:22
00:23 rburkholder left
raschipi Anyway, how many objects are you building? 00:24
00:24 TimToady left
raschipi Aren't you making premature optimization? Have you measured the time it takes to copy the Arrays to be significant? 00:24
agentzh raschipi: i'm building a compiler 00:25
so there is a lot of objects (for AST nodes)
00:25 TimToady joined
agentzh we'd like to reuse the Array objects already allocated by the parser in the AST nodes. 00:25
instead of doing copy and new allocations. 00:26
there's a lot of such things which can not be ignored.
raschipi Why do you need another compiler?
agentzh the overhead of dynamic allocations and data copying already outweight the overhead of parsing itself.
not general purpose compilers, but DSL compilers for high performance web gateways. 00:27
used by CDN and ISP vendors.
raschipi Write a grammar and be done with it.
agentzh it has to be an optimizing compiler. 00:28
so an AST is a must.
raschipi The grammar will giv you the AST.
agentzh not the one we really need. 00:29
the algorithms are complicated.
raschipi Write a grammar that builds the AST you need.
agentzh OO makes the AST much more useful.
raschipi Yeah, make the grammar build the AST with objects. 00:30
agentzh otherwise i'll end up with a lot of similar but different "copying rules" as found in a typical Haskell based compiler.
raschipi The Grammar calls arbitrary code when it matches, make that return objects.
agentzh raschipi: perl 6's grammar engine is not so optimal due to its aggressive allocations of $/ Match objects. 00:31
so we are using our own much faster grammar engine instead.
raschipi I guess it would be more time-efficient to make Perl6's engine work better than writing another one. 00:32
Because you'll have others helping you.
Instead of fighting the language, work with it. 00:33
hobbs where are you getting the idea that it's not already written?
00:34 aborazmeh joined, aborazmeh left, aborazmeh joined, cpage_ left
agentzh raschipi: our engine is already 30x faster with real world input than rakudo's one since it's much simpler. it would be much harder to get similar speedup in rakudo. 00:34
but anyway, thank you for your suggestion. 00:35
it's a much simpler grammar engine, using the rule syntax of Damion's Parse::RecDescent and Ingy dot Net's Pegex. 00:36
instead of supporting the perl 6 regex syntax.
the latter is much more complicated.
(and also much more powerful, of course)
raschipi The idea is to make the grammar engine capable of doing all of this work. It's not there yet. 00:37
agentzh well, anyway, we'll try implementing the "is ref" trait in our own perl 6 dialect compiler, fanlang, and see how it goes.
fanlang is already mature enough to be used to build a DSL compiler. 00:38
raschipi Nice. Make sure to bring any improvements you make to #Perl6-dev to take maintenece off your back (if it's accepted). 00:39
agentzh raschipi: already dropped a note in #perl6-dev. thanks for the reminder. 00:40
raschipi I guess you'll be rewriting "new" anyway, since it will have to know about "is ref" attributes.
agentzh well, it would be inside the compiler. 00:41
instead of on the language level.
raschipi "new" isn't at the language level. It's a normal method. 00:42
agentzh i know, it's different in our own perl 6 dialect :)
00:45 cpage_ joined
raschipi They were discussing how people have problems because they took shortucts by using libuv and now direct access to STDOUT and STDIN was mangled when using NativeCall. Perl6 has to be fast but can't just define "new" as sytax like that, because people would be confused when trying to redefine it. 00:46
Anyway, they make it easy to do it if you want. 00:47
00:50 cpage_ left 01:25 Cabanossi left 01:28 Cabanossi joined
raschipi agentzh: How is the name of your project? People always come and ask for big projects in Perl6, so yours is a good example. 01:30
01:34 cyphase joined
AlexDaniel raschipi: fanlang? 01:37
raschipi That's his slang, and what about the web-scale DSL compiler?
01:45 ilbot3 left 01:47 kent\n joined 01:48 ilbot3 joined, ChanServ sets mode: +v ilbot3
agentzh raschipi: the largest p6 project i wrote is called edgelang-p6, 8K LOC. it's not open sourced though. 01:51
and my perl 6 dialect compiler is called fanlang, the compiler itself is written in perl 5, and it's also not open sourced yet.
raschipi There's a guy running a radio statio with 100K just of public released code.
agentzh wonders who long it would take to compile that p6 project. 01:52
AlexDaniel agentzh: this sounds very interesting
agentzh AlexDaniel: thanks 01:53
AlexDaniel … but it will be even more interesting once I see the code :)
agentzh AlexDaniel: we'll sell licenses of the fanlang compiler as part of our OpenResty Edge product.
AlexDaniel ouch…
agentzh and we'd like to provide free personal licenses to official perl 6 team members. 01:54
AlexDaniel 🤷
MasterDuke well, i don't think it's 100k in one project, but 100k lines in many modules, though most of which were inspired by his needs
agentzh MasterDuke: then that makes much more sense, otherwise it won't be debuggable with rakudo :)
mine is a single program.
and 8K already makes it not debuggable with rakudo on my top-spec mid-2015 macbook pro 15 inch laptop. 01:55
*8K LOC
so i only managed to make my edgelang-p6 project compile with rakudo, but never pass the test suite.
raschipi Putting things in modules gets them pre-compiled. 01:56
MasterDuke rakudo itself is 52k, and that takes 90s to compile on my machine
agentzh raschipi: precompiling is still too slow.
i tried everything. 01:57
the fastest approach is to concatenate all the pm6 files into a single p6 script.
that's the fastest.
much faster than a typical incremental compilation using .precomp.
AlexDaniel MasterDuke: huh! Wait what? If you run “make”, it takes only 90s?
agentzh but still taking 6 sec.
raschipi It's by design: www.xkcd.com/303/ 01:58
MasterDuke AlexDaniel: the compiling CORE.setting part does. a full make is longer
AlexDaniel ah, okay
agentzh lol 01:59
raschipi: that picture is fun.
01:59 wamba joined
llfourn agentzh: I just tested spitsh precomp. It takes 14s :< 02:00
agentzh so we quickly ported our edgelang-p6 over to our perl 6 dialect, fanlang.
it's finally passed the whole test suite of edgelang-p5.
llfourn: ouch. 02:02
llfourn It doesn't bother me so much. A bit like the XKCD. I need time to think inbetween changes and sip my drink. 02:03
it runs fast enough at runtime that it doesn't bother me
although it's still slow at runtime because I'm not able to precomp my spit code yet :\ 02:04
but once i can it should be < 1s to compile a shell script from spit code.
raschipi Languages that compile ahead of time usually just assume they can take as much time as they want, programmers don't mind it. 02:06
Perl5 had to compile fast, P6 not so. 02:07
llfourn yep!. Though I wouldn't complain we were able to shave a 50% off the compile time. 02:08
raschipi llfourn: It will actually get longer as time goes on, because more will be added to the optimizer. 02:09
agentzh llfourn: when i'm debugging problems, i need instant feedback for every single change i make :) 02:11
it's all about interactions, not much thinking needed in between.
just edit, run test, edit, run test.
quick small cycles.
test driven development :)
llfourn raschipi: hopefully nqp->moar becomes fater to account for some of that :)
agentzh without this, we cannot build fanlang from scratch to the current shape in just 4 months. 02:12
fortunately perl compiles very fast.
*perl 5
some bugs are very deep and obscure
*were 02:13
raschipi I guess it could be configurable, like a -O0 would be fast.
agentzh nope, i tried, it's not really faster.
maybe a little bit.
the optimizer is never the bottleneck for me.
raschipi Yeah, it could be made faster, I mean.
MasterDuke TimToady has said he's going to work on the grammar engine soonish, that should help speed up compiling
agentzh raschipi: got it. 02:14
MasterDuke agentzh: and i'm with you on the tiny change, compile, tiny change, compile loop 02:15
raschipi Let's hope Timtoady can make it fast enough so that it could solve agentzh use case.
Instead of having to write a new parser, get one fast enough from the start. 02:16
llfourn agentzh said that fanlang will be able to parse itself soon I think so i guess that won't be of concern. 02:17
but it sure would help me!
though I've learned to have longer edit cycles
TimToady one has to backlog sometime :) 02:18
but yeah, there's plenty we can do to get the parser faster
raschipi TimToady: do you have an opinion about the "is ref" idea agentzh had above? 02:19
TimToady haven't had a chance to backlog yet :) 02:20
will look at it tomorrow
llfourn (I hopefully convinced agentzh to change it to is raw)
MasterDuke TimToady: also some more discussion about it in #perl6-dev
raschipi I don't like "ref" too, P6 doesn't have references.
TimToady well, or everything is a ref... 02:21
raschipi When everything is a reference, nothing is a reference.
b2gills The code to add a `is ref` (or `is raw`) to Rakudo is basically the same as it would be in a module
raschipi It would be very confusing to have something being called a reference when every other thing is a reference too.
llfourn b2gills: yeah we had this conversation in #perl6-dev. it definetly belongs in a module first. 02:22
b2gills m: say +&trait_mod:<is>.candidates 02:24
camelia 59
b2gills llfourn: I backlogged there first 02:25
TimToady is too brainfogged to backlog tonight
been kind of a tough week, what with one thing or another, and sunday is supposed to be a day of rest in my religion :) 02:26
llfourn TimToady: rest well :) 02:27
BenGoldberg The Sabbath is the day of rest for a few major religions ... now if only we could all agree on what day of the week it was ;) 02:28
MasterDuke or even what rest is
llfourn the simplest solution is to just make all of them.
TimToady which day is not the important ting
*th
llfourn make it all of them*
BenGoldberg llfourn++ ;)
TimToady :)
hobbs llfourn: that's what the robots-taking-our-jobs is for 02:29
agentzh llfourn: yeah, i now think `is raw` is better given that we already have it in signatures. 02:30
BenGoldberg Once upon a time, you were supposed to do this thing called "recreation" ... which *originally* meant studying creation.
agentzh TimToady: ingy dot net is now working with me on our perl 6 dialect compiler! :D
TimToady: it's his full time job now *grin* 02:31
llfourn hopefully the society these busy robots create leave us something to do :)
agentzh TimToady: and it's also mine ;)
TimToady the more, the merrier :) 02:32
agentzh lol, definitely.
our team has 5 engineers now.
all working on perl 6 or writing in perl 6.
or both!
the 6th one is joining us tomorrow. 02:33
*grin*
skids note "has $.foo is rw" and "method new ($foo is rw)" do not do the same thing.
agentzh skids: yeah, i was aware of that. 02:34
just arguing for "symmetry".
like in quantum mechanics.
b2gills Is the regex design of Funlang more similar to regexes in Perl 5 or Perl 6, or to BNF/ANTLR 02:35
agentzh b2gills: right now, we use damion's Parse::RecDescent's rule syntax with the perl 5 regex syntax.
it's a mixture.
like in Damion's CPAN module.
we also employ Ingy dot Net's Pegex's + and - notations into the mix.
they are handy. 02:36
we have a complete tested fanlang program here: github.com/agentzh/perl-parsing-li...r/calc.fan
for arith calculator.
and a typical benchmark result is here: github.com/agentzh/perl-parsing-li...rk-results
comparing to rakudo/pegex/parse::recdescent/etc 02:37
02:37 obfusk left
agentzh the largest fanlang program we are currently building is a full fledged DSL compiler called edgelang for CDN/gateway platforms. 02:37
the edgelang compiler in fanlang currently has ~8K LOC. 02:38
still hacking on it.
02:38 obfusk joined
raschipi So you have a program that is compiled by edgeland that is compiled by fanlang that is compiled by Perl5? 02:39
agentzh haha, yes.
raschipi does fanlang passes roast?
agentzh edgelang-fan test suite in action: pbs.twimg.com/media/C70tjqLVMAMi3QC.jpg:large 02:40
b2gills and Perl 5 is compiled by C
agentzh note the first step is "fan -c bin/edgelang.fan"
llfourn there is no way it could pass roast
agentzh the fan utility is a perl 5 compiler that compiles fanlang into lua.
llfourn does fanlang have :=?
agentzh then we use perl to test the resulting lua program.
llfourn: yes!
llfourn cool. 02:41
TimToady roast is about doing it right before we do it fast; it will be interesting to see if the two efforts ever converge...
agentzh TimToady: yeah, maybe.
TimToady: we've been using rakudo as a reference impl in fanlang's test scaffold.
raschipi have you tried to run roast to see how much can it do? 02:42
02:42 noganex joined
agentzh raschipi: hope, since it requires Test.pm to fully work. 02:42
*Test.pm6
llfourn agentzh: you don't have a Test.fan yet :^)?
agentzh we'll write our own fudge script to port the roast test cases over to fanlang's test scaffold, maybe.
we are using TestML in fanlang's test suite 02:43
b2gills You could rig up a minimal test.pm for some of the simpler tests
llfourn agentzh: for spit I wrote Test.spt github.com/spitsh/spitsh/blob/mast...b/Test.spt
raschipi So, you do test driven development for fan, but not in fan? 02:44
02:45 noganex_ left
b2gills It would be helpful to know which tests accidentally implementation specific 02:45
02:47 agentzh left, agentzh joined 02:53 wamba left
raschipi We should actually take the depedency ROAST has on Test.pm, not ask people to reimplement it. 02:56
Ship a simple one. 02:57
03:02 gdonald left 03:03 gdonald joined 03:10 Cabanossi left 03:11 Cabanossi joined 03:24 vendethiel- joined 03:25 vendethiel left 03:28 BenGoldberg left 03:29 khw left 03:34 xtreak joined 03:55 Cabanossi left 03:56 Cabanossi joined 03:58 mr-foobar left 04:03 AlexDaniel left 04:12 raschipi left 04:42 cpage_ joined 04:49 aborazmeh left
agentzh b2gills: yeah, maybe. will try to find a summer intern student to do that for us. 04:49
we use Perl 6's Test::Base/TestML to drive our perl 6 test suite.
it does not need a Test.fan at all.
and much nicer to work with.
something like this: gist.github.com/agentzh/5154642d55...849b0698cf 04:51
sorry, i mean Perl 5's Test::Base/TestML
04:55 Cabanossi left 04:57 Cabanossi joined 05:01 curan joined
llfourn agentzh: I'm a *fan* of having the test suite of a language written in the language itself. 05:01
05:01 ChoHag left
llfourn even when you get it to bootstrap itself it will still need p5 to run the test suite. 05:02
agentzh llfourn: not really, the author of Test::Base and TestML will soon re-implement TestML in fanlang. 05:05
the test suite should be declarative and data driven, it does not matter what language is used to implement it.
and we can still use only one language when it's bootstrapped.
it's just not so relevant.
TestML is a DSL 05:06
the implementation languages of the test scaffold does not really mater.
that's the beauty of it.
you have the freedom to use anything to test anything else.
llfourn *nods* 05:07
agentzh it's a burden to require a Test.pm6 or Test.fan when the compiler were just started and only supported basic functions and operators.
even a simplified one is a burden since you have to add support for modules and use to the compiler.
which is not trivial.
fanlang got its module and compunit support just in last month IIRC.
05:08 xinming left
llfourn that's true. With spitsh I just included builtin &ok, &is etc in the core 05:08
until I had built a basic module system.
agentzh the TestML approach follows the "test the simplest thing that could possibly work" guideline. 05:13
and you can test everything easily from outside, from stdout output, stderr output, to process exit code and command-line options. 05:15
everything.
05:15 mr-foobar joined
agentzh these are kinda hard or requires special tricks to test inside the user program being tested. 05:15
llfourn is each test starting a new compilation? 05:16
agentzh yes
that's isolation
to minimize unrelated stuff. 05:17
llfourn I guess that's preferable sometimes :)
05:17 mr-fooba_ joined
agentzh well, fanlang compiles fast anyway :) 05:18
llfourn but I quite often find bugs because tests that shouldn't affect each other end up doing just that.
05:18 mr-fooba_ left
agentzh llfourn: well, you can merge them together in the test scaffold. it's all data. 05:19
not code.
so you have all the freedom to shuffle, to combine, to run in a different ways.
you have choices.
llfourn yeah that's handy
05:19 mr-foobar left
agentzh thanks to data driven testing :) 05:20
05:20 mr-foobar joined
agentzh you can also run a single test block in isolation by adding a --- ONLY section to it. 05:20
it's very handy for debugging test failures. 05:21
no need to comment out anything in the same file.
05:21 mr-foobar left
agentzh and do not need to worry about unnecessary side effects of previous test cases. 05:21
since every test block (or test case) is self-contained and standalone.
llfourn I definitely see the advantage of that :) 05:22
agentzh we've also been using the same approach to test our nginx C modules and lua libraries: openresty.gitbooks.io/programming-...t/testing/
just in case you are interested.
it can be used to test *anything*.
i really like it.
05:23 mr-foobar joined
llfourn thanks, will check it out. 05:23
05:25 Cabanossi left, cyphase left 05:26 jsoo joined 05:27 domidumont joined, Cabanossi joined 05:28 jsoo left 05:29 xtreak left, xtreak joined, cpage_ left 05:30 cpage_ joined 05:31 mr-foobar left 05:32 mr-foobar joined, xtreak left, xtreak joined 05:33 mr-foobar left, domidumont left 05:34 mr-foobar joined, mr-foobar left 05:39 mr-foobar joined 05:40 mr-foobar left 05:44 tojo joined 05:45 mr-foobar joined 05:47 cyphase joined 05:48 mr-foobar left 05:49 mr-foobar joined 05:51 RabidGravy joined, cyphase left 05:52 mr-foobar left 05:53 gdonald left 05:54 gdonald joined 05:57 wamba joined 05:59 skids left 06:00 cpage_ left 06:03 mr-foobar joined 06:11 Cabanossi left 06:12 Cabanossi joined
RabidGravy Boom! 06:12
06:14 domidumont joined 06:25 mr-foobar left, mr-foobar joined, mr-foobar left
Woodi yo :) 06:26
agentzh: i think would be nice if you include all features nqp have. maybe someone will port rakudo onto fun lang :) 06:27
samcv hi Woodi 06:28
06:28 astj_ joined, astj left 06:30 mr-foobar joined, eroux left 06:31 mr-foobar left
Woodi agentzh: also: I think your current attitude is not quite good for busines: we don't care about you, we just care what we can take from you and we saying that pretty loud :) remember who yours future users can be :) also as commercial entity you should donate to the community, at least expertise :) 06:31
hallo samcv :)
06:34 mr-foobar joined 06:35 darutoko joined, mr-foobar left, mr-foobar joined 06:36 mr-foobar left 06:38 xinming joined 06:41 kyan joined 06:43 mr-foobar joined 06:53 mr-foobar left, mr-fooba_ joined 07:01 koki1 left, koki joined
samcv wooooo i got ignorecase working 07:02
for ligatures. \o/
with regex at least
passes all the ignorecase.t tests :) 07:03
07:04 xtreak left 07:05 cpage_ joined 07:06 mr-fooba_ left, TEttinger left, mr-foobar joined 07:07 mr-foobar left, mr-foobar joined 07:08 mr-foobar left
samcv exciting :) it will actually work properly finally. and when i do it right will hopefully make it faster too. at least that's the plan 07:08
07:09 mr-foobar joined 07:16 mr-foobar left, mr-foobar joined 07:21 mr-foobar left 07:22 mr-foobar joined 07:23 mr-foobar left 07:25 Cabanossi left 07:27 Cabanossi joined, mr-foobar joined 07:28 mr-foobar left, jsoo joined, mr-foobar joined 07:29 mr-foobar left 07:31 jsoo left, sunnavy joined 07:37 mr-foobar joined 07:38 mr-foobar left, mr-foobar joined
llfourn samcv++ #faster 07:38
samcv at least it now works properly. but won't commit until it's as fast as it was before 07:39
need to program a faster version of MVM_string_index_ignore_case
pretty fancy to have working expanding characters working though 07:41
atm only works at the very start of a string
m: say 'st' ~~ m:i/st/
camelia 「st」
samcv but if it's anywhere else it doesn't find it
llfourn to me it's actually rather amazing that that works at all. 07:42
samcv heh. :) that is one of the things i've been working on 07:43
07:43 wamba left
Woodi s/amazing/crazy/g ;) 07:44
samcv it is a little tricky when some codepoints can be longer than others :P
but also awesome
07:44 zakharyas joined 07:45 bjz joined
llfourn m: say "st" ~~ m/ST|st|sT|St/ # is this meant to work? 07:45
camelia False
samcv some combinations of codepoints make up one grapheme. some graphemes can make up combinations of graphems when casefolded
:P
no llfourn only when you do ignorecase
m: say "st" ~~ m:i/ST/ 07:46
camelia 「st」
llfourn so a case is more than just uppercase and lowercase but there is also ligature case?
samcv uh
wel lowercase of st is st. but foldcase of st is st
llfourn ah "foldcase". 07:47
samcv some even can be 1 codepoint to 3 codepoints
llfourn I am so glad that there are people brave enough to tackle this for me :D
samcv yes, i hope my work can save other people time and effort and things just magically work :) 07:49
07:49 mr-foobar left
Woodi samcv: any chance automatic translation between languages be added ? that's only one thing that left after universal charset :) 07:49
07:49 mr-foobar joined
samcv this is my Grant proposal which will be published soon gist.github.com/samcv/121351d79e4b...fa3a7980b3 07:50
07:50 mr-foobar left
samcv also i think if i fully implement Unicode collation algorithm 'st' will also sort with 'st' 07:52
which is also ridiculous XD
Woodi samcv++ :)
samcv atm it passes all the unicode collation tests which are made up of single and not multiple codepoints.
chansen_ Nice! 07:53
07:54 mr-foobar joined 07:55 abraxxa joined, mr-foobar left 07:59 espadrine joined 08:01 koki left 08:02 kybr left 08:05 spider-mario left 08:06 spider-mario joined 08:11 robertle left
samcv be back soon 08:11
08:14 dakkar joined 08:16 xtreak joined 08:19 mr-foobar joined 08:20 espadrine left 08:25 Cabanossi left, zakharyas left 08:27 Cabanossi joined 08:30 salva left 08:31 wamba joined 08:33 xtreak left
bolangi I can remove the paragraphs from the wiki. Can someone else check if its still present in the Compile -h output? 08:38
08:44 gdonald left
bolangi oh, sorry 08:44
08:44 gdonald joined 08:50 mxco86 joined 08:51 mr-foobar left 08:54 mr-foobar joined, Cabanossi left 08:57 Cabanossi joined 09:10 rindolf joined 09:17 llfourn left 09:25 Cabanossi left, parv joined 09:27 Cabanossi joined 09:32 bjz left
Geth ecosystem: bd1b37a6a0 | (Alexey Melezhik)++ | META.list
Update META.list

sparrowdo-sparrow-update canonical name for META file
09:32
09:33 zakharyas joined 09:34 bjz joined 09:36 kyan left 09:37 xtreak joined 09:38 xtreak left 09:41 kybr joined 09:43 lukaramu joined 09:48 wamba left 09:49 ugjka left 09:52 ugjka joined 09:53 wamba joined 09:57 xtreak joined 10:13 koki joined 10:30 labster left 10:38 xtreak left, xtreak joined 10:40 bjz_ joined 10:41 bjz left 10:45 xtreak left 10:51 llfourn joined 10:55 Cabanossi left 10:56 Cabanossi joined 11:02 xtreak joined, rindolf left 11:05 rindolf joined 11:27 cosimo left 11:31 xtreak left 11:33 xtreak joined 11:34 xtreak left 11:38 AndyDee joined, abraxxa left 11:39 abraxxa joined 11:40 Cabanossi left 11:42 Cabanossi joined 11:50 lukaramu_ joined 11:52 Khisanth left 11:53 lukaramu left 11:58 Loops joined, movl joined, wamba left
Loops Hi there, does anyone know what the forced-bool operator "so" is named for? 11:58
11:59 andrzejku joined
andrzejku hi :) 11:59
jnthn Loops: It's just the English word "so"; in phrases like "is that so?" you could pretty much replace the "so" with "true" :) 12:01
12:01 wamba joined
andrzejku jnthn: nice to see you 12:03
Loops jnthn: thanks. i find it a bit awkward, but i'll quickly forget about my feelings and get used to it i'm sure (i'm fine with "ff" heh). Thanks :-)
12:03 cosimo joined
jnthn Loops: Yeah, I found it the same at first, but it feels fairly natural by now. :) 12:04
andrzejku: hi
parv andrzejku, whenver I read your user id, "adjkerntz" pops up immediately (followed by re-reading of the user id) 12:06
12:06 Khisanth joined
parv adjkerntz: www.freebsd.org/cgi/man.cgi?query=...ormat=html 12:06
andrzejku :) 12:10
jnthn: i got question fo ryou
jnthn: where do you learn how to write vm?
some books manuals
jnthn andrzejku: Partly from courses when I was at university, partly by looking at existing VMs to see how they worked. Learned a good bit about GC from The GC Handbook (second edition). 12:15
12:15 Wanderer68 joined
andrzejku jnthn: huh I didn't have such courses have you one for example? 12:15
jnthn andrzejku: The compiler courses - at least when I took them - went into the JVM some. 12:17
12:17 raschipi joined
andrzejku okay thnks :) 12:18
jnthn The courses I took were www.cl.cam.ac.uk/teaching/1617/CompConstr/ and www.cl.cam.ac.uk/teaching/1617/OptComp/ - but years ago, they probably changed quite a bit. But think they post slides still
lizmat www.amazon.com/Garbage-Collection-...1420082795 # the book
jnthn Also I was lucky enough to be lectured on concurrency by one of the leading folks on lock-free algorithms, so I got a decent grounding in concurrency also :) 12:20
Well, lock free data structures probably describes the work more accurately
12:22 lichtkind__ is now known as lichtkind
jnthn VMs are a bit like compilers in so far as you have to get really used to thinking about programs that work with programs, or, perhaps, get used to thinking about code as just another form of data. 12:23
lichtkind jnthn if you need anything im still at university and am somewhat close to our compiler prof
12:24 Cabanossi left
jnthn As with compilers, trees and graphs show up all over the place. 12:24
lichtkind jnthn and btw my mother send me somehting interesting about the castle you live under i can resent if you like 12:26
12:27 Cabanossi joined
jnthn lichtkind: Hm, interesting...well, it's nice to be able to tell visiting family something about it :) 12:27
lizmat has finished the P6W for now, but will be afk for the next 10 hours or so: will update to the latest news and post then
lichtkind oh i forgot i was in czech :)
jnthn but i can translate it was not that much beside pictures 12:28
jnthn lichtkind: Well, I can try to decode it, though my vocab is still on the small side :)
12:39 perlpilot left 12:40 sufrostico joined, sufrostico left, sufrostico joined
lichtkind jnthn, no proplem i can skim it, you have to decode bugs all the time 12:41
12:47 perlpilot joined
raschipi Whay doesn't this: perlgeek.de/blog-en/perl-6/2017-01...acked.html appear in pl6anet.org/ ? 12:50
moritz there seem to be a problem with pl6anet.org; the weekly news posts my lizmat++ didn't show up either 12:51
12:53 mcmillhj joined 12:54 cosimo left 12:55 cosimo joined, cosimo left 12:56 cosimo joined 12:58 chsanch joined
chsanch Hi, I've managed to compile perl6 in the CHIP just activating a swap file :) 13:00
13:01 cdg joined 13:02 AlexDaniel joined, cdg left 13:03 cdg joined 13:05 parv left
raschipi chsanch: write a paper or a blogpost about it and bring us a link! 13:06
chsanch raschipi: sure 13:11
raschipi Also post it on #moarvm 13:12
13:19 pmurias joined 13:22 bjz_ left 13:23 aborazmeh joined, aborazmeh left, aborazmeh joined 13:27 itaipu joined 13:29 tojo left, Sound joined 13:36 lukaramu__ joined 13:37 cog_ joined 13:38 cognominal left 13:40 lukaramu_ left 13:41 Cabanossi left 13:42 Cabanossi joined 13:48 aborazmeh left 13:51 curan left, wamba left 13:55 wamba joined 13:58 itaipu left 14:07 gdonald left, cdg_ joined, gdonald joined, cdg left 14:12 vendethiel joined 14:13 vendethiel- left 14:15 itaipu joined
tyil are there frameworks to make a json api in perl 6 yet? 14:16
raschipi tyil: have a look modules.perl6.org/#q=json 14:19
14:19 kurahaupo__ joined 14:20 itaipu left
[Coke] eco: json 14:20
buggable: eco json
buggable [Coke], Found 21 results: JSON::Tiny, App::jsonv, JSON::RPC, JSON::JWT, JSON::Pretty. See modules.perl6.org/#q=json
tyil plenty of modules to take care of the json part, but I was hoping for a complete framework, that also handles the database (using an ORM for instance) and routing
[Coke] (same url)
buggable: eco DB 14:21
buggable [Coke], Found 9 results: DB::Model::Easy, BSON, MongoDB, DBIish, DB::ORM::Quicky. See modules.perl6.org/#q=DB
[Coke] (that said, it's quite possible we don't have quite what you're looking for yet) - you can always use Inline::Perl5 for glue
tyil I might try my hand at assembling it myself, but as I have next to no p6 experience yet it would possibly be better if someone made something for it already, and this seemed the best place to ask 14:22
at fosdem 2016 there was a talk about a p5 web framework, maybe that was ported to p6, but I dont rememer the name of the fw anymore 14:23
14:26 Cabanossi left, itaipu joined
raschipi Perl6 webframework is called bailador 14:26
buggable: eco bailador
buggable raschipi, Found 5 results: Bailador, Bailador::Dev::AutoRestarter, Bailador::Plugin::Static, Bailador::Plugin::AssetPack::SASS, Bailador::Template::Mojo::Extended. See modules.perl6.org/#q=bailador
14:27 Cabanossi joined
tyil awesome, I'll look into that, I can apply one of the json modules if needs be to do that little bit 14:27
ofc, if anyone knows of other frameworks available, feel free to poke me so I can compare them 14:28
raschipi buggable: eco prancer 14:29
buggable raschipi, Nothing found
raschipi another: github.com/drforr/perl6-App-prancer
and another: github.com/masak/web 14:30
tyil nice 14:33
14:38 obfusk_ joined, obfusk left
ugexe ugexe.com/hello-web-with-puree-perl-6/ # tony-o's hiker (and blog post) 14:44
tyil too bad that last site is behind cf 14:45
14:46 lighttrr joined
ugexe whats wrong? I thought I turned off all the "protections" 14:47
SmokeMachine I don't know if someone is interested, but Im playing building a script that uses zef and does something like nom does for node... does anyone think its interesting? if someone would like to critic: github.com/FCO/6pm
tyil apparently not
besides, even without the "protections", cf causes more harm than anything else 14:48
14:51 Sound left 14:55 Cabanossi left 14:57 Cabanossi joined 14:59 wamba left 15:05 chsanch left 15:10 lighttrr left, geekosaur left 15:11 geekosaur joined 15:21 zakharyas left, lighttrr joined, sufrostico left 15:23 sufrostico joined 15:31 Loops left 15:32 gregf_ joined 15:37 geekosaur left 15:39 geekosaur joined 15:41 skids joined 15:42 domidumont left 15:43 itaipu left 15:50 alimon joined 15:51 lighttrr left 15:59 abraxxa left 16:03 khw joined 16:07 geekosaur left, skids left 16:08 geekosaur joined, geekosaur left 16:10 itaipu joined, geekosaur joined 16:12 geekosaur left 16:13 geekosaur joined, sufrostico left 16:15 sufrostico joined, geekosaur left 16:17 geekosaur joined 16:19 geekosaur left, geekosaur joined 16:25 setty1 joined 16:26 geekosaur left
SmokeMachine m: say sub (*@a ($)) {}.arity # shouldn't be 1? 16:27
camelia 0
16:28 geekosaur joined
TimToady the fact that it lets you put a destructure on a slurpy is probably an oversight 16:30
SmokeMachine m: say sub (*@a ($)) {}.() 16:32
camelia Too few positionals passed; expected 1 argument but got 0 in sub-signature of parameter @a
in sub at <tmp> line 1
in block <unit> at <tmp> line 1
16:33 pochi left
SmokeMachine TimToady: sorry, I didn't get it... 16:34
16:35 lighttrr joined 16:36 pochi joined
gfldex m: say sub (*@a ($)) {}.(Empty) 16:39
camelia Too few positionals passed; expected 1 argument but got 0 in sub-signature of parameter @a
in sub at <tmp> line 1
in block <unit> at <tmp> line 1
gfldex SmokeMachine: it's a bit of a contradiction 16:40
SmokeMachine m: say sub (*@a ($)) {}.([])
camelia Too few positionals passed; expected 1 argument but got 0 in sub-signature of parameter @a
in sub at <tmp> line 1
in block <unit> at <tmp> line 1
SmokeMachine m: say sub (*@a ($)) {}.([1])
camelia Nil
AlexDaniel huh what 16:41
ah… nvm
SmokeMachine AlexDaniel: yes, nvm... sorry! 16:42
no! nem!
npm
AlexDaniel m: sub (*@a ($x, $y, *@b)) { say $x; say $y; say @b}(42, 24, 50, 51, 52)
camelia 42
24
[50 51 52]
AlexDaniel TimToady: is it actually an oversight? 16:43
16:44 lighttrr left
AlexDaniel m: sub (+@a ($x, $y, *@b)) { say $x; say $y; say @b}(42, 24, 50, 51, 52) 16:44
camelia 42
24
[50 51 52]
AlexDaniel m: sub (+@a ($x, $y, *@b)) { say $x; say $y; say @b}([42, 24, 50, 51, 52])
camelia 42
24
[50 51 52]
AlexDaniel looks like a feature to me :) 16:45
SmokeMachine: the arity seems to come from the argument itself, not its destructure 16:46
16:47 itaipu left
AlexDaniel and that kinda makes sense 16:47
agentzh Woodi: please do not assume we are takers. that's just ridiculous. you have no idea how much we contribute to the open source community in the last decade.
Woodi: and i contributed a lot of my time to perl 6 community 10 years ago.
and i also created several bug reports to rakudo.
just recently
and we actively share what we like and what we don't like here about our use of rakudo. 16:48
SmokeMachine AlexDaniel: I mean: npm (the node package manager)
agentzh Sahme
AlexDaniel huh?
agentzh: don't take it too close to your heart. We are happy to have you around :) 16:49
agentzh Woodi: you are in no position in judge us.
AlexDaniel: thanks
16:50 alphah left
AlexDaniel agentzh: to be honest, I was also a bit disappointed when I heard that this stuff is going to be closed (mostly). It's kinda natural to be sad about it. Still cool though. 16:51
16:56 dakkar left 17:10 sufrostico left
agentzh AlexDaniel: well, we may open source fanlang at some point. the company just does not want to open source it now since the company is just started. 17:12
17:13 sufrostico joined, robertle joined
agentzh we have to make a living first, then we can have the resources to better support open source in a sustainable way. 17:13
like decades, i hope :) 17:14
timotimo bench: compare HEAD so "hello how are you today?".contains("hello" & "u t") for ^1000 ||| my $target = "hello how are you today?"; so $target.contains("hello") && $target.contains("u t") for ^1000
benchable6 timotimo, starting to benchmark the 1 given commit
timotimo, gist.github.com/4219eadfc16b1f9096...dadc7f07ab
17:16 zakharyas joined
SmokeMachine my %a = a => {b => 1}; say %a{"a","a";"b"}; say %a{"a","a";"b"}:exists # would it return True, True? 17:19
m: my %a = a => {b => 1}; say %a{"a","a";"b"}; say %a{"a","a";"b"}:exists # would it return True, True?
camelia (1 1)
False
SmokeMachine *should 17:21
timotimo hm, i'd expect it to return more than one value in any case 17:22
SmokeMachine timotimo: do you mean its not a bug? rt.perl.org/Public/Bug/Display.htm...et-history 17:23
17:23 agentzh left, sufrostico left
SmokeMachine m: my %a = a => {b => 1}; say %a{"a";"b"}.perl # <- timotimo: i mean: should it return a list (1,) or only 1 result: 1? 17:24
camelia (1,)
timotimo ah, that's different
that ought to be only one value, i guess
17:24 Cabanossi left
timotimo i haven't used slices with multidim hashes yet 17:25
SmokeMachine timotimo: ok! that's what Im trying to fix...
timotimo: while I was looking that I saw the :exists case...
m: my %a = a => {b => 1}; say %a{"a","a";"b"}; say %a{"a","a";"b"}:exists # I think False is wrong... but should it return True or (True, True)? 17:26
camelia (1 1)
False
timotimo i'll be AFK for a bit now, though
i think it ought to return False, False? 17:27
17:27 sufrostico joined, Cabanossi joined
timotimo isn't what you have there the equiv of (%a{"a", "a"}:exists, %a{"b"}:exists)? 17:27
or am i confusing , and ;?
SmokeMachine confusing, I think...
timotimo ; is to make a list-of-lists, and each of these entries ought to be one "path"?
SmokeMachine %a{"a", "a"; "b"} == %a<a><b>, %a<a><b> ? 17:28
17:29 itaipu joined
AlexDaniel timotimo: yup, junctions are known to be… extremely slow… 17:29
timotimo a little bit :) 17:30
AlexDaniel yea, just 27 times
17:32 wamba joined
AlexDaniel bench: compare 2015.12 so "hello how are you today?".contains("hello" & "u t") for ^1000 ||| my $target = "hello how are you today?"; so $target.contains("hello") && $target.contains("u t") for ^1000 17:33
benchable6 AlexDaniel, starting to benchmark the 1 given commit
AlexDaniel, gist.github.com/43635f98e94d3f3b79...c8dae6c974
AlexDaniel really? That much faster?
bench: 2015.12,HEAD so "hello how are you today?".contains("hello" & "u t") for ^1000
benchable6 AlexDaniel, starting to benchmark the 2 given commits
AlexDaniel, benchmarked the given commits, now zooming in on performance differences
AlexDaniel bench: 2015.12,HEAD my $target = "hello how are you today?"; so $target.contains("hello") && $target.contains("u t") for ^1000 17:34
benchable6 AlexDaniel, starting to benchmark the 2 given commits
AlexDaniel, gist.github.com/9483b4cc1fee2feec6...a30026886b
AlexDaniel, benchmarked the given commits, now zooming in on performance differences
AlexDaniel, ¦2015.12: «0.1168» ¦HEAD: «0.1121»
AlexDaniel MasterDuke: why does it say 0.0253s when you “compare”, but 0.1121s otherwise? 17:37
MasterDuke: or 0.0094s even 17:38
17:46 TeamBlast left 17:47 TeamBlast joined 17:49 domidumont joined 17:51 itaipu left 18:02 g0d355__ joined 18:04 bstahlman joined
bstahlman Can anyone explain this statement from the Control Flow section of the docs? 18:04
There is one other feature a when has that if doesn't: the when's boolean context test defaults to $_ ~~ while the if's does not. That has an effect on how one uses the X in the when block without a value for $_ (it's Any in that case and Any smart matches on True: Any ~~ True yields True)
What's confusing me is the bit about "$_". With `when $a { ... }`, how does $_ enter into it? 18:05
I would have assumed that was short for $a ~~ True or something like that.
And the topic isn't automatically changed for an if or when, is it?
18:08 zakharyas left
timotimo "when $foo" will test the current topic against $foo using a smart match 18:10
bstahlman Ah! But if doesn't work that way, right? 18:11
It's just doing a Boolean coercion of the condition?
timotimo yup 18:12
bstahlman So then how does `when so $a` work? Is it coercing to Boolean, then comparing with $_?
timotimo it smart matches against a boolean; smart match against False always fails, smart match against True always succeeds 18:13
bstahlman Iow, does use of when always imply having set $_ to something beforehand?
timotimo it's basically a way to ignore the $_
AlexDaniel bstahlman: yes
timotimo not always, though
bstahlman timotimo: What's a way to ignore the $_? Using `so`? 18:14
timotimo when you use something that evaluates to True or False, you can ignore setting $_
AlexDaniel what's the use of “when” if you having something random in $_?
timotimo it will succeed at the end of the inner block
AlexDaniel mhm… sounds like an interesting way of obfuscation
timotimo m: given "hello" { if $_ ~~ /e/ { say "e!" }; if $_ ~~ /l/ { say "l!" }; }
camelia e!
l!
bstahlman timotimo: Ah. So IIUC, if the condition is a Boolean, the rule for evaluation is different: i.e., compares with True rather than comparing with $_? 18:15
timotimo m: given "hello" { when /e/ { say "e!" }; when /l/ { say "l!" }; }
camelia e!
timotimo ^- see how the second one doesn't print "l!"?
bstahlman: no, the rule for evaluation is the same: "use smart match"
it's just that smart matching anything against True always results in True, and False always False
bstahlman timotimo: Can you expand on "smart matching anything against True"? Are you referring to "Any" or just anything in the literal sense. To be explicit... `when $a` := ? and `when so $a` := ? 18:17
AlexDaniel m: say 42 ~~ True
camelia Potential difficulties:
Smartmatch against True always matches; if you mean to test the topic for truthiness, use :so or *.so or ?* instead
at <tmp>:1
------> 3say 42 ~~ 7⏏5True
True
bstahlman I.e., how would those expand?
timotimo no, literally any value ever
AlexDaniel m: say 42 ~~ False 18:18
camelia Potential difficulties:
Smartmatch against False always fails; if you mean to test the topic for truthiness, use :!so or *.not or !* instead
at <tmp>:1
------> 3say 42 ~~ 7⏏5False
False
timotimo that's also why it gives you that warning there
bstahlman So False ~~ True is True?
timotimo yes
bstahlman Ok. So what does `when so $a` expand to if I'm going to write it out as a standard boolean conditional? 18:19
Same question for `when $a`...
timotimo when so $a is the same as if $_ ~~ (so $a) { ...; succeed }
when $a is the same as if $_ ~~ $a { ...; succeed }
AlexDaniel s: &infix:<~~>, \(False, True) 18:20
timotimo that's not where you'll find it
AlexDaniel huh
bstahlman And in both cases, $_ is whatever it was (e.g., as set by a given) - there's no automatic topicalization going on?
timotimo s: True, ".ACCEPTS", \(Any)
AlexDaniel the bot is simply not here
timotimo yes, when doesn't topicalize
oh, ok 18:21
bstahlman Ok. Thanks. I'll play around with that in the REPL to be sure I understood.
timotimo Bool.^add_multi_method('ACCEPTS', my multi method ACCEPTS(Bool:D: Mu \topic ) { self });
i.e. True.ACCEPTS(...) will always return self, i.e. True 18:22
and same for False.ACCEPTS
bstahlman Ah. I think I see now what you mean about `so` providing a way to ignore $_. `when so $a` equals `$_ ~~ (so $a)`, but if $a coerces to True, the rule you mentioned earlier regarding smartmatch with True renders $_ a "dont' care". 18:23
AlexDaniel yea 18:24
timotimo right
bstahlman timotimo: Great. Thanks for your patience...
timotimo np
18:24 cdg_ left
AlexDaniel say 42 ~~ True 18:28
m: say 42 ~~ True
camelia Potential difficulties:
Smartmatch against True always matches; if you mean to test the topic for truthiness, use :so or *.so or ?* instead
at <tmp>:1
------> 3say 42 ~~ 7⏏5True
True
AlexDaniel m: say 42 [~~] True
camelia True
AlexDaniel I guess [] is not always a no-op… 18:29
18:30 darutoko left 18:34 TEttinger joined 18:41 espadrine joined 18:42 labster joined 18:46 bstahlman left, skids joined 18:47 labster left 18:49 labster joined 18:55 ZofBot joined, ChanServ sets mode: +v ZofBot 19:08 evalable6 left 19:11 Cabanossi left, r3m left 19:12 Cabanossi joined 19:14 r3m joined 19:15 Sound joined 19:21 labster left 19:24 damnlie_ joined 19:26 labster joined 19:27 domidumont left 19:28 isacloud joined 19:29 Wanderer68 left 19:32 MilkmanDan left, MilkmanDan joined 19:36 gdonald left, gdonald joined 19:38 peteretep joined 19:39 ugexe joined, Tonik joined 19:47 BuildTheRobots joined 19:48 bjz joined 19:49 mrsolo joined 19:50 ggherdov joined, olinkl joined 19:54 Sound left, Cabanossi left 19:55 labster left 19:56 setty1 left 19:57 Cabanossi joined 20:03 cdg joined 20:11 g0d355__ left 20:12 vendethiel left, kivutar joined, vendethiel joined
timotimo RabidGravy: can i ask you about test failure in JSON::Unmarshal? 20:15
oh, that must be about the Associative role thing with 1 vs 2 parameters? 20:16
RabidGravy you might
timotimo is it known to be broken on rakudo 2016.11?
RabidGravy it was broken until yesterday :) 20:17
20:17 kivutar left
timotimo oh, did you just add these tests? 20:17
RabidGravy the test isn't merged yet afaik 20:18
timotimo huh
RabidGravy oh in JSON::Class it is
timotimo OK, that explains it
food's warmed up! 20:19
bbl
RabidGravy maybe I should TODO that
:)
specifically it was github.com/rakudo/rakudo/commit/a6...9a58dc366f that fixed it 20:21
20:21 andrzejk_ joined 20:26 raschipi left
timotimo huh, moar doesn't seem to build under windows at the moment? 20:28
20:28 sufrostico left
timotimo i see it 20:30
20:30 sufrostico joined 20:35 sufrostico left 20:39 robertle left 20:41 Ven joined, Ven is now known as Guest82746 20:44 pmurias left 20:45 pmurias joined 20:46 sufrostico joined 20:50 Tonik left, andrzejk_ left 20:51 wamba left 20:54 lichtkind_ joined 20:55 Cabanossi left, labster joined 20:57 Cabanossi joined, lichtkind left 20:59 donaldh joined 21:07 Guest82746 left 21:13 RabidGravy left 21:14 bjz left 21:16 donaldh left, donaldh joined 21:18 Ven_ joined 21:26 Ven_ left, Ven_ joined 21:27 mcmillhj left 21:28 Ven_ left 21:34 alphah joined 21:43 gdonald left, gdonald joined 21:55 Cabanossi left 21:57 Cabanossi joined, mcmillhj joined 22:03 mcmillhj left
sjn hey, is there a way to detect wether my function is running in void context? 22:06
22:07 donaldh left 22:09 dct joined
lizmat have it return an object which has a .sink method 22:09
m: class A { method sink() { say "sunk" } }; A.new 22:10
camelia sunk
22:11 Sound joined, mcmillhj joined
AlexDaniel m: role SinkExploder { method sink() { die "sunk" } }; sub foo { return 42 does SinkExploder }; my $x = foo; say $x 22:14
camelia 42
AlexDaniel m: role SinkExploder { method sink() { die "sunk" } }; sub foo { return 42 does SinkExploder }; foo
camelia sunk
in method sink at <tmp> line 1
in block <unit> at <tmp> line 1
22:14 vendethiel left 22:15 vendethiel joined 22:16 espadrine left, mcmillhj left
lizmat and another Perl 6 Weekly hits the Net: p6weekly.wordpress.com/2017/03/27/...-the-same/ 22:16
sjn yay! 22:17
Voldenet Nice! 22:19
Hm, are strings in perl6 immutable? 22:20
samcv Voldenet, from an implementation sense? pretty sure yes 22:21
even though they pretend not to be
Voldenet well thought so
I think perl5 used realloc, so I wasn't sure 22:22
AlexDaniel m: my $x = ‘hello world’; $x.substr-rw(3, 6) = ‘boom!’; say $x 22:23
camelia helboom!ld
AlexDaniel (doesn't really answer the question, just something to note) 22:24
timotimo yeah, that's just the container being mutable
samcv yep
timotimo m: my $x := 'hello world'; $x.substr-rw(3, 6) = 'boom!'; say $x
camelia Cannot modify an immutable Str
in block <unit> at <tmp> line 1
22:25 mcmillhj joined
samcv m: my $string = 'bleh'; say $string.WHERE; $string ~~ s/h/g/; say $string.WHERE 22:25
camelia 140486725436112
140486726685920
Voldenet my $y = my $x = ‘hello world’; $x.substr-rw(3, 6) = ‘boom!’; say $x ~ $y
m: my $y = my $x = ‘hello world’; $x.substr-rw(3, 6) = ‘boom!’; say $x ~ $y
camelia helboom!ldhello world
Voldenet so yeah, they're pretty much immutable 22:26
but i wonder if... 22:28
m: my $y = my $x = 'hi world'; say $y.WHERE ~ $x.WHERE
camelia 140155216494432140155216494432
Voldenet nice, quite nice
22:29 mcmillhj left
Voldenet perl5 would use 2 different scalars for that, but would keep the first scalar for replacement 22:30
but immutable strings is probably a better approach
m: my $y = 'hi world'; my $x = 'hi world'; say ($y.WHERE, $x.WHERE) 22:33
camelia (140611713187152 140611713187152)
Voldenet whoa, they are interned, even
I wonder if... 22:37
m: my $y = "hi world"; say $y.WHERE; use nqp; nqp::force_gc(); my $x = "hi world"; say $x.WHERE
camelia 140380117780016
140380089870712
Voldenet Whoa, that's a nice out there 22:38
s/nice/nice magic/
:)
22:41 mcmillhj joined 22:42 Voldenet left
timotimo m: my $y = "hi world"; say nqp::where(nqp::unbox_s($y)); use nqp; nqp::force_gc(); my $x = "hi world"; say nqp::where(nqp::unbox_s($x)) 22:43
camelia 5===SORRY!5=== Error while compiling <tmp>
Could not find nqp::unbox_s, did you forget 'use nqp;' ?
at <tmp>:1
------> 3 world"; say nqp::where(nqp::unbox_s($y)7⏏5); use nqp; nqp::force_gc(); my $x = "hi
timotimo m: use nqp; my $y = "hi world"; say nqp::where(nqp::unbox_s($y)); nqp::force_gc(); my $x = "hi world"; say nqp::where(nqp::unbox_s($x)) 22:44
camelia 139939163687688
139939136173792
timotimo mhm mhm
22:46 mcmillhj left 22:47 Voldenet joined, Voldenet left, Voldenet joined 22:50 kurahaupo__ left 22:51 mcmillhj joined 22:54 Cabanossi left 22:56 mcmillhj left 22:57 Cabanossi joined
Voldenet oh wait, are they really? 22:59
m: my $y = ~Date.today(); say $y.WHERE; my $x = ~Date.today(); say $x.WHERE
camelia 140523248789384
140523248877112
Voldenet meh, not really
23:00 lukaramu__ left
samcv timotimo, there's a forcegc :P 23:06
23:08 mcmillhj joined 23:12 mcmillhj left 23:13 dct left 23:15 BenGoldberg joined 23:16 rindolf left, pmurias left
Voldenet Can I somehow do strings pooling with perl6? I'd rather use no objects where I could use just use some C logic, but I'd rather not actually write C logic for strings... (it's very arcane usage, so probably not) 23:17
23:17 Sound left
Voldenet I believe it would improve efficiency when dealing with moderate amounts of recurring strings (which happens in most apps, like when you fetch usernames from db or parse some /proc), but I'm not sure 23:20
23:22 cdg left 23:26 vendethiel- joined, vendethiel left 23:28 nbrown joined 23:29 mcmillhj joined
timotimo you're looking at the memory location of Str objects, but they just box str objects 23:30
i.e. you can mix in roles and such into the Str objects
you don't want to pool that in the general case 23:31
but str objects that come from literal source code are shared already
23:34 mcmillhj left
Voldenet yeah, well - java and .net are doing something like keeping /some/ of the strings inside of the runtime, I think 23:37
i'm not sure how cost-efficient is that, but it could be very memory/gc-efficient in edge cases 23:39
timotimo well, the str is definitely immutable 23:44
because it doesn't know how mixins work :P
23:45 mcmillhj joined
BenGoldberg So you want some sort of Str.intern method? 23:46
Voldenet Hm, it might be as nice as dangerous, not sure which path is better tbh 23:47
timotimo you can definitely just stash your strings into a hash 23:48
Voldenet Yeah, but it wouldn't get to near-native performance 23:49
in fact, java's way of doing pooling was quite inefficient, so it had to be built into the runtime
(because of how the jvm works)
23:50 mcmillhj left
BenGoldberg m: my $s = SetHash.new; $s<foo> = True; say $s<foo>:k; 23:50
camelia foo
BenGoldberg m: my $s = SetHash.new; $s<foo> = True; say ($s<foo>:k) === ($s<foo>:k); 23:51
camelia True
BenGoldberg m: my $s = SetHash.new; $s<foo> = True; say ($s<foo>:k) === ("foo");
camelia True
Voldenet hm, isn't that compile-time optimization? 23:52
:P
BenGoldberg m: my $s = SetHash.new; $s<foo> = True; say ($s<foo>:k) =:= ("fo"~"o");
camelia False
BenGoldberg m: my $s = SetHash.new; $s<foo> = True; say ($s<foo>:k) =:= ("foo");
camelia True
Voldenet also, how would one return the string from that was used as hash key and free the other? 23:53
BenGoldberg Something like: 23:54
m: sub intern-string(\foo) { state $strings = SetHash.new; $s{foo} = True; return $s{foo}:k }; 23:55
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$s' is not declared
at <tmp>:1
------> 3g(\foo) { state $strings = SetHash.new; 7⏏5$s{foo} = True; return $s{foo}:k };
BenGoldberg m: sub intern-string(\foo) { state $strings = SetHash.new; $strings{foo} = True; return $strings{foo}:k };
camelia ( no output )
BenGoldberg m: sub intern-string(\foo) { state $strings = SetHash.new; $strings{foo} = True; return $strings{foo}:k }; say intern-string("foo").WHERE, intern-string("f"~"oo").WHERE 23:56
camelia 140167891523432140167891810840
BenGoldberg m: sub intern-string(\foo) { state $strings = SetHash.new; $strings{foo} = True; return $strings{foo}:k }; .say for intern-string("foo").WHERE, intern-string("f"~"oo").WHERE
camelia 140089719443928
140089719754848
BenGoldberg oops.
Voldenet :P
BenGoldberg Hmm...
Voldenet it'd be not that tricky to set up in C
BenGoldberg m: sub intern-string(\foo) is raw { state $strings = SetHash.new; $strings{foo} = True; return $strings{foo}:k }; .say for intern-string("foo").WHERE, intern-string("f"~"oo").WHERE
camelia 139724666723192
139724667034016
BenGoldberg shrugs. 23:57
Anyway, if you've got strings which you *know* have been interned, then one convenient thing you can do is avoid string-equality comparisons, and only do object (or pointer) equality comparisons. 23:58
23:58 nbrown left
Voldenet m: sub try-intern { state $s = SetHash.new; $s<^a> ?? $s<$^a> !! $s<$^a> = $^a }; try-intern($_).WHERE.say for ("foo", "fo"~"o"); 23:59
camelia 24243016
24243016
Voldenet that's more like it :)
BenGoldberg Voldenet++