Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2014-06-07

Perl 6 | Reference Documentation | Rakudo

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:23 ivanshmakov joined #perl6
00:30 ivanshmakov joined #perl6
00:46 rurban joined #perl6
01:20 SamuraiJack joined #perl6
01:20 beastd joined #perl6
01:31 Su-Shee_ joined #perl6
01:31 rurban joined #perl6
01:35 klapperl_ joined #perl6
01:44 geekosaur joined #perl6
01:46 FROGGS joined #perl6
01:53 troymc joined #perl6
01:55 zengargoyle left #perl6
02:19 hoverboard joined #perl6
02:30 SriV joined #perl6
02:42 xragnar joined #perl6
03:15 PZt joined #perl6
03:30 avuserow joined #perl6
03:40 SevenWolf joined #perl6
03:41 dalek roast: 91885f2 | (David Warring david.warring@gmail.com)++ | S26-documentation/10-doc-cli.t:
03:41 dalek roast: adding DOC INIT {} test
03:41 dalek roast: review: https://github.com/perl6/roast/commit/91885f2ae0
03:50 avuserow joined #perl6
03:59 byte48 joined #perl6
04:03 rindolf joined #perl6
04:16 BenGoldberg joined #perl6
04:24 kaare_ joined #perl6
04:50 hoverboard joined #perl6
04:53 xenoterracide joined #perl6
05:01 treehug88 joined #perl6
05:04 thou joined #perl6
05:07 bjz joined #perl6
05:43 ponbiki joined #perl6
05:49 jack_rabbit_ joined #perl6
05:55 rurban joined #perl6
06:29 uniejo joined #perl6
06:32 darutoko joined #perl6
06:54 anaeem1 joined #perl6
06:56 asuerhao joined #perl6
06:57 asuerhao perl6: say "What is this?"
06:57 camelia rakudo-{parrot,jvm,moar} 28d672, niecza v24-109-g48a8de3: OUTPUT«What is this?␤»
06:58 asuerhao perl6: say "@INC";
06:58 camelia rakudo-{parrot,jvm,moar} 28d672, niecza v24-109-g48a8de3: OUTPUT«@INC␤»
07:00 TimToady p6: say "@*INC[]"
07:00 camelia rakudo-moar 28d672: OUTPUT«/home/p6eval/.perl6/2014.05-149-g28d6725/lib /home/p6eval/rakudo-inst-2/languages/perl6/lib /home/p6eval/rakudo-inst-2/languages/perl6/vendor/lib /home/p6eval/rakudo-inst-2/languages/perl6/site/lib /home/p6eval/.perl6/2014.05-149-g28d6725 /home/p6eval/raku…»
07:00 camelia ..rakudo-jvm 28d672: OUTPUT«/home/p6eval/rakudo-inst-1/languages/perl6/runtime /home/p6eval/rakudo-inst-1/languages/perl6/lib /home/p6eval/rakudo-inst-1/languages/nqp/lib /home/p6eval_eval/.perl6/2014.05-149-g28d6725/lib /home/p6eval/rakudo-inst-1/languages/perl6/lib /home/p6eval/raku…»
07:00 camelia ..niecza v24-109-g48a8de3: OUTPUT«␤»
07:00 camelia ..rakudo-parrot 28d672: OUTPUT«/home/p6eval/.perl6/2014.05-149-g28d6725/lib /home/p6eval/rakudo-inst-2/lib/parrot/6.1.0-devel/languages/perl6/lib /home/p6eval/rakudo-inst-2/lib/parrot/6.1.0-devel/languages/perl6/vendor/lib /home/p6eval/rakudo-inst-2/lib/parrot/6.1.0-devel/languages/pe…»
07:19 vike joined #perl6
07:21 denis_boyun_ joined #perl6
07:24 mr-foobar joined #perl6
07:31 spider-mario joined #perl6
07:35 denis_boyun_ joined #perl6
07:50 telex joined #perl6
07:58 rurban joined #perl6
08:03 denis_boyun joined #perl6
08:05 vike joined #perl6
08:14 sergot morning o/
08:22 anaeem___ joined #perl6
08:24 Rotwang joined #perl6
08:33 masak antenoon \o
08:34 hoverboard joined #perl6
08:41 dmol joined #perl6
08:42 vike joined #perl6
08:58 denis_boyun joined #perl6
08:58 darutoko joined #perl6
08:58 PZt joined #perl6
08:58 Util joined #perl6
08:58 apejens_ joined #perl6
08:58 obra joined #perl6
08:58 yakudzo joined #perl6
08:58 ivan`` joined #perl6
08:58 rurban_ joined #perl6
08:58 lue joined #perl6
08:58 sorear joined #perl6
08:58 xfix joined #perl6
08:58 haroldwu joined #perl6
08:58 [Sno] joined #perl6
08:58 chenryn joined #perl6
08:58 dylanwh joined #perl6
08:58 japhb_ joined #perl6
08:58 ribasushi joined #perl6
08:58 rjbs joined #perl6
08:58 baest joined #perl6
08:58 cooper joined #perl6
08:58 profan joined #perl6
08:58 clkaoud joined #perl6
08:58 mathw joined #perl6
08:58 risou joined #perl6
08:58 tokuhirom joined #perl6
08:58 yogan_ joined #perl6
08:58 flussence joined #perl6
08:58 atrodo joined #perl6
08:58 timotimo joined #perl6
08:59 ivan`` joined #perl6
08:59 ivan`` joined #perl6
09:00 SamuraiJack joined #perl6
09:01 geekosaur joined #perl6
09:01 Pleiades` joined #perl6
09:01 FOAD joined #perl6
09:01 pmichaud joined #perl6
09:01 hugme joined #perl6
09:01 jercos joined #perl6
09:01 Juerd joined #perl6
09:01 bowtie joined #perl6
09:01 hoelzro joined #perl6
09:01 amkrankruleuen joined #perl6
09:01 retupmoca joined #perl6
09:01 ggherdov joined #perl6
09:01 Bucciarati joined #perl6
09:01 simcop2387 joined #perl6
09:01 TimToady joined #perl6
09:01 lestrrat joined #perl6
09:01 raydiak joined #perl6
09:04 denis_boyun joined #perl6
09:04 darutoko joined #perl6
09:04 Util joined #perl6
09:04 apejens_ joined #perl6
09:04 obra joined #perl6
09:04 yakudzo joined #perl6
09:04 lue joined #perl6
09:04 haroldwu joined #perl6
09:04 [Sno] joined #perl6
09:04 chenryn joined #perl6
09:04 ribasushi joined #perl6
09:04 rjbs joined #perl6
09:04 baest joined #perl6
09:07 cibs joined #perl6
09:32 denis_boyun_ joined #perl6
09:40 denis_boyun___ joined #perl6
09:53 moritz n\oo/n
09:59 rurban joined #perl6
10:03 jnthn aftern/oo\n
10:06 anaeem1_ joined #perl6
10:17 SamuraiJack joined #perl6
10:23 FROGGS[mobile] joined #perl6
10:38 colomon mo/rning
10:47 colomon emmentaler broken again overnight
10:49 dmol joined #perl6
10:49 sergot this was the worst problem when I wanted to generate modules.perl6.org in p6 with checking test passing.
10:50 sergot github.com/sergot/modules.perl6.org
10:54 colomon I would say the emmentaler stage hasn't been the source of most of the issues over the last year of running this.  But this will be the second issue with it this week.
11:00 rurban joined #perl6
11:08 molaf joined #perl6
11:11 kurahaupo joined #perl6
11:18 Rotwang joined #perl6
11:28 dalek doc: e7387c3 | sergot++ | lib/IO/FileTestable.pod:
11:28 dalek doc: language fix
11:28 dalek doc: review: https://github.com/perl6/doc/commit/e7387c3c03
11:33 rurban joined #perl6
11:44 treehug88 joined #perl6
11:49 uniejo joined #perl6
12:03 uniejo joined #perl6
12:04 uniejo joined #perl6
12:10 kurahaupo joined #perl6
12:11 ivanshmakov joined #perl6
12:17 thou joined #perl6
12:52 smls joined #perl6
12:53 xenoterracide joined #perl6
12:59 ivanshmakov joined #perl6
13:00 xinming joined #perl6
13:14 xenoterracide joined #perl6
13:31 zengargoyle joined #perl6
13:32 smls I wonder, what are the long-term plans for Rakudo, architecture-wise?
13:32 smls Will NQP go away at some point, making Perl 6 completely self-hosting?
13:34 jnthn I've no plans for NQP to go away.
13:35 timotimo TimToady mentioned something about perl 6 itself being so optimized that we can have rakudo self-hosting rather than on nqp
13:35 timotimo but i've kinda grown to liking nqp
13:35 timotimo (stockholm syndrome?)
13:35 jnthn It may happen some day, but there's a lot of things that make it hard
13:35 jnthn And there's just no particular win.
13:35 jnthn At least, those that may exist today are massively outweighed by the downsides.
13:35 smls jnthn: does it affect start-up time?
13:35 timotimo aye.
13:36 timotimo well, nqp runs a whole lot faster than perl6 on rakudo
13:36 timotimo and it only takes 1/10 of the ram for starting up, because its core setting is much much slimmer
13:36 jnthn smls: Does what affect startup time, exactly?
13:36 smls being built on NQP
13:37 smls or does it make no difference once the compiler itself is compiler
13:37 smls *compiled
13:38 jnthn It most likely helps startup time that a bunch of the compiler is written in NQP, since it can currently generate simpler code and doesn't need to have, say, parameter and signature objects that are introspectable, or scalar containers...so there's less to deserialize too.
13:38 jnthn So we'd be worse off having those bits in full Perl 6.
13:39 timotimo aye, for performance reasons we already write big parts of the setting in "pseudo nqp"
13:39 jnthn Of course, I expect we'll gradually get better at optimizing and narrow the gap.
13:40 smls Will we ever match perl'
13:40 smls s startup time of 0.00s? :P
13:40 jnthn No, but we probably don't need to :P
13:40 jnthn I suspect we can get close enough that on modern hardware it doesn't matter.
13:43 jnthn Anyway, the *real* killer for Perl 6 in Perl 6 will be the bootstrapping thing.
13:44 jnthn NQP being smaller makes that a bit simpler.
13:45 jnthn But it's also that the smaller number of people hacking on NQP compared to Rakudo means there's not so many exposed to bootstrapping fun.
13:45 jnthn We already have quite enough "argh X doesn't work in the setting". We can't, from a development perspective, afford to make that an issue for the entire codebase.
13:46 moritz jnthn: maybe we need a two-staged setting :-)
13:47 moritz and stuff that doesn't work in stage 1 might work in stage 2 :-)
13:47 timotimo we kind of have a 100-staged setting
13:49 jnthn moritz: Yeah, gets us into issues with CORE:: wanting to be a single lexical scope, is all...
13:49 cognominal joined #perl6
13:50 moritz jnthn: I know (I've tried, in the past...)
13:50 timotimo btw, is there a good way to make the repl not create a thousand nested scopes after a bit of usage?
13:50 timotimo like, every singel evaluated line adds an OUTER:: to the chain
13:50 jnthn Possibly
13:51 jnthn You'd have to try and find a way to keep/compile a cumulative outer or something
13:51 smls jnthtn: On "narrowing the gap", how is it possible that NQP performs so much better than Rakudo in the perl6-bench microbenchmarks, for things like simple loops?
13:51 smls Is it all the container dereferencing that Perl 6 requires, or what else is going on there in Rakudo?
13:52 jnthn Depends on which benchmark you're talking about.
13:52 timotimo well, you can see that if you have a native loop, you get really, really close
13:52 jnthn Right, for native loops it's really close. Heck, for postwhile_nil I think Rakudo even wins...
13:52 timotimo but if you have a for loop with a range object you'll (in the past, not any more) run back and forth through the range iterator, for example
13:53 jnthn For the loops that are not native and doing $i++, that ++ is a multi-dispatch.
13:53 jnthn In NQP it's not.
13:53 timotimo ah, we don't compile-time dispatch that?
13:53 jnthn spesh is smart enough at this point to spot it can turn that into single dispatch.
13:53 jnthn timotimo: no, we can't easily due to auto-viv
13:53 jnthn But spesh never gets to do that yet because we've no OSR
13:54 timotimo ah
13:54 jnthn Anyway, in the next month or so we should be able to inline the ++ operator, and do the OSR, and that should close the gap a bit.
13:54 timotimo so, i've been thinking about strength reduction and putting it into optimizer vs spesh
13:55 timotimo if we put it into spesh, that means that only moar will ever get that opt
13:55 timotimo but if we only put it into the optimizer, we may miss a few run-time opportunities
13:55 timotimo and if we put it into both, it'll be redundant work
13:56 jnthn Well, I think the JVM knows how to do strength reduce :P
13:57 timotimo oh. well, it probably does, doesn't it.
13:58 jnthn It knows quite a lot of opts :)
13:58 timotimo will we at some point get escape analysis to tell us when we can replace series of string concats with a "string builder" instead?
13:58 timotimo hm. at that point it'll probably not be as important any more when our ropes are actually functional :)
14:00 jnthn True, though it is a possible application of escape analysis.
14:00 jnthn The analysis is useful for a few things
14:00 jnthn Though my intial goal for it is avoiding GC allocations
14:01 timotimo aye.
14:01 timotimo AFK
14:04 smls One more (stupid?) question: Why was Perl style reference counting abandoned in favor of GC?
14:05 tadzik because refcounting is wrong, long story short :)
14:05 smls The main argument against refcounting I've heard is that it can't detect reference cycles. But I never found that to be a problem in Perl 5.
14:06 tadzik well, some people did. It can be a PITA to solve sometimes, playing with weakrefs and all that
14:06 jnthn smls: Fixes the circular reference problem, tends to perform better, and incrementing/decrementing reference counts with multiple threads involved has the risk of being quite costly.
14:07 smls But doesn't the GC also have to (potentially) put all threads on hold while it's doing its thing?
14:07 jnthn smls: Also, with ref counting you have to make sure you tweak the counts right everywhere. While a GC does force some restrictions on your coding, the complexity of memory management is better isolated.
14:07 jnthn smls: Yes, but we spend more time running than we do GCing.
14:07 smls ok
14:10 jnthn The other thing is that in some ways we don't have a choice that Perl 6 will be reference counted in some places, because we want to run on things like the JVM.
14:10 jnthn One benefit of ref-counting is you can reason a little more easily about destruction time.
14:11 jnthn But you can't provide that at a language level if some VMs you want to run can't do it.
14:14 masak ...which is why DESTROY is never going to happen.
14:15 jnthn Well, it can happen, but you won't be able to know when it will fire :P
14:15 masak I can't think of any use I'd have for it beyond exactly that.
14:16 jnthn Yeah. I can't remember the last time I wrote a finalizer in Java or C# either. :)
14:18 jnthn It tends to be a last-gasp "well, if the programmer really doesn't manage resources well..." thing...
14:18 xfix Java at least has finalizers. JavaScript doesn't have any sort of destructors.
14:19 jnthn xfix: I can't remember a time when I was writing JavaScript and thought "omg I SO wish I had a destructor" :)
14:19 xfix Destructors are rarely used even in languages they have them.
14:19 xfix But they are convenient in rare cases, just like goto.
14:20 smls they are used a lot in C++ though, right?
14:20 xfix Well, yes.
14:20 jnthn Oh, for sure, but C++ is rather different memory management wise.
14:20 xfix In C++, destructors are memory management.
14:21 xfix (there is new/delete, but nobody should use that... I hope)
14:22 xfix However, there is a thing about C++. Unless the destructor is called explicitly, the destructor is called when the variable leaves the scope.
14:23 xfix Which also means you know when the destructor will be called - when you call it explicitly, or when you leave variable scope. If you assign the pointer to variable somewhere, and you leave the scope, you get undefined behavior, because RAII is memory management in C++.
14:24 colomon C++ destructors are pretty much the only C++ thing I miss in perl 6
14:26 xfix RAII is something not specific to C++.
14:26 xfix It applies to all languages using reference counting.
14:26 xfix (for example, Perl 5)
14:27 xfix But well, sometimes the reference counting is not guaranteed. For example, CPython has reference counting, but Jython doesn't.
14:28 xfix Sadly, Java finalizers are so useless that you may as well call those destructors when the program finishes. I guess that if you do so, the memory won't be deallocated when GC calls, but it rarely matters.
14:35 smls An now for something completely different...   :P
14:35 smls I share the concern behind this comment from ~2 weeks ago in the backlog: "<moritz>  I'm increasingly worried by p6's choice of making rw accessors that use assignment␤ <moritz>  it makes it much harder to add validation logik later on"
14:36 smls Although I don't think the solution is to stop providing «has $.foo is rw», but rather to provide an easier "upgrade path" to manually defined setters/getters.
14:36 xfix Ruby has methods like "property=".
14:36 smls Or in other words, it would be nice to have syntactic sugar for that, which could replace the "construct and return a Proxy object" boilerplate.
14:37 xfix Getters and setters should be here. Otherwise, you end with Java, and its getName() properties.
14:37 xfix (who uses public properties in Java either way... it's all get* and set*)
14:38 anaeem1_ joined #perl6
14:40 jnthn In my experience, getters/setters are way overused in most "OO" code.
14:40 jnthn (Scare quotes 'cus code that uses getters/setters heavily is typically procedural code dressed up to look OO.)
14:42 masak good OO is about behaviors. getters mostly help leak encapsulation internals. setters encourage breaking invariants and tends to lead to anemic APIs.
14:42 xfix (right now our get* code looks like return property, but later it may expand, so we stay at set* and get*)
14:42 xfix Java is not a good example of OO in my opinion, but you are free to disagree.
14:42 xfix It also lacks basic features like lambdas.
14:43 xfix (even Smalltalk has these)
14:43 jnthn Well, Java 8 got lambdas :)
14:43 jnthn But yeah, what masak++ said.
14:43 masak xfix: Java 8 was released in March.
14:43 smls masak: but sometimes you do want validation logic that exceeds what  «has $.foo where ...»  can provide, don't you?
14:43 masak smls: oh, absolutely.
14:44 masak smls: validation logic is a sign that you're doing things *right*.
14:44 masak smls: I'm just saying there's no need for that validation logic to reside in *setters*.
14:44 masak smls: instead of focusing on getters and setters, focus on what you want your object to *do*.
14:45 masak focus on verbs. what are some rich, juicy verbs you can use to describe your object's behavior. (and you're not allowed to pick "update".)
14:45 jnthn These days I tend to design objects method-first. Heck, a bunch of the time I know what my methods should be before I know what my classes should be. Why? Because looking at the invariants helps identify consistency boundaries and responsibilities. Then attributes are just an implementation detail to me; they're the last thing I do.
14:45 xfix void public setCount(int count) { if (count < 0) { /* throw some exception because we use language without unsigned integers */ } this.count = count; }
14:45 smls I didn't mean setters/getters as separate methods, I meant adding getter/setter functionality behind-the-scenes to an exsisting   $.foo  attribute
14:45 smls without changing the API of the class
14:45 jnthn Once I'm doing attributes, I've taken my architect hat off, and put my data-structure-aware programmer hat on.
14:45 xfix s/void public/public void/
14:46 masak xfix: my point is: what's an outside consumer of the API doing setting the count in the first place? what's the user story behind having that setter?
14:47 jnthn xfix: setCount is a weird example to me because, well, count of what, but also surely the count of something is heavily tied to the somethings....
14:47 masak right.
14:47 colomon IMO, masak and jnthn are describing a certain type of object, but by no means the only sort of object possible or desirable.
14:48 colomon for instance, look at Audio::Taglib::Simple
14:48 masak troo.
14:49 masak https://github.com/avuserow/perl6-audio-taglib-simple/
14:50 colomon yeah.  the object there's job is exactly to look like a struct.
14:50 masak a C lib wrapper.
14:50 colomon and the getters / setters are its entire reason for existing.
14:50 colomon it is a C lib wrapper, but that's not the point.
14:51 colomon I mean, it looks like a struct because it is one.
14:51 colomon (not necessarily really, but conceptually.)
14:51 colomon it's giving you access to the tags on a file.
14:51 colomon getting them and setting them are literally all you want it to be able to do
14:52 * colomon has been working on his scripts that use Audio::Taglib::Simple today, because he has also been working on cleaning up some of his MP3 files.
14:53 jnthn Yes, which is fair enough, but "looks like a struct" captures what's going on there.
14:53 masak I was about to say that.
14:53 masak but I wouldn't want it to come out as "that's not *real* OO"
14:53 xfix Programming is hard.
14:53 colomon it's a real, valid, and extremely useful use of an object
14:53 masak but fun!
14:53 xfix That too.
14:54 masak colomon: it's an object, without a doubt.
14:54 jnthn colomon: Yes, I'm not saying it's badly designed. I'm just saying that too much software I see *only* has this kind of object.
14:54 masak colomon: and I struggle to see how it could be implemented otherwise.
14:54 masak ah. what jnthn++ said.
14:54 xfix class LoginController { method login() { ... }; method logout() { ... } } # Because that's totally an object...
14:54 masak yes, it might be an "alternate hard and soft layers" kind of thing.
14:55 masak xfix: at least that focuses on behaviors :)
14:55 xfix Yes, but I have a feeling this code comes from lack of namespaces, or something.
14:55 colomon jnthn: I'm not trying to say that should be the only kind of object -- far from it.  Just that it is a valid kind of object
14:56 jnthn colomon: Yes, I agree.
14:56 c1sung joined #perl6
14:56 vendethiel joined #perl6
14:57 colomon or in other words, just because some knobhead might misuse getters and setters is not a valid reason to not make creating them as easy as possible.  ;)
14:57 jnthn colomon: And we did: "has Type $.x [is rw]" :)
14:58 jnthn I think it's not unreasonable to argue that the point at which enforcing the validation through the type system becomes unweildy might mark the point that this kind of object runs out of steam.
14:59 colomon I'm just pointing out that smls++'s suggestion that it might be worth providing an easy way of doing Proxys for getting / setting is not unreasonable.
14:59 smls Using Audio::Taglib::Simple as an example, imagine if this:
14:59 smls has Str $!title; method title() { return Proxy.new(FETCH => sub ($) {$!title;}, STORE => sub ($, Str $in) {taglib_tag_set_title($!taglib-tag, $in); $!title = $in; }, ); }
15:00 smls could be written like this:
15:00 smls has Str $!title is stored({ taglib_tag_set_title($!taglib-tag, $_); $_ });
15:00 smls or similar
15:00 colomon smls: hmmm… that probably can be implemented by a user.  as an experiment and all.
15:00 smls maybe as a role rather than a traid_mod, but you get the idea
15:02 masak ooh, I'm all for making sugar for Proxy.
15:02 jnthn I can see the arguments for it, but I think it can be explored in module space first...
15:05 masak +1
15:06 askz joined #perl6
15:16 cibs joined #perl6
15:19 colomon hmmm, panda just failed to build for me.
15:21 colomon t/installer.t .. Failed 1/8 subtests
15:21 colomon that's under the latest moar
15:22 * colomon is having a very lazy day
15:24 colomon eeek!
15:24 colomon ok 7 - git files not copied
15:24 colomon Segmentation fault (core dumped)
15:24 jnthn ugh
15:25 jnthn Is this with bleeding edge Moar, or MOAR_REVISION one, ooc?
15:29 colomon This is perl6 version 2014.05-149-g28d6725 built on MoarVM version 2014.05-18-g6b19b4b
15:29 colomon (it's whatever rakudobrew gives you as of ten minutes ago)
15:32 zakharyas joined #perl6
15:35 colomon do we have a debug::Trace yet?
15:37 jnthn I think "use Devel::Trace;" prints every statement.
15:37 jnthn r: use Devel::Trace; say 42;
15:37 camelia rakudo-{parrot,jvm} 28d672: OUTPUT«use Devel::Trace␤say 42␤42␤»
15:37 camelia ..rakudo-moar 28d672: OUTPUT«42␤use Devel::Trace␤say 42␤»
15:37 * colomon realizes he cannot use panda to install Devel::Trace
15:37 jnthn No, it's build in to Rakudo
15:37 colomon \o/
15:38 colomon …. errr, that doesn't seem to have done anything?
15:39 jnthn I think it'll only work for scripts, not if you have a pre-compiled module...
15:39 colomon I'm trying it directly on t/installer.t
15:40 colomon and there is no additional input
15:43 colomon *output
15:45 lizmat m: {use Devel::Trace}; say "foo"  # not lexically soped
15:45 camelia rakudo-moar 28d672: OUTPUT«foo␤{use Devel::Trace}␤say "foo"  # not lexically soped␤»
15:45 anaeem___ joined #perl6
15:50 jnthn Heading out for a while...back later tonight &
15:50 brrt joined #perl6
15:51 chenryn joined #perl6
15:54 thou joined #perl6
16:01 MContagious joined #perl6
16:01 guru joined #perl6
16:02 MContagious hi Folks... can I know how to run shell commands withing perl6 something like ... open (FH, "command |") in perl5
16:02 vendethiel joined #perl6
16:04 MContagious I have to read a csv.gz file content... So, I thought of using zcat to read the file content... How can I achieve this in perl6
16:07 masak dinner &
16:12 mr-fooba_ joined #perl6
16:12 TimToady m: given open "/bin/ls", :p { .slurp.say }
16:12 camelia rakudo-moar 28d672: OUTPUT«open is disallowed in restricted setting␤  in sub restricted at src/RESTRICTED.setting:2␤  in sub open at src/RESTRICTED.setting:5␤  in block  at /tmp/AOtuSrdwsE:1␤␤»
16:13 TimToady unfortunately it doesn't scan PATH for you, so you might need to invoke a shell
16:14 TimToady (I would consider that a bug.)
16:15 MContagious hi can anybody answer me ?
16:16 TimToady I just did
16:17 Ulti :P isnt a smilee but an option to open
16:18 TimToady you want open "/bin/zcat", :p or some such
16:19 molaf_ joined #perl6
16:20 TimToady or you could turn http://rosettacode.org/wiki/LZW_compression#Perl_6 into a module :)
16:22 TimToady it's probably better to use a pipe on multicore
16:25 MContagious thanks
16:30 treehug88 joined #perl6
16:30 vendethiel isn't there something on Array to turn `<a b c>` to `a => 'a', b => 'b', 'c' => 'c'`?
16:33 lee__ m: @a = <a b c>; (@a Z @a).hash # probably a better way
16:33 camelia rakudo-moar 28d672: OUTPUT«[31m===[0mSORRY![31m===[0m Error while compiling /tmp/NW047lH8Buâ�¤Variable '@a' is not declaredâ�¤at /tmp/NW047lH8Bu:1â�¤------> [32m@a[33mâ��[31m = <a b c>; (@a Z @a).hash # probably a [0mâ�¤    expecting any of:â�¤        postfixâ�¤Â»
16:33 lee__ m: my @a = <a b c>; say (@a Z @a).hash # probably a better way
16:33 camelia rakudo-moar 28d672: OUTPUT«("a" => "a", "b" => "b", "c" => "c").hash␤»
16:34 vendethiel yeah, but you need to be predeclared then. You can't (^50).assoc;
16:36 lee__ could always resort to map
16:36 btyler joined #perl6
16:36 smls (^50).map({ $_ => $_ })
16:37 vendethiel m: say (^5).map(* => *)
16:37 camelia rakudo-moar 28d672: OUTPUT«Not enough positional parameters passed; got 1 but expected 2␤  in block  at /tmp/xUxGg0RZl6:1␤␤»
16:38 smls the  *=>*  closure wants 2 arguments
16:38 vendethiel yeah
16:44 MContagious with dir I am getting some IO::Path objects and I want to get the actual path of the file. Something like toString
16:44 brrt joined #perl6
16:44 vendethiel MContagious: .Str ? or prefix ~
16:45 vendethiel it works great. https://github.com/Nami-Doc/Sprockets.pl/blob/master/lib/Sprockets/Locator.pm6#L20
16:45 MContagious very cool
16:52 TimToady "compiling a cumulative OUTER" sounds quite similar to what the REPL really wants to do to the current lexical scope
16:53 TimToady sort of the tail recursion optimization for scopes
16:54 TimToady "turn my setting into a prelude" :)
17:03 rurban joined #perl6
17:05 rurban1 joined #perl6
17:06 sftp_ joined #perl6
17:06 hoverboard joined #perl6
17:06 ivanshmakov joined #perl6
17:10 MContagious $var =~ s/something(\d+)/$1/; # how to write this in perl6
17:11 xfix $var ~~ s/something(\d+)/$0/;
17:11 TimToady =~ turns into ~~ and $1 turns into $0
17:11 MContagious thanks
17:11 TimToady and be carefule with 'something' if it's not really alphanumeric, since all non-alphanum have to be quoted
17:11 TimToady *ful
17:12 timotimo you can also do s/something )> \d+//
17:12 xfix Yes, Perl 6 regexes are intended to be more consistent. In Perl 5, $0 contained name of program. In Perl 6, the regex variables start from 0, to be consistent with arrays.
17:13 xfix (and $0 is actually syntactic sugar for $/[0])
17:14 timotimo i think <( and )> get way underused
17:14 timotimo at least by me.
17:16 timotimo m: say "foo bar" ~~ / )> \w+ <( / # trololo
17:16 camelia rakudo-moar 28d672: OUTPUT«#<failed match>␤»
17:16 TimToady p6 has a lot of figure/ground reversals from "standard practice", and those tend to be underutilized
17:17 TimToady .comb vs .split is another
17:17 timotimo aye, in that case, you're just writing your cobol in p6
17:18 btyler timo: what are <( and )>?
17:18 TimToady inside-out lookbehind/lookahead
17:18 timotimo that's a cute way to put it
17:18 TimToady the set the returned start/end of the match
17:19 TimToady *they
17:19 timotimo i wonder if rakudo should warn/throw an error when a <( or )> is quantified
17:20 TimToady well, could warn on any quantified known-zero-width
17:20 timotimo isn't something like [ <( a ]+ a problem?
17:21 smls $var ~~= s/something (\d+)/$0/  # is this the canonical way to make it mutating (like MContagious' P5 statement)?
17:21 timotimo another thing i find myself underusing; maybe "fortunately", is & in regex
17:21 TimToady it's already mutating
17:21 TimToady use .subst for the non-mutating by default
17:21 TimToady or .=subst for mutating
17:22 smls oh, good to know
17:23 TimToady [ <( a ]+ would set the .from each time, so would leave it before the final 'a'
17:24 TimToady ( <( a )+ otoh would set the .from for each submatch object
17:24 TimToady uselessly, in this case
17:25 timotimo oh, that works in submatches if you have captures?
17:25 xfix I actually like / something <( something else )> something different /
17:25 timotimo that's pretty neat actually
17:26 xfix But I didn't know I don't have to use both. Interesting.
17:26 TimToady timotimo well, supposed to work that way
17:26 timotimo m: say "hey:what is:going on:here dude:bro" ~~ m/ ( \w+ \: <( \w+ )+ /;
17:26 camelia rakudo-moar 28d672: OUTPUT«「hey:what」␤ 0 => 「what」␤␤»
17:26 timotimo m: say "hey:what is:going on:here dude:bro" ~~ m/ ( \w+ \: <( \w+ )+ % " " /;
17:26 camelia rakudo-moar 28d672: OUTPUT«「hey:what is:going on:here dude:bro」␤ 0 => 「what」␤ 0 => 「going」␤ 0 => 「here」␤ 0 => 「bro」␤␤»
17:26 timotimo yes, that *is* pretty cool!
17:27 xfix But I guess it makes sense. There is no ambiguity in `<(` and `)>` after all. They aren't real parenthesis.
17:27 xfix Perl 5 has `<(` called `\K`, if I understand correctly.
17:28 TimToady sounds right
17:29 timotimo i'm really glad all these weird backslash sequences were tossed
17:30 * TimToady bows
17:30 xfix And `)>` is somewhat like `(?= )`.
17:30 TimToady A5 was the most revolutionary of the apocalypses, at least up till then
17:30 xfix Regexes needed improvements.
17:31 xfix `(?`)? I think that even extending `{` would have been better.
17:31 timotimo and IMO perl6 did very, very well.
17:31 TimToady well, they needed a complete rethink
17:32 TimToady starting with "no, regexes aren't just funny strings"
17:32 TimToady they are True Language
17:32 xfix \Q$variable\E was crazy.
17:32 TimToady yeah, string-think
17:32 TimToady another thing we turned inside out
17:33 TimToady and doing so also fixed the whole $1 vs \1 fiasco
17:33 xfix You don't go, and run mysql_query("SELECT * FROM users WHERE name = '$_GET[name]' AND password = '$_GET[password]'").
17:33 smls xfix: I always use quotemeta() instead
17:33 smls less WAT
17:33 xfix \Q is quotemeta.
17:33 smls yeah, but more confusing
17:34 TimToady indeed, it really is underneath, it's not just like quotemeta
17:34 xfix Either way, quotemeta or \Q, it's still silly.
17:34 * TimToady bows for that too, in a more orz fashion
17:35 TimToady but ya know, early Perl had to play the hand that it was dealt
17:35 xfix Perl 5 regexes had a problem with compatibility.
17:35 xfix You couldn't really extend syntax.
17:35 eMBee joined #perl6
17:35 TimToady yes, there were cultural constraints that we threw off with P6
17:35 xfix So, there was barely any invalid syntax that could be used for extensions.
17:36 xfix I think it only had \<letter>, (?, (*, and (+.
17:36 xfix (I personally would have used `{` for this, but I guess it wasn't an option for some reason)
17:36 TimToady well, we wanted {} to almost always be closure in P6
17:37 TimToady and <> was available, if you squinted
17:37 xfix In previous versions of Perl, while preserving compatibility.
17:37 TimToady and <foo> was already like a lot of grammar engines
17:37 TimToady right, sorry
17:37 xfix `{` has barely any valid syntax. `{X}`, `{X,}` and `{X,Y}`.
17:38 TimToady well, basically means you can't match digits inside {}
17:38 TimToady but for extensibility, woulda worked
17:38 TimToady otoh people with certain keyboards woulda groaned
17:39 TimToady I think some people have to type like 5 keys to get a brace
17:39 xfix On my keyboard, ( is Shift+9 and { is Shift+[. But I guess that on regional keyboards, it would have been differently.
17:39 xfix On the other hand, the programmers already had to deal with C braces somehow.
17:39 TimToady but closures don't happen as often as metathingies
17:40 TimToady and people probably had macros for common C insertions in that case
17:40 xfix Well, I would think that blocks are quite common in Perl programs. Who doesn't write `sub name { }`, after all?
17:40 TimToady I think my vim still has a ^B macro to insert a block...
17:42 thou joined #perl6
17:42 xfix The regular expressions would be shorter if `{` would be used instead of `(?`.
17:42 xfix Of course, that would mean no recursion syntax like `(?1)`, but that is syntactic sugar for `(?&1)` either way.
17:43 timotimo regular expressions were already too damn short in many cases :P
17:43 xfix (?:) is anything but short.
17:43 dalek specs: ba919b5 | grondilu++ | S32-setting-library/IO.pod:
17:43 dalek specs: adding missing =back
17:43 dalek specs: review: https://github.com/perl6/specs/commit/ba919b589a
17:43 xfix (at least compared to `()`)
17:44 timotimo but (?: ) is not the same as (), it's the same as [] :)
17:44 timotimo i don't really know what we're arguing about and/or for at the moment
17:44 TimToady xfix is talking about P5
17:44 timotimo mh
17:44 TimToady woulda coulda been P5
17:45 xfix The enhancements in Perl 6 are nice, but I wonder how would Perl look if `{` was used instead of `(?`.
17:45 xfix {:a|b} doesn't look as bad as (?:a|b) in my opinion.
17:45 TimToady $ perl6 -e 'slurp("STD.pm6").comb.Bag.pairs.sort.say'
17:45 TimToady "\n" => 6374 " " => 64161 "!" => 444 "\"" => 1859 "#" => 1026 "\$" => 3363 "\%" => 480 "\&" => 119 "'" => 3406 "(" => 1652 ")" => 1616 "*" => 1123 "+" => 229 "," => 940 "-" => 182 "." => 1910 "/" => 323 "0" => 375 "1" => 284 "2" => 735 "3" => 122 "4" => 59 "5" => 92 "6" => 94 "7" => 125 "8" => 99 "9" => 148 ":" => 2157 ";" => 1582 "<" => 3642 "=" => 1627 ">" => 3980 "?" => 713 "\@" => 334 "A" => 646 "B" => 282 "C" => 531 "D" => 448 "E" => 989 "F" => 250
17:46 xfix Newlines and spaces are quite common, it appears.
17:46 TimToady 3600 angles vs 1900 braces
17:46 xfix (but I wonder why it sorts so strangely here)
17:47 xfix (oh, right, it sorts keys, not values)
17:47 TimToady so I'd say in this case it's better to hand the huffman award to <> than to {}
17:47 xfix I probably agree. `{` has too many overloads in Perl 5.
17:47 TimToady at least in STD, there's nearly twice as many extension brackets as there are closure curlies
17:48 TimToady and that's with a lot of support methods that aren't regex at all
17:49 xfix It's for blocks. It's for hash references. It's for repetition. It's for scalar dereference. It's for functions.
17:49 TimToady I think you left one out
17:49 xfix And it's for interpolating variables in strings.
17:49 TimToady there you go :)
17:49 TimToady and for pick-you-own quotes, if you like :)
17:49 TimToady *your
17:50 xfix And it's for accessing hashes.
17:50 xfix How I forgot about this.
17:50 xfix {a => "b"}->{a}
17:50 xfix q{} doesn't quite count :-).
17:51 xfix (but I agree I often use braces for regexes in qr syntax)
17:51 TimToady at least we managed to turn ${foo} into {$foo} to combine two of those
17:52 TimToady at the "expense" of allowing closure interpolation
17:52 TimToady which some people carped about at the beginning, but haven't heard much of that lately :)
17:52 xfix By the way, literal { in regexes is deprecated in Perl 5. Instead of /{/, you should write /\{/.
17:53 xfix I also forgot one usage of {, now that I think about it. They are used as delimiters for \ sequences, like \x{100}.
17:53 TimToady yes, that was the other thing, historically { } was literal, not reserved
17:54 xfix They deprecated literal { to allow additional extensions of regex grammar.
17:54 * xfix .o( have they han out of `(?` sequences )
17:54 TimToady we reserved all punctuation in P6 because we know we're not smart enough to figure it all in advance, and the users aren't smart enough to remember anyway
17:55 xfix s/han/ran/
17:55 TimToady that's like asking if the circus has run out of clowns
17:56 xfix But if I think about it, they use `(??` sequences now.
17:57 xfix There is just one `(??` sequence right now, but they do use `(??` in rather generic way.
17:57 xfix (allowing for future expansions)
17:58 vendethiel joined #perl6
17:58 xfix (and they use `(?*`)
17:58 xfix I mean, `(*`.
17:58 xfix For example, `(*THEN)` behaves like `::` from Perl 6 according to the documentation.
18:01 xfix But at least Perl 5 regexes were consistent with escaping. To be honest, I don't know what should I escape in grep, and what I shouldn't.
18:04 xfix Documentation says that I have to escape `?`, `+`, `{`, `|`, `(` and `)` to get their special meaning. This is crazy.
18:04 * TimToady had some sanity even back then
18:05 smls `grep -P` FTW
18:05 geekosaur xfix: that's a gnuism
18:06 xfix What is the impact on performance with `grep -P` option?
18:06 smls faster, actually
18:06 geekosaur regular grep doesn't understand those metacharacters at all (try egrep / grep -E)
18:06 smls last time I checked
18:06 xfix It uses Perl regular expression, so I assume it kills grep optimizations.
18:06 * TimToady remembers seeing the term "GNU/Perl" and shuddering
18:06 geekosaur huh? any optimizations in grep would be in its regex engine. pcre has its own optimizations
18:06 smls maybe it uses PCRE, which does JIT?
18:07 geekosaur yes, grep -P is PCRE
18:07 xfix GNU/Perl - we at GNU created Linux, Perl, Python, and everything free you use (hey, they use GPL license after all, so they are ours).
18:09 smls alias ?='grep -Pi'   # in bashrc or zshrc
18:11 xfix `fish: Illegal command name '?'`
18:11 xfix heh
18:11 smls clearly an inferior shell ;)
18:12 TimToady below sea level is pretty low
18:12 xfix I could modify it to allow `?` here, but why.
18:12 xfix I can define function called ?, but I need to call it with \? or '?' or "?".
18:12 geekosaur .oO { seems pretty fishy to me }
18:12 geekosaur actually that would be expected since it's a glob otherwise
18:14 xfix Actually, it seems that zsh doesn't accept '?' as function name, and fish doesn't have aliases.
18:15 xfix But `set fish_user_abbreviations '?=grep -Pi'` seems to work.
18:15 xfix (abbreviations are like aliases, except automatically expanded on command line after aliasing them, it's also experimental feature, so it doesn't have nice API right now)
18:16 xfix s/aliasing/entering/
18:30 vendethiel .oO( Stallman-driven development )
18:40 FROGGS joined #perl6
18:41 rurban joined #perl6
18:49 vendethiel https://github.com/LearnBoost/stylus/pull/1580 I think CSS preprocessor can NOT add every feature you need in other languages.
18:54 vendethiel Perl 6 CSS. Not as a slang, just integrated into the main lang.
18:55 raiph joined #perl6
18:55 dayangkun joined #perl6
19:10 nebuchadnezzar hello
19:10 vendethiel o/
19:12 nebuchadnezzar I'm trying to package the moarvm backend for Debian and found that nqp with this backend put .moarvm files under /usr/languages
19:12 nebuchadnezzar http://paste.debian.net/103880/
19:12 nebuchadnezzar I'm not sure Debian will be happy with this :-/
19:13 * vendethiel doesn't linux
19:15 nebuchadnezzar it may be like with parrot, moving /usr/languages/nqp under /usr/lib/moar/<moar_version>/languages/
19:15 FROGGS nebuchadnezzar: there already is an nqp issues about that
19:15 FROGGS we need to fix that
19:16 btyler joined #perl6
19:16 FROGGS https://github.com/perl6/nqp/issues/154
19:16 nebuchadnezzar arf, sorry for noise and thanks for the hints
19:17 FROGGS no, please add your info to the ticket :o)
19:20 nebuchadnezzar I'm doing to
19:26 btyler joined #perl6
19:30 thou joined #perl6
19:33 itz joined #perl6
19:35 molaf joined #perl6
19:42 rurban joined #perl6
19:52 beastd joined #perl6
20:07 FROGGS nebuchadnezzar++
20:18 hoverboard joined #perl6
20:20 rurban joined #perl6
20:22 dwarring joined #perl6
20:22 cognominal http://std.pm/  :)
20:26 [Coke] .
20:27 timotimo "if you don't know what std.pm is"
20:27 vendethiel and giving 2 randoms link
20:27 vendethiel that don't explain which does what :/
20:28 xfix I didn't knew there is .pm domain.
20:29 xfix But technically it's std.pm6 :).
20:29 moritz specifically for perl mongers groups :-)
20:29 xfix (or well, STD.pm6)
20:31 xfix Perl 6 CSS would look suspiciously close to AWK in my opinion ;-).
20:34 jack_rabbit joined #perl6
20:46 dalek roast: 89ab348 | (David Warring david.warring@gmail.com)++ | integration/advent2011-day10.t:
20:46 dalek roast: adding advent 2011 day 10 S26++
20:46 dalek roast: review: https://github.com/perl6/roast/commit/89ab348b99
20:47 * dwarring short but sweet - http://perlcabal.org/syn/S26.html
20:52 SevenWolf joined #perl6
20:52 itz joined #perl6
20:55 timotimo i've been so useless the last few days >_<
20:57 * vendethiel doesn't feel like answering "(as opposed to ?)", because he's in a good mood, and because he likes timotimo++
20:58 timotimo d'aaw :)
20:59 vendethiel .oO( Ah ! That was actually a brilliant reverse psychology message to get free karma )
20:59 timotimo thank you for calling something you attribute to me "brilliant"
21:00 vendethiel That was just a reverse psychological call to a pseudo reverse psychology message from you to compliment you again.
21:00 * vendethiel takes a deep breath
21:00 vendethiel Sorry, it's just *TOO DAMN HOT*
21:01 timotimo i watched Tropic Thunder yesterday, and that was about as meta as your reverse psychology stuff right there :)
21:02 carlin joined #perl6
21:06 carlin rakudo-jvm: say $*VM.config<nativecall.o>; say $*VM.config<nativecall.so>;
21:06 camelia rakudo-jvm 28d672: OUTPUT«.o␤so␤»
21:06 carlin .o has a leading dot, but .so doesn't
21:11 Su-Shee joined #perl6
21:18 thou joined #perl6
21:28 thou joined #perl6
21:29 pippo joined #perl6
21:29 pippo o/ #perl6
21:29 timotimo o{
21:30 pippo m: my @strings = ("one,two,three", "one,two,three"); my @a; for @strings { @a.push: $(.split(',')) }; @a[0][1] = "four";
21:30 camelia rakudo-moar 28d672: OUTPUT«Cannot modify an immutable Str␤  in method assign_pos at src/gen/m-CORE.setting:1796␤  in sub postcircumfix:<[ ]> at src/gen/m-CORE.setting:2496␤  in block  at /tmp/LYP_VT8o8V:1␤␤»
21:30 pippo n: my @strings = ("one,two,three", "one,two,three"); my @a; for @strings { @a.push: $(.split(',')) }; @a[0][1] = "four";
21:30 camelia niecza v24-109-g48a8de3: ( no output )
21:30 pippo p: my @strings = ("one,two,three", "one,two,three"); my @a; for @strings { @a.push: $(.split(',')) }; @a[0][1] = "four";
21:30 camelia rakudo-parrot 28d672: OUTPUT«Cannot modify an immutable value␤  in method assign_pos at gen/parrot/CORE.setting:1800␤  in method assign_pos at gen/parrot/CORE.setting:1798␤  in sub postcircumfix:<[ ]> at gen/parrot/CORE.setting:2500␤  in sub postcircumfix:<[ ]> at gen/parrot…»
21:31 pippo n: my @strings = ("one,two,three", "one,two,three"); my @a; for @strings { @a.push: $(.split(',')) }; @a[0][1] = "four"; say @a[0][1];
21:31 camelia niecza v24-109-g48a8de3: OUTPUT«four␤»
21:32 pippo timotimo: do you know why I cannot assign to @a except on niecza?
21:38 smls pippo: You don't turn your inner lists into arrays
21:38 smls So they'll just be itemized lists of strings, without scalar containers around the strings
21:38 smls which are immutable
21:40 smls for @strings { @a.push: [ .split(',') ] };   # if you construct @a like this, it works
21:43 timotimo frankly, it confuses me that niecza will let you do that
21:44 timotimo m: my @strings = ("one,two,three", "one,two,three"); my @a; for @strings { @a.push: $(.split(',')) }; say @a.perl; say @a[0].perl
21:44 camelia rakudo-moar 28d672: OUTPUT«Array.new(("one", "two", "three").list.item, ("one", "two", "three").list.item)␤("one", "two", "three").list.item␤»
21:44 timotimo m: my @strings = ("one,two,three", "one,two,three"); my @a; for @strings { @a.push: $(.split(',')) }; say @a.perl; say @a[0].perl; say @a[0][1].perl;
21:44 camelia rakudo-moar 28d672: OUTPUT«Array.new(("one", "two", "three").list.item, ("one", "two", "three").list.item)␤("one", "two", "three").list.item␤"two"␤»
21:44 timotimo m: my @strings = ("one,two,three", "one,two,three"); my @a; for @strings { @a.push: $(.split(',')) }; say @a.perl; say @a[0].perl; say @a[0][1] = "hi";
21:44 camelia rakudo-moar 28d672: OUTPUT«Array.new(("one", "two", "three").list.item, ("one", "two", "three").list.item)␤("one", "two", "three").list.item␤Cannot modify an immutable Str␤  in method assign_pos at src/gen/m-CORE.setting:1796␤  in sub postcircumfix:<[ ]> at src/gen/m-CORE.se…»
21:44 timotimo it's because it's a list, not an array
21:45 timotimo lists don't have containers in them
21:46 timotimo ah, smls already said that
21:46 timotimo smls++ :)
21:54 pippo smls: timotimo: thank you very much.
21:57 zengargoyle openurl 7
21:59 thou joined #perl6
22:12 virtualsue joined #perl6
22:16 BenGoldberg joined #perl6
22:17 lizmat_ joined #perl6
22:27 water joined #perl6
22:42 Alina-malina joined #perl6
22:44 ivanshmakov joined #perl6
22:44 cognominal r: %[ 'a', 'b' ]
22:45 camelia rakudo-{parrot,jvm,moar} 28d672: OUTPUT«[31m===[0mSORRY![31m===[0m Error while compiling /tmp/tmpfileâ�¤Unsupported use of %[ variableâ�¤at /tmp/tmpfile:1â�¤------> [32m<BOL>[33mâ��[31m%[ 'a', 'b' ][0mâ�¤    expecting any of:â�¤        statement listâ�¤        prefix or term…»
22:45 cognominal r: %([ 'a', 'b' ])
22:45 camelia rakudo-{parrot,jvm,moar} 28d672: ( no output )
22:45 cognominal r: say %([ 'a', 'b' ])
22:45 camelia rakudo-{parrot,jvm,moar} 28d672: OUTPUT«("a" => "b").hash␤»
22:47 sftp_ joined #perl6
22:50 ivanshmakov joined #perl6
23:02 araujo joined #perl6
23:03 rurban joined #perl6
23:09 ivanshmakov joined #perl6
23:16 ivanshmakov joined #perl6
23:23 pippo left #perl6
23:23 sftp_ joined #perl6
23:23 masak r: say %( <a b> )
23:23 camelia rakudo-{parrot,jvm,moar} 28d672: OUTPUT«("a" => "b").hash␤»
23:24 cognominal In my real case the .hash was more elegant
23:29 sftp_ joined #perl6
23:31 sftp joined #perl6
23:32 cognominal pour les 30 de tétris. Tétris on vodka : https://www.youtube.com/watch?v=2YHAM-K5SPE
23:41 ivanshmakov joined #perl6
23:43 ivanshmakov joined #perl6
23:48 masak tonight, rather than sleeping, I found myself imagining a new control flow construct.
23:49 masak it's most similar to gather/take, so I've tentatively called it collect/accept.
23:49 masak it's kind of an extension of the amb keyword.
23:50 masak you do `collect { ...; my $var = accept @alternatives; ...; take $result }`
23:51 masak and at each `accept`, control flow tries all alternatives, in order, backtracking when there are nested `accept`s.
23:53 * vendethiel is too tired to try and understand ;_;
23:53 Tene masak: why backtracking when you encounter another accept?
23:54 masak more like, each accept is another point that the collect block will backtrack to once it runs to the end of the block.
23:54 Tene Ahh.  Yeah, I get it.
23:54 masak in the above code, if @alternatives contains (1, 2, 3), then the block will run 3 times.
23:55 Tene Now, how is that different from for loops?
23:55 masak thinking about it, I think I can emulate this with today's gather and recursion.
23:55 * masak tries
23:55 Tene Or is this a trivial isomorphism to for loops?
23:56 Tene Sometimes trivial isomorphisms are still useful, I'm just not sure if I'm missing something.
23:56 masak no, this is basically some kind of CPS transform, so it's not trivially isomorphic to for loops.
23:57 masak imagine, for example, the `accept` sitting inside a bunch of loops already, interacting with `next`, `last` etc
23:57 * vendethiel is already trying to understand some C++ stuff and getting hammered down with masak's example
23:57 Tene Isn't that just a nested loop?
23:58 masak Tene: hold on, I'll put together a concrete example.
23:58 Tene Sure.  :)

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

Perl 6 | Reference Documentation | Rakudo