»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'perl6: say 3;' or rakudo:, niecza:, std:, or /msg camelia perl6: ... | irclog: irc.perl6.org | UTF-8 is our friend!
Set by sorear on 25 June 2013.
dalek ast: 91885f2 | (David Warring [email@hidden.address] | S26-documentation/10-doc-cli.t:
adding DOC INIT {} test
03:41
asuerhao perl6: say "What is this?" 06:57
camelia rakudo-{parrot,jvm,moar} 28d672, niecza v24-109-g48a8de3: OUTPUT«What is this?␤»
asuerhao perl6: say "@INC"; 06:58
camelia rakudo-{parrot,jvm,moar} 28d672, niecza v24-109-g48a8de3: OUTPUT«@INC␤»
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…»
..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…»
..niecza v24-109-g48a8de3: OUTPUT«␤»
..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…»
sergot morning o/ 08:14
masak antenoon \o 08:33
moritz n\oo/n 09:53
jnthn aftern/oo\n 10:03
colomon mo/rning 10:38
colomon emmentaler broken again overnight 10:47
sergot this was the worst problem when I wanted to generate modules.perl6.org in p6 with checking test passing. 10:49
github.com/sergot/modules.perl6.org 10:50
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. 10:54
dalek c: e7387c3 | sergot++ | lib/IO/FileTestable.pod:
language fix
11:28
smls I wonder, what are the long-term plans for Rakudo, architecture-wise? 13:32
Will NQP go away at some point, making Perl 6 completely self-hosting?
jnthn I've no plans for NQP to go away. 13:34
timotimo TimToady mentioned something about perl 6 itself being so optimized that we can have rakudo self-hosting rather than on nqp 13:35
but i've kinda grown to liking nqp
(stockholm syndrome?)
jnthn It may happen some day, but there's a lot of things that make it hard
And there's just no particular win.
At least, those that may exist today are massively outweighed by the downsides.
smls jnthn: does it affect start-up time?
timotimo aye.
well, nqp runs a whole lot faster than perl6 on rakudo 13:36
and it only takes 1/10 of the ram for starting up, because its core setting is much much slimmer
jnthn smls: Does what affect startup time, exactly?
smls being built on NQP
or does it make no difference once the compiler itself is compiler 13:37
*compiled
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
So we'd be worse off having those bits in full Perl 6.
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.
smls Will we ever match perl' 13:40
s startup time of 0.00s? :P
jnthn No, but we probably don't need to :P
I suspect we can get close enough that on modern hardware it doesn't matter.
Anyway, the *real* killer for Perl 6 in Perl 6 will be the bootstrapping thing. 13:43
jnthn NQP being smaller makes that a bit simpler. 13:44
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
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.
moritz jnthn: maybe we need a two-staged setting :-) 13:46
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
jnthn moritz: Yeah, gets us into issues with CORE:: wanting to be a single lexical scope, is all... 13:49
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?
like, every singel evaluated line adds an OUTER:: to the chain
jnthn Possibly 13:51
You'd have to try and find a way to keep/compile a cumulative outer or something
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?
Is it all the container dereferencing that Perl 6 requires, or what else is going on there in Rakudo?
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
jnthn Right, for native loops it's really close. Heck, for postwhile_nil I think Rakudo even wins...
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
jnthn For the loops that are not native and doing $i++, that ++ is a multi-dispatch. 13:53
In NQP it's not.
timotimo ah, we don't compile-time dispatch that?
jnthn spesh is smart enough at this point to spot it can turn that into single dispatch.
timotimo: no, we can't easily due to auto-viv
But spesh never gets to do that yet because we've no OSR 13:54
timotimo ah
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.
timotimo so, i've been thinking about strength reduction and putting it into optimizer vs spesh
if we put it into spesh, that means that only moar will ever get that opt 13:55
but if we only put it into the optimizer, we may miss a few run-time opportunities
and if we put it into both, it'll be redundant work
jnthn Well, I think the JVM knows how to do strength reduce :P 13:56
timotimo oh. well, it probably does, doesn't it. 13:57
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?
hm. at that point it'll probably not be as important any more when our ropes are actually functional :)
jnthn True, though it is a possible application of escape analysis. 14:00
The analysis is useful for a few things
Though my intial goal for it is avoiding GC allocations
timotimo aye. 14:01
AFK 14:02
smls One more (stupid?) question: Why was Perl style reference counting abandoned in favor of GC? 14:04
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.
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.
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.
smls: Yes, but we spend more time running than we do GCing.
smls ok
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:10
But you can't provide that at a language level if some VMs you want to run can't do it. 14:11
masak ...which is why DESTROY is never going to happen. 14:14
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.
jnthn Yeah. I can't remember the last time I wrote a finalizer in Java or C# either. :) 14:16
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.
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.
But they are convenient in rare cases, just like goto.
smls they are used a lot in C++ though, right? 14:20
xfix Well, yes.
jnthn Oh, for sure, but C++ is rather different memory management wise.
xfix In C++, destructors are memory management.
(there is new/delete, but nobody should use that... I hope) 14:21
However, there is a thing about C++. Unless the destructor is called explicitly, the destructor is called when the variable leaves the scope. 14:22
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:23
colomon C++ destructors are pretty much the only C++ thing I miss in perl 6 14:24
xfix RAII is something not specific to C++. 14:26
It applies to all languages using reference counting.
(for example, Perl 5)
But well, sometimes the reference counting is not guaranteed. For example, CPython has reference counting, but Jython doesn't. 14:27
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:29
smls An now for something completely different... :P 14:35
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"
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=".
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.
xfix Getters and setters should be here. Otherwise, you end with Java, and its getName() properties. 14:37
(who uses public properties in Java either way... it's all get* and set*)
jnthn In my experience, getters/setters are way overused in most "OO" code. 14:40
(Scare quotes 'cus code that uses getters/setters heavily is typically procedural code dressed up to look OO.)
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*)
Java is not a good example of OO in my opinion, but you are free to disagree.
It also lacks basic features like lambdas.
(even Smalltalk has these) 14:43
jnthn Well, Java 8 got lambdas :)
But yeah, what masak++ said.
masak xfix: Java 8 was released in March.
smls masak: but sometimes you do want validation logic that exceeds what «has $.foo where ...» can provide, don't you?
masak smls: oh, absolutely. 14:44
smls: validation logic is a sign that you're doing things *right*.
smls: I'm just saying there's no need for that validation logic to reside in *setters*.
smls: instead of focusing on getters and setters, focus on what you want your object to *do*.
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.
xfix void public setCount(int count) { if (count < 0) { /* throw some exception because we use language without unsigned integers */ } this.count = count; }
smls I didn't mean setters/getters as separate methods, I meant adding getter/setter functionality behind-the-scenes to an exsisting $.foo attribute
without changing the API of the class
jnthn Once I'm doing attributes, I've taken my architect hat off, and put my data-structure-aware programmer hat on.
xfix s/void public/public void/
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:46
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.
colomon IMO, masak and jnthn are describing a certain type of object, but by no means the only sort of object possible or desirable.
for instance, look at Audio::Taglib::Simple 14:48
masak troo.
github.com/avuserow/perl6-audio-taglib-simple/ 14:49
colomon yeah. the object there's job is exactly to look like a struct. 14:50
masak a C lib wrapper.
colomon and the getters / setters are its entire reason for existing.
it is a C lib wrapper, but that's not the point.
I mean, it looks like a struct because it is one. 14:51
(not necessarily really, but conceptually.)
it's giving you access to the tags on a file.
getting them and setting them are literally all you want it to be able to do
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:52
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.
but I wouldn't want it to come out as "that's not *real* OO"
xfix Programming is hard.
colomon it's a real, valid, and extremely useful use of an object
masak but fun!
xfix That too.
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.
masak colomon: and I struggle to see how it could be implemented otherwise.
ah. what jnthn++ said.
xfix class LoginController { method login() { ... }; method logout() { ... } } # Because that's totally an object...
masak yes, it might be an "alternate hard and soft layers" kind of thing.
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.
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
jnthn colomon: Yes, I agree. 14:56
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]" :)
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:58
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:
has Str $!title; method title() { return Proxy.new(FETCH => sub ($) {$!title;}, STORE => sub ($, Str $in) {taglib_tag_set_title($!taglib-tag, $in); $!title = $in; }, ); }
could be written like this: 15:00
has Str $!title is stored({ taglib_tag_set_title($!taglib-tag, $_); $_ });
or similar
colomon smls: hmmm… that probably can be implemented by a user. as an experiment and all.
smls maybe as a role rather than a traid_mod, but you get the idea
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...
masak +1 15:05
colomon hmmm, panda just failed to build for me. 15:19
t/installer.t .. Failed 1/8 subtests 15:21
that's under the latest moar
colomon is having a very lazy day 15:22
eeek! 15:24
ok 7 - git files not copied
Segmentation fault (core dumped)
jnthn ugh 15:25
Is this with bleeding edge Moar, or MOAR_REVISION one, ooc?
colomon This is perl6 version 2014.05-149-g28d6725 built on MoarVM version 2014.05-18-g6b19b4b 15:29
(it's whatever rakudobrew gives you as of ten minutes ago)
colomon do we have a debug::Trace yet? 15:35
jnthn I think "use Devel::Trace;" prints every statement. 15:37
r: use Devel::Trace; say 42;
camelia rakudo-{parrot,jvm} 28d672: OUTPUT«use Devel::Trace␤say 42␤42␤»
..rakudo-moar 28d672: OUTPUT«42␤use Devel::Trace␤say 42␤»
colomon realizes he cannot use panda to install Devel::Trace
jnthn No, it's build in to Rakudo
colomon \o/
…. errr, that doesn't seem to have done anything? 15:38
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
and there is no additional input 15:40
*output 15:43
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␤»
jnthn Heading out for a while...back later tonight & 15:50
MContagious hi Folks... can I know how to run shell commands withing perl6 something like ... open (FH, "command |") in perl5 16:02
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:04
masak dinner & 16:07
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␤␤»
TimToady unfortunately it doesn't scan PATH for you, so you might need to invoke a shell 16:13
(I would consider that a bug.) 16:14
MContagious hi can anybody answer me ? 16:15
TimToady I just did 16:16
Ulti :P isnt a smilee but an option to open 16:17
TimToady you want open "/bin/zcat", :p or some such 16:18
TimToady or you could turn rosettacode.org/wiki/LZW_compression#Perl_6 into a module :) 16:20
it's probably better to use a pipe on multicore 16:22
MContagious thanks 16:25
vendethiel isn't there something on Array to turn `<a b c>` to `a => 'a', b => 'b', 'c' => 'c'`? 16:30
lee__ m: @a = <a b c>; (@a Z @a).hash # probably a better way 16:33
camelia rakudo-moar 28d672: OUTPUT«===SORRY!=== Error while compiling /tmp/NW047lH8Bu␤Variable '@a' is not declared␤at /tmp/NW047lH8Bu:1␤------> @a⏏ = <a b c>; (@a Z @a).hash # probably a ␤ expecting any of:␤ postfix␤»
lee__ m: my @a = <a b c>; say (@a Z @a).hash # probably a better way
camelia rakudo-moar 28d672: OUTPUT«("a" => "a", "b" => "b", "c" => "c").hash␤»
vendethiel yeah, but you need to be predeclared then. You can't (^50).assoc; 16:34
lee__ could always resort to map 16:36
smls (^50).map({ $_ => $_ }) 16:36
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␤␤»
smls the *=>* closure wants 2 arguments 16:38
vendethiel yeah
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
vendethiel MContagious: .Str ? or prefix ~ 16:44
it works great. github.com/Nami-Doc/Sprockets.pl/b...or.pm6#L20 16:45
MContagious very cool
TimToady "compiling a cumulative OUTER" sounds quite similar to what the REPL really wants to do to the current lexical scope 16:52
TimToady sort of the tail recursion optimization for scopes 16:53
"turn my setting into a prelude" :) 16:54
MContagious $var =~ s/something(\d+)/$1/; # how to write this in perl6 17:10
xfix $var ~~ s/something(\d+)/$0/; 17:11
TimToady =~ turns into ~~ and $1 turns into $0
MContagious thanks
TimToady and be carefule with 'something' if it's not really alphanumeric, since all non-alphanum have to be quoted
*ful
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.
(and $0 is actually syntactic sugar for $/[0]) 17:13
timotimo i think <( and )> get way underused 17:14
at least by me. 17:15
m: say "foo bar" ~~ / )> \w+ <( / # trololo 17:16
camelia rakudo-moar 28d672: OUTPUT«#<failed match>␤»
TimToady p6 has a lot of figure/ground reversals from "standard practice", and those tend to be underutilized 17:17
.comb vs .split is another
timotimo aye, in that case, you're just writing your cobol in p6
btyler timo: what are <( and )>? 17:18
TimToady inside-out lookbehind/lookahead
timotimo that's a cute way to put it
TimToady the set the returned start/end of the match
*they 17:19
timotimo i wonder if rakudo should warn/throw an error when a <( or )> is quantified
TimToady well, could warn on any quantified known-zero-width 17:20
timotimo isn't something like [ <( a ]+ a problem?
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
TimToady it's already mutating
use .subst for the non-mutating by default
or .=subst for mutating
smls oh, good to know 17:22
TimToady [ <( a ]+ would set the .from each time, so would leave it before the final 'a' 17:23
( <( a )+ otoh would set the .from for each submatch object 17:24
uselessly, in this case
timotimo oh, that works in submatches if you have captures? 17:25
xfix I actually like / something <( something else )> something different /
timotimo that's pretty neat actually
xfix But I didn't know I don't have to use both. Interesting. 17:26
TimToady timotimo well, supposed to work that way
timotimo m: say "hey:what is:going on:here dude:bro" ~~ m/ ( \w+ \: <( \w+ )+ /;
camelia rakudo-moar 28d672: OUTPUT«「hey:what」␤ 0 => 「what」␤␤»
timotimo m: say "hey:what is:going on:here dude:bro" ~~ m/ ( \w+ \: <( \w+ )+ % " " /;
camelia rakudo-moar 28d672: OUTPUT«「hey:what is:going on:here dude:bro」␤ 0 => 「what」␤ 0 => 「going」␤ 0 => 「here」␤ 0 => 「bro」␤␤»
timotimo yes, that *is* pretty cool!
xfix But I guess it makes sense. There is no ambiguity in `<(` and `)>` after all. They aren't real parenthesis. 17:27
Perl 5 has `<(` called `\K`, if I understand correctly.
TimToady sounds right 17:28
timotimo i'm really glad all these weird backslash sequences were tossed 17:29
TimToady bows 17:30
xfix And `)>` is somewhat like `(?= )`.
TimToady A5 was the most revolutionary of the apocalypses, at least up till then
xfix Regexes needed improvements.
`(?`)? I think that even extending `{` would have been better. 17:31
timotimo and IMO perl6 did very, very well.
TimToady well, they needed a complete rethink
starting with "no, regexes aren't just funny strings" 17:32
they are True Language
xfix \Q$variable\E was crazy.
TimToady yeah, string-think
another thing we turned inside out
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]'").
smls xfix: I always use quotemeta() instead
less WAT
xfix \Q is quotemeta.
smls yeah, but more confusing 17:34
TimToady indeed, it really is underneath, it's not just like quotemeta
xfix Either way, quotemeta or \Q, it's still silly.
TimToady bows for that too, in a more orz fashion
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.
You couldn't really extend syntax.
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.
I think it only had \<letter>, (?, (*, and (+. 17:36
(I personally would have used `{` for this, but I guess it wasn't an option for some reason)
TimToady well, we wanted {} to almost always be closure in P6
and <> was available, if you squinted 17:37
xfix In previous versions of Perl, while preserving compatibility.
TimToady and <foo> was already like a lot of grammar engines
right, sorry
xfix `{` has barely any valid syntax. `{X}`, `{X,}` and `{X,Y}`.
TimToady well, basically means you can't match digits inside {} 17:38
but for extensibility, woulda worked
otoh people with certain keyboards woulda groaned
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.
On the other hand, the programmers already had to deal with C braces somehow.
TimToady but closures don't happen as often as metathingies
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?
TimToady I think my vim still has a ^B macro to insert a block...
xfix The regular expressions would be shorter if `{` would be used instead of `(?`. 17:42
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
xfix (?:) is anything but short.
dalek ecs: ba919b5 | grondilu++ | S32-setting-library/IO.pod:
adding missing =back
xfix (at least compared to `()`)
timotimo but (?: ) is not the same as (), it's the same as [] :) 17:44
i don't really know what we're arguing about and/or for at the moment
TimToady xfix is talking about P5
timotimo mh
TimToady woulda coulda been P5
xfix The enhancements in Perl 6 are nice, but I wonder how would Perl look if `{` was used instead of `(?`. 17:45
{:a|b} doesn't look as bad as (?:a|b) in my opinion.
TimToady $ perl6 -e 'slurp("STD.pm6").comb.Bag.pairs.sort.say'
"\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
xfix Newlines and spaces are quite common, it appears. 17:46
TimToady 3600 angles vs 1900 braces
xfix (but I wonder why it sorts so strangely here) 17:47
(oh, right, it sorts keys, not values)
TimToady so I'd say in this case it's better to hand the huffman award to <> than to {}
xfix I probably agree. `{` has too many overloads in Perl 5.
TimToady at least in STD, there's nearly twice as many extension brackets as there are closure curlies
and that's with a lot of support methods that aren't regex at all 17:48
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
xfix And it's for interpolating variables in strings.
TimToady there you go :)
and for pick-you-own quotes, if you like :)
*your 17:50
xfix And it's for accessing hashes.
How I forgot about this.
{a => "b"}->{a}
q{} doesn't quite count :-). 17:51
(but I agree I often use braces for regexes in qr syntax)
TimToady at least we managed to turn ${foo} into {$foo} to combine two of those
at the "expense" of allowing closure interpolation 17:52
which some people carped about at the beginning, but haven't heard much of that lately :)
xfix By the way, literal { in regexes is deprecated in Perl 5. Instead of /{/, you should write /\{/.
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
xfix They deprecated literal { to allow additional extensions of regex grammar. 17:54
xfix .o( have they han out of `(?` sequences )
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
xfix s/han/ran/ 17:55
TimToady that's like asking if the circus has run out of clowns
xfix But if I think about it, they use `(??` sequences now. 17:56
There is just one `(??` sequence right now, but they do use `(??` in rather generic way. 17:57
(allowing for future expansions)
xfix (and they use `(?*`) 17:58
I mean, `(*`.
For example, `(*THEN)` behaves like `::` from Perl 6 according to the documentation.
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:01
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
smls `grep -P` FTW 18:05
geekosaur xfix: that's a gnuism
xfix What is the impact on performance with `grep -P` option? 18:06
smls faster, actually
geekosaur regular grep doesn't understand those metacharacters at all (try egrep / grep -E)
smls last time I checked
xfix It uses Perl regular expression, so I assume it kills grep optimizations.
TimToady remembers seeing the term "GNU/Perl" and shuddering
geekosaur huh? any optimizations in grep would be in its regex engine. pcre has its own optimizations
smls maybe it uses PCRE, which does JIT?
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).
smls alias ?='grep -Pi' # in bashrc or zshrc 18:09
xfix `fish: Illegal command name '?'` 18:11
heh
smls clearly an inferior shell ;)
TimToady below sea level is pretty low 18:12
xfix I could modify it to allow `?` here, but why.
I can define function called ?, but I need to call it with \? or '?' or "?".
geekosaur .oO { seems pretty fishy to me }
actually that would be expected since it's a glob otherwise 18:13
xfix Actually, it seems that zsh doesn't accept '?' as function name, and fish doesn't have aliases. 18:14
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:15
s/aliasing/entering/ 18:16
vendethiel
.oO( Stallman-driven development )
18:30
vendethiel github.com/LearnBoost/stylus/pull/1580 I think CSS preprocessor can NOT add every feature you need in other languages. 18:49
Perl 6 CSS. Not as a slang, just integrated into the main lang. 18:54
nebuchadnezzar hello 19:10
vendethiel o/
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
paste.debian.net/103880/
I'm not sure Debian will be happy with this :-/
vendethiel doesn't linux 19:13
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
we need to fix that
FROGGS github.com/perl6/nqp/issues/154 19:16
nebuchadnezzar arf, sorry for noise and thanks for the hints
FROGGS no, please add your info to the ticket :o) 19:17
nebuchadnezzar I'm doing to 19:20
FROGGS nebuchadnezzar++ 20:07
cognominal std.pm/ :) 20:22
[Coke] . 20:26
timotimo "if you don't know what std.pm is" 20:27
vendethiel and giving 2 randoms link
that don't explain which does what :/
xfix I didn't knew there is .pm domain. 20:28
But technically it's std.pm6 :). 20:29
moritz specifically for perl mongers groups :-)
xfix (or well, STD.pm6)
Perl 6 CSS would look suspiciously close to AWK in my opinion ;-). 20:31
dalek ast: 89ab348 | (David Warring [email@hidden.address] | integration/advent2011-day10.t:
adding advent 2011 day 10 S26++
20:46
dwarring short but sweet - perlcabal.org/syn/S26.html 20:47
timotimo i've been so useless the last few days >_< 20:55
vendethiel doesn't feel like answering "(as opposed to ?)", because he's in a good mood, and because he likes timotimo++ 20:57
timotimo d'aaw :) 20:58
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"
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
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 :)
carlin rakudo-jvm: say $*VM.config<nativecall.o>; say $*VM.config<nativecall.so>; 21:06
camelia rakudo-jvm 28d672: OUTPUT«.o␤so␤»
carlin .o has a leading dot, but .so doesn't
pippo o/ #perl6 21:29
timotimo o{
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␤␤»
pippo n: my @strings = ("one,two,three", "one,two,three"); my @a; for @strings { @a.push: $(.split(',')) }; @a[0][1] = "four";
camelia ( no output )
pippo p: my @strings = ("one,two,three", "one,two,three"); my @a; for @strings { @a.push: $(.split(',')) }; @a[0][1] = "four";
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…»
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␤»
pippo timotimo: do you know why I cannot assign to @a except on niecza? 21:32
smls pippo: You don't turn your inner lists into arrays 21:38
So they'll just be itemized lists of strings, without scalar containers around the strings
which are immutable
for @strings { @a.push: [ .split(',') ] }; # if you construct @a like this, it works 21:40
timotimo frankly, it confuses me that niecza will let you do that 21:43
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␤»
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;
camelia rakudo-moar 28d672: OUTPUT«Array.new(("one", "two", "three").list.item, ("one", "two", "three").list.item)␤("one", "two", "three").list.item␤"two"␤»
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";
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…»
timotimo it's because it's a list, not an array
lists don't have containers in them 21:45
ah, smls already said that 21:46
smls++ :)
pippo smls: timotimo: thank you very much. 21:54
zengargoyle openurl 7 21:57
cognominal r: %[ 'a', 'b' ] 22:44
camelia rakudo-{parrot,jvm,moar} 28d672: OUTPUT«===SORRY!=== Error while compiling /tmp/tmpfile␤Unsupported use of %[ variable␤at /tmp/tmpfile:1␤------> <BOL>⏏%[ 'a', 'b' ]␤ expecting any of:␤ statement list␤ prefix or term…» 22:45
cognominal r: %([ 'a', 'b' ])
camelia ( no output )
cognominal r: say %([ 'a', 'b' ])
camelia rakudo-{parrot,jvm,moar} 28d672: OUTPUT«("a" => "b").hash␤»
masak r: say %( <a b> ) 23:23
camelia rakudo-{parrot,jvm,moar} 28d672: OUTPUT«("a" => "b").hash␤»
cognominal In my real case the .hash was more elegant 23:25
cognominal pour les 30 de tétris. Tétris on vodka : www.youtube.com/watch?v=2YHAM-K5SPE 23:32
masak tonight, rather than sleeping, I found myself imagining a new control flow construct. 23:48
it's most similar to gather/take, so I've tentatively called it collect/accept. 23:49
it's kind of an extension of the amb keyword.
you do `collect { ...; my $var = accept @alternatives; ...; take $result }` 23:50
and at each `accept`, control flow tries all alternatives, in order, backtracking when there are nested `accept`s. 23:51
vendethiel is too tired to try and understand ;_; 23:53
Tene masak: why backtracking when you encounter another accept?
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.
masak in the above code, if @alternatives contains (1, 2, 3), then the block will run 3 times.
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.
masak tries
Tene Or is this a trivial isomorphism to for loops?
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.
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
Tene Isn't that just a nested loop?
masak Tene: hold on, I'll put together a concrete example. 23:58
Tene Sure. :)