»ö« 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.
paxcoder Hello. I asked people in #perl where I can learn progressive ideas that are specific to perl. They suggested Moo and HOP. Can you perhaps suggest perl6-specific reading I should add to those? 00:39
japhb__ looks at his screen as if the computer has completely lost its mind. 00:40
paxcoder , who is not a computer is not sure that is directed at him 00:41
japhb__ It *appears* that sometimes IO::Path.copy() leaves the read handle open.
So once in a while you copy a file, go to delete the original, and your network filesystem happily creates a .nfs000foobar file (or equivalent) for you. Because you still wanted that file, right? Otherwise, why are you holding it open? 00:43
paxcoder: nope, not directed at you at all. Just coincidence. :-0
er
:-)
paxcoder: Perl 6 is rather full of ideas, some of them progressive. Other prefixes than 'pro' could also be used, and the sentence would still remain true. :-) 00:45
paxcoder: You might want to read the synopse on Grammars, for a start. 00:46
paxcoder japhb, what's that?
japhb__ Actually, even better, see jnthn++'s courseware on building a simple compiler in NQP. 00:47
paxcoder: perlcabal.org/syn/ is where the official spec documentation is held. I was referring to chapter 5. 00:48
paxcoder sees a purple link right there :-)
(chapter 5)
japhb__ paxcoder: All of www.jnthn.net/articles.shtml is good too.
paxcoder: His talk on Concurrency in Perl 6 (second from the top) is very forward-thinking. 00:49
paxcoder japhb, can you explain the role of perlcabal? is it current? 00:50
japhb__ Where are you seeing that, paxcoder? 00:51
paxcoder japhb, you just posted the link
chapter 5 thingy
japhb__ Ah, here's that compiler design course (meant to teach by example how Rakudo is built): github.com/edumentab/rakudo-and-nq...als-course
paxcoder: Oh! Funny, I never think of that domain being there. I just think of it as the spec section of perl6.org. :-) 00:52
paxcoder so it's normative and up-to-date, eh? 00:53
japhb__ Yes. If you want the raw files, they're at github.com/perl6/specs 00:54
But yes, the perlcabal version is kept synced up. It's the HTML-ified and otherwise reader-friendly-ified version, but it's otherwise the same. 00:55
Mouq paxcoder: Perl6 does have the idea of roles, which are similar to objects, but are meant to encapsulate functionality 00:57
japhb__ goes back to wondering how the heck he's going to find an intermittent failure to close the file in copy. Looking at the source of the parrot file dynpmc, it *looks* like a fairly clear close after each open. :-/ 00:58
Ah yes, Mouq++ is quite right. That was a big deal.
paxcoder Mouq, not sure what you mean. Surely, objects encapsulate functionality alongside data. 01:00
japhb__ paxcoder: Roles are a superset/generalization of what other languages call interfaces, traits, or mixins. 01:01
They carry interface requirements, default implementations, type annotations, attribute declarations, and so forth.
paxcoder interesting. So you suggest I look at Regexes, Rules, Roles, any other Rs? 01:02
japhb__ There are files in the Rakudo source tree that declare powerful classes almost entirely by composing a number of roles.
paxcoder: The MOP is a big deal, because while historically related, Perl 6's MOP can do many things that the Moose MOP in Perl 5 cannot, because of the type system and internal design (6model) that Perl 6/Rakudo has. 01:04
afk, bus stop &
Mouq S14: "Depending on how you care to look at it, a role is like a partial class, or an interface with default implementation, or a set of generic methods and their associated data, or a class closed at compile time."
And just before that: "Classes are primarily in charge of object management, and only secondarily in charge of software reuse. In Perl 6, roles take over the job of managing software reuse." 01:05
paxcoder Mouq, sounds pretty straightforward, why is it revolutionary?
btw. if I learn 6's MOP, can I skip Moo then? 01:07
Mouq, ^,^^
Mouq Heh. I'm pretty new the Perl 6 community myself. I don't think roles are particularly revolutionary, but they're very useful. Remember they're default implementations as well as interfaces, and they, I belive, leverage Perl 6's powerful method dispatch 01:09
Which is another awesome thing.
Mouq I'm not sure, what you mean about Moo, since Moo is a Perl 5 module. If you're planning on using Perl 5, no. If you're planning on using Perl 6, that question doesn't apply. If you're planning on using both (which is the standard thing to do right now AFAICT), you need to know both. 01:12
paxcoder Mouq, i'm planning on using none. I'm just here for ideas.
Yummy delicious perl ideas
Mouq Oh, well, cool
Like I said, I'm pretty far from a definitive nor completely trustworthy resource 01:13
paxcoder ok, thanks for the disclaimers.
(will wait for) japhb ('s answer to): HOP and 6's MOP & ch5 should do it for me? 01:15
LWA paxcoder: about Roles: Classes are nice, interfaces are useful. However, compositing behaviour is difficult with them (inheriting from two types). Multiple inheritance is ugly and has all kind of issues. Mixins are a step forward, Traits are a refinement (a trait is a type that provides and requires certain methods), Roles are an extension of Traits with associated data. Result: Extremely expressive object system 01:16
Mouq
.oO(Perl 6 refactoring of regexes/ideas for grammars is awesome, though. If you take anything away, take that, IMO)
01:17
paxcoder LWA, but when you say MOP, you encompass Roles, right?
or perhaps you're sugesting I don't need to look at MOP and should only be concerned with Roles? 01:18
Mouq paxcoder: Perl is not a language that you can cut up easily
LWA paxcoder: I did not say anything about a meta-object protocol. Roles ⊥ MOP 01:19
paxcoder LWA, i'm not sure you can use reverse tautology like that :-) 01:20
but got it 01:21
Mouq Actually, I redact my statement (though don't negate it). I think one of the things that makes Perl 6 powerful is that it mixes many concepts, and it does so in a consistent and usable (and often pretty) way 01:22
paxcoder Mouq, i actually like consistency
uniformity
ubiquity
you know what i mean
Mouq Mmm.. not really. Uniformity sounds more like lisp 01:24
paxcoder it does, yes
i meant to write "eg. lisp's homoiconicity"
but that's just syntax 01:25
Mouq r: infix:<syntax> (Str $a, Regex $b) { $a ~~ $b }; say "a + b" syntax / [(\w+) <[+-/*]> (\w+)]* / 01:28
camelia rakudo 455467: OUTPUT«===SORRY!=== Error while compiling /tmp/mn2g_iiGl8␤Two terms in a row␤at /tmp/mn2g_iiGl8:1␤------> infix:<syntax> (Str ⏏$a, Regex $b) { $a ~~ $b }; say "a + b" ␤ expecting any of:␤ postfix␤ inf…»
Mouq Hm?
r: sub infix:<syntax> (Str $a, Regex $b) { $a ~~ $b }; say "a + b" syntax / [(\w+) <[+-/*]> (\w+)]* / 01:29
camelia rakudo 455467: OUTPUT«===SORRY!=== Error while compiling /tmp/Q44T_qldjL␤Unsupported use of - as character range; in Perl 6 please use .. for range, for explicit - in character class, escape it or place as last thing␤at /tmp/Q44T_qldjL:1␤------> ~ $b }; …»
Mouq ._. almost
r: sub infix:<syntax> (Str $a, Regex $b) { $a ~~ $b }; say "a + b" syntax / [(\w+) <[+\-/*]> (\w+)]* /
camelia rakudo 455467: OUTPUT«「」␤␤»
Mouq r: sub infix:<syntax> (Str $a, Regex $b) { $a ~~ $b }; say "a + b" syntax / :s (\w+)+ % <[+\-/*]> / 01:30
camelia rakudo 455467: OUTPUT«「a 」␤ 0 => 「a」␤␤»
Mouq r: sub infix:<syntax> (Str $a, Regex $b) { $a ~~ $b }; say "a + b" syntax / (\w)+ % [<.ws>(<[+\-/*]>)<.ws>] / 01:32
camelia rakudo 455467: OUTPUT«「a + b」␤ 0 => 「a」␤ 1 => 「+」␤ 0 => 「b」␤␤»
Mouq \o/
Anyway, 01:34
paxcoder: I think I kind of disagree with 'just syntax'. If syntax were really a trivial thing, we'd all be using some form of lisp 01:35
paxcoder not that just 01:36
Mouq p56: sub postfix:<!> (Int $n) { [*] 1..$n }; say 5! 01:40
camelia p5-to-p6 : OUTPUT«syntax error at perlito5.pl line 874.␤»
Mouq :) just curious
Oh woops, wrong way around
p56: say 'Laaaaaame' 01:41
camelia p5-to-p6 : OUTPUT«say('Laaaaaame')␤»
Mouq p56: print "am I said?\n" 01:45
camelia p5-to-p6 : OUTPUT«print('am I said?' ~ chr(10))␤»
Mouq Nope
dalek p: 2c393d3 | dwarring++ | examples/rubyish/ (6 files):
added bitwise ops, fixed precedence, etc
02:53
moritz \o 04:44
Mouq o/ 05:04
moritz nqp-jvm fails tests in two files for me (19-file-ops.t, 02-pipes.t) 05:16
Mouq r: say ' a b c d ' ~~ m:s/ [\w ] + / 05:19
camelia rakudo 455467: OUTPUT«「 a b c d 」␤␤»
Mouq r: say ' a b c d ' ~~ m:s/ (\w ) + /
camelia rakudo 455467: OUTPUT«「 a b c d 」␤ 0 => 「a 」␤ 0 => 「b 」␤ 0 => 「c 」␤ 0 => 「d 」␤␤»
Mouq r: say ' a b c d ' ~~ m:s/ ( \w ) + /
camelia rakudo 455467: OUTPUT«「 a b c d 」␤ 0 => 「a 」␤ 0 => 「b 」␤ 0 => 「c 」␤ 0 => 「d 」␤␤»
Mouq n: say ' a b c d ' ~~ m:s/ ( \w ) + /
camelia niecza v24-98-g473bd20: OUTPUT«「 a b c d 」␤ 0 => 「a 」␤ 0 => 「b 」␤ 0 => 「c 」␤ 0 => 「d 」␤␤»
Mouq "Only whitespace sequences immediately following a matching construct (atom, quantified atom, or assertion) are eligible. Hence, initial whitespace is ignored at the front of any regex, to make it easy to write rules that can participate in longest-token-matching alternations." 05:21
moritz r: say ~(' a b c d ' ~~ m:s/ ( \w ) + /) 05:22
camelia rakudo 455467: OUTPUT« a b c d ␤»
moritz Mouq: so it shouldn't match the initial space, right? 05:23
TimToady only STD implements the correct semantics so far
Mouq That's what I'm getting from it
moritz nqp: say(~(' a b c d ' ~~ /:s ( \w ) + /) ) 05:23
camelia nqp: OUTPUT« a b c d ␤»
moritz Mouq: please submit an nqp bug for that 05:24
Mouq is trying to get /[ ]/ etc to fail properly, and the refactoring required may fix this too
Okay
TimToady std: /[ ]/ # as in this failure?
camelia std a0bcfb1: OUTPUT«===SORRY!===␤Null pattern not allowed at /tmp/nH4zKrFueN line 1:␤------> /[ ⏏]/ # as in this failure?␤Parse failed␤FAILED 00:01 121m␤»
Mouq r: /[ ]/ # Yup 05:25
camelia ( no output )
Mouq r: my regex :: { } # Also
camelia ( no output )
benabik Doesn't /:s ( \w ) + / become / ( \w <.ws> )+ <.ws> / ? 05:35
+ is a quantifier 05:36
TimToady yes, that seems right
Mouq Yeah. "When we say sigspace can follow either an atom or a quantified atom, we mean that it can come between an atom and its quantifier:"
TimToady oh, so it's not that 05:37
it's / [( \w <.ws ) <.ws>]+ <.ws> /
Mouq Oop 05:38
TimToady er s:1st/'<.ws'/<.ws>/
Mouq Updated 05:39
TimToady this is why you can write 'foo' +% ',' and get whitespace after each foo
it turns into ['foo'<.ws>]+ % [','<.ws>] 05:41
benabik: the ( \w ) is also an atom, so has sigspace after it, before the + 05:42
benabik Why does % grab the .ws?
TimToady % doesn't grab any .ws
benabik To the right of it? [','<.ws>] 05:43
TimToady I'm assuming a sigspace after it, just didn't bother writing the space /
'foo' +% ',' / 05:44
benabik Well, yes. But how far right does % go? To the end of the rule?
TimToady has a sigspace after each 'foo' and after each ','
% only takes one atom to the right
well, one quantified atom
benabik The sigspaces attach themselves to the atoms, so get caught by the %? 05:45
TimToady you can do 'foo' +% 'bar'+ and it would match "foo barbarbar foo"
benabik It's the "takes one atom" and ending up with ','<.ws> that confuses me. Is sigspace a quasi-quantifier? 05:46
TimToady % is just a funny loop, and doesn't care whether the left or right atoms also match sigspace
yes, in that sense the sigspace counts as part of the one atom 05:47
benabik Okay. I had been mentally translating sigspace into <.ws> rules, but it's actually more like ['atom' <.ws>] for every atom. 05:48
TimToady yes
except, of course, if you say ('foo') +% ',' it will only return the foo elements, not including the ws 05:49
but I guess that follows from your rewrite anyway 05:50
since the rewrite would be [('foo') <.ws>]
benabik Right.
TimToady I know if feels weird to write +% together like that, but I think people will get used to it as an idiom 05:51
benabik That makes a lot of intuitive sense, but was hard to reason out.
+% feels like some kind of numeric operator. 05:52
TimToady it's one of those strangely consistent thingies, or at least something that is almost strangely consistent :)
only doing sigspace after atoms is another of those symmetry breaks that was not obvious except in retrospect 05:54
just as we initially thought ~~ should be symmetrical, but that led to problems
benabik But not before it was implemented in p5 05:55
TimToady it also happens to make things more efficient, since you never have to match a ws unless there is a new one there to match
benabik: alas, yes 05:56
but the real problem with smartmatch in p5 is not even that, but the lack of a type system
p5 is often confused about whether a particular scalar is a string or a number 05:57
benabik Well because it's a any(str|num)
If I've been following the perlguts blog posts correctly.
TimToady I also count the lack of junctions as part of the type deficit 05:58
so too many p5 smartmatches have implicit junctional semantics; in p6 these must always be explicit
Mouq might have gotten it. Wasn't as significant as I had originally thought once TimToady++ pointed out the atom -> atom+sigspace thing 06:55
TimToady the hard part is making sure "atom" doesn't include things like :foo 07:00
Mouq TimToady: Can you show me an example? 07:01
TimToady for instance, in / :s 42 / there is no sigspace after :s
only after the 42
Mouq Oh, okay. Thank you 07:02
TimToady that's why STD.pm6 is playing with <.SIGOK> in various spots 07:04
to mark which metachars are really matchers, and which are not
Mouq Is :s [ <mumble> ] supposed to be just [ <mumble> <.ws> ] or [ <.ws> <mumble> <.ws> ]? 07:09
TimToady the first, which is why STD says :my $*SIGOK = False; in quant_atom_list 07:10
%RX<s> is set, but until <mumble> sets $*SIGOK it will treat whitespace as normal space 07:11
Mouq TimToady: Okay, thank you. 07:13
TimToady and as soon as <sigmaybe> finds a whitespace with $*SIGOK set, it immediately resets it, so any atom can only enable a single sigspace 07:15
the STD algorithm isn't heavily tested, so there may be a bug or two, but by and large its heart is in the right place :)
TimToady I guess it's tested sufficiently well that viv can bootstrap on it to correctly bootstrap itself, when STD.pm6 is written assuming the correct sigspace rules :) 07:17
TimToady so that, for instance, all the statement_control matchers can be written as rules 07:19
they used to have to be tokens that switch to :s in the middle under the old rules
with the new semantics rules can participate fully in LTM matchers 07:20
gah, have to get up early to move 200 comic book boxes from my brother-in-law's condo to storage... 07:21
TimToady --> bed
moritz sleep well, and dream of successfull LTM
Mouq :) Thank you TimToady, and g'night 07:22
muixirt jenkins.freenetproject.org/ --> Service Temporarily Unavailable 07:39
oops wrong channel :-) 07:40
moritz nqp: say(nqp::index('abc', 'a', 3) 08:28
camelia nqp: OUTPUT«Confused at line 2, near "say(nqp::i"␤current instr.: 'panic' pc 14748 (src/stage2/gen/NQPHLL.pir:5229) (src/stage2/gen/NQPHLL.nqp:279)␤»
moritz nqp: say(nqp::index('abc', 'a', 3))
camelia nqp: OUTPUT«-1␤»
dalek p: b8a7bbb | moritz++ | src/vm/parrot/QAST/Compiler.nqp:
[regex] avoid an unnecessary comparison

when the index is op is used, it always returns -1 for start indexes beyond the string length
moritz blug: perlgeek.de/blog-en/perl-6/2013-a-r...ation.html 08:44
JimmyZ It'll be nice to port to src/vm/moar/ too 08:45
masak good antenoon, #perl6 :) 09:07
frettled my my 09:13
felher moritz++ #interesting post, nice. :) 09:22
FROGGS moritz++ # cool! 09:23
I think this improves user's regexes a lot, since this is a pretty common usecase 09:24
jnthn morning, #perl6 09:57
yoleaux 08:03Z <FROGGS> jnthn: about the stagestats bug: it works when I close the handles after writing to it, but I am unable to close the ones that were written to in gc_free of MVMOSHANDLE or in tc_destroy
08:04Z <FROGGS> jnthn: though I can walk the handles easily in tc_destroy fwiw
jnthn moritz++ # great blog post! 10:02
moritz thanks 10:03
moritz tries his hands on moarvm codegen
it looks nice enough
jnthn Yeah 10:04
It's just the JVM one that may feel a bit foreign
'cus yo're generating code for a stack machine there instead.
moritz I noticed :-) 10:06
jnthn moritz: The slightly more interesting thing we could do with the optimization is set the position directly to what index returns, in the success case :)
moritz jnthn: I do, don't I? 10:06
jnthn i dunno, I didn't drink enough coffee yet to read code proper :P
moritz pos = index tgt, literal, pos
$ops.push_pirop('index', %*REG<pos>, %*REG<tgt>, self.rxescape($node[0]), %*REG<pos>); 10:07
jnthn You are completely right. Sorry.
moritz ... and it segfaults while building NQPP5QRegex.moarvm 10:08
no problem
jnthn Oh...one other idea too...if the first thing in the regex is a ^ anchor (bos) then I think that means we can entirely skip emitting the scan?
moritz aye 10:09
BinGOs ./win 58 10:41
jnthn Congratulations! You have won 58! 10:43
GlitchMr sub MAIN(Int $argument) { say "Congratulations! You have won $argument!" } 10:53
moritz with moritz.faui2k3.org/tmp/moarvm-index-scan.patch I get "At Frame 23, Instruction 36, op 'index_s', operand 2, expected MAST::Local, but didn't get one" 11:00
how do I fix that?
moritz do I first need to assign the sval to an register? 11:00
jnthn Yes 11:05
Which you can get with fresh_s or so 11:06
moritz and what#s the op for setting it? 11:08
*what's
jnthn set 11:08
moritz takk 11:09
jnthn oh, sorry
const_s
set is register => register
And it's got a generic signature... set w(`1) r(`1) or so
moritz \o/ tests pass 11:56
jnthn \o/ 11:57
colomon \o/ 12:00
dalek p: 8dacbf6 | moritz++ | src/vm/moar/QAST/QASTRegexCompilerMAST.nqp:
[MoarVM] use index to speed up scanning in regexes
isBEKaml moritz++! 12:02
wait, nqp now has a moarvm backend? THAT's awesome!
\o/
moritz :-)
moritz it is 12:02
jnthn Yes, was in this month's NQP release :) 12:03
isBEKaml jnthn: great news! 12:04
jnthn Yes, it's nice to be making progress :)
isBEKaml how do I build it? as in, how do I turn it on? any specific configuration?
jnthn At the moment, you build a MoarVM, configuring with some --prefix for installation, and make install it. Then run ConfigureMoar.pl with that same --prefix in the NQP repo. 12:05
moritz++ is working on a more unified configure process at the moment :)
moritz well, build process first ._)
jnthn :) 12:06
isBEKaml jnthn: I see, that's how I build parrot, nqp and rakudo on my linux vm. No biggie. :-) 12:07
grondilu in github.com/edumentab/rakudo-and-nq...s-day1.md, section Roles (2), isn't there an infinite recursion? method set_compile_time_value($value) { self.HOW.mixin(self, QAST::CompileTimeValue); self.set_compile_time_value($value);
}
isBEKaml grondilu: your text ran right off my screen. :) 12:08
jnthn grondilu: Nope
jnthn grondilu: QAST::CompileTimeValue mixes in a method set_compile_time_value 12:08
grondilu: Which we then call
grondilu ok 12:09
lizmat github: 12:07 UTCMajor service outage. 12:16
arnsholt Hello on a plane o/
lizmat arnsholt o/ 12:17
jnthn o/ lizmat 12:18
lizmat jnthn /o 12:19
isBEKaml lizmat: yeah, was just looking at it :(
lizmat sort of back, but not in rhythm yet
isBEKaml github.com/perl6 gave me a 500 error
lizmat that is 12:19
jnthn lizmat: I'm only back for a day...
lizmat had a much more stressful vacation to deal with :-) 12:20
nothing as easy as teaching :-)
isBEKaml lizmat: vacations are.... stressful? 12:21
jnthn lizmat: Turns out the most stressful bit of it was nearly missing a flight. ;) Teaching went fine. )) 12:28
jnthn 'tis tiring, though... 12:28
lizmat isBEKaml: yes, very stressful :-) 12:31
lizmat github seems up again 12:41
jnthn yeah, I just pash 12:41
lizmat
.oO( past tense of push ?)
12:42
jnthn Aye :) 12:43
isBEKaml lizmat: well, AFAIHS, you're the first person to say so. :-) I thought vacations were all about relaxing. 13:01
lizmat is not the person to lay on the beach, that may have something to do with it :-) 13:02
dalek p/ext: a27e079 | jnthn++ | src/vm/moar/stage0/ (9 files):
Get a stage0 with extop support.

Bump really needed due to bytecode format change.
13:28
p/ext: 17304ea | jnthn++ | src/vm/moar/QAST/QASTOperationsMAST.nqp:
First pass at QAST->MAST extop updates.
pippo r: say "one, two, three" ~~ /\w+ +% ','/ 14:57
camelia rakudo 455467: OUTPUT«===SORRY!=== Error while compiling /tmp/1diO3UXr7b␤Quantifier quantifies nothing␤at /tmp/1diO3UXr7b:1␤------> say "one, two, three" ~~ /\w+ +% ','⏏/␤ expecting any of:␤ postfix␤ infix stopper…»
pippo r: say "one, two, three" ~~ /(\w+) +% ','/ 14:58
camelia rakudo 455467: OUTPUT«「one」␤ 0 => 「one」␤␤»
dalek p/ext: 1debcdc | jnthn++ | src/vm/moar/QAST/QASTOperationsMAST.nqp:
Correct emit MAST::ExtOp where needed.
15:05
masak today's autopun spotting: twitter.com/geofft/status/391248386298753025 15:09
jnthn :P 15:10
dalek p/ext: 8b420c8 | jnthn++ | src/vm/moar/QAST/QASTCompilerMAST.nqp:
Pass MAST::ExtOp type to assembler.
15:14
pippo rn: say "foo, barbarbar, foo" ~~ /:s (\w+)+ % ',' 15:18
camelia rakudo 455467: OUTPUT«===SORRY!=== Error while compiling /tmp/pci67Hvoxl␤Regex not terminated␤at /tmp/pci67Hvoxl:1␤------> foo, barbarbar, foo" ~~ /:s (\w+)+ % ','⏏<EOL>␤ expecting any of:␤ postfix␤ infix stopper␤…»
..niecza v24-98-g473bd20: OUTPUT«===SORRY!===␤␤Regex not terminated at /tmp/wDMe9AHQxd line 1 (EOF):␤------> foo, barbarbar, foo" ~~ /:s (\w+)+ % ','⏏<EOL>␤␤Parse failed␤␤»
pippo rn: say "foo, barbarbar, foo" ~~ /:s (\w+)+ % ','/
camelia niecza v24-98-g473bd20: OUTPUT«「foo, barbarbar, foo」␤ 0 => 「foo」␤ 0 => 「barbarbar」␤ 0 => 「foo」␤␤»
..rakudo 455467: OUTPUT«「foo」␤ 0 => 「foo」␤␤»
dalek kudo/moar-support: 33ece31 | jnthn++ | src/vm/moar/Perl6/Ops.nqp:
Start filling out MoarVM's Perl6::Ops.

When build with ext branches of MoarVM and NQP, we now reach trying to compile the MOP in the build.
15:21
dalek kudo/moar-support: efc9a5b | jnthn++ | src/vm/moar/Perl6/Ops.nqp:
First pass at nqp::p6bool compilation.

Untested, but should be fairly close.
15:51
arnsholt "Dealing internally with different time zones is like having some numbers represented internally as decimal and some as hex." -MJD, laying down the law =) 15:54
colomon in the old days we used decimal and hex together and liked it. 16:03
;) 16:04
colomon really BCD and binary, but whatever. 16:09
arnsholt Oh, right. I have actually heard about BCD, at least 16:13
But I was amused to see a link on HN where someone wondered what A: and B: on Windows were for, though =D 16:14
nwc10 and it all ends in tears^Wcode thinkg that 2010 is a leap tear.
geekosaur COBOL DISPLAY >.>
nwc10 (ish- this link is slow and laggy)
jnthn Does a leap tear happen once every 4 times you cry? 16:15
timotimo arnsholt: B: was for old-timey-floppies, right? 16:24
geekosaur hey now, I have a machine with a floppy drive at my feet :p 16:25
timotimo you rest your feet on it?
geekosaur (granted, it's ancient hardware repurposed as a vpn appliance..)
timotimo huh? vpn needs some crypto performance to work properly ... a device that features a floppy-floppy-disk-drive would be able to handle like 512 bytes per second ... or something? 16:26
geekosaur it's nto quite *that* bad 16:27
timotimo does it have three-digits megahertz speed?
arnsholt timotimo: Well, A: for the first floppy drive and B: for the second one =)
geekosaur haven't checked
as I said, "appliance" --- not supposed to be able to log in to it
nwc10 B: for the second, real or emulated. 16:31
jnthn never owned a machine with a B: :) 16:34
geekosaur ok, managed to get at the model number without disconnecting anything from it or dropping the vpn; 2.6ghz
colomon did professional work on machines that had an A: and a B: but no C:
geekosaur perhaps more telling is the front says "hp compaq" :p
dalek p/ext: 59a4b99 | jnthn++ | src/vm/moar/QAST/QASTOperationsMAST.nqp:
Map nqp::settypecheckmode.
16:35
pmurias should the op docs from t/nativecall/01-basic.t be moved to docs/ops.markdown? 16:36
jnthn pmurias: That would seem reasonable. 16:36
dalek p/ext: b418626 | jnthn++ | src/vm/moar/QAST/QASTOperationsMAST.nqp:
Map nqp::setdispatcher for MoarVM.

nqp::takedispatcher needs more work; it's not a straight mapping.
16:57
lue hello world o/ 17:02
jnthn hellue! o/ 17:05
dalek kudo/moar-support: a27e243 | jnthn++ | src/vm/moar/Perl6/Ops.nqp:
Add some more p6 op mappings.

Not implemented yet, just get us further into compiling BOOTSTRAP.
17:07
arnsholt jnthn: What's the JVM things to look up methods and such, corresponding to VTABLE_find_method on Parrot? 17:12
jnthn Ops.findmethod or so 17:13
arnsholt That looks promising, yeah. Cheers! 17:15
colomon arnsholt++ 17:20
dalek p/ext: aff0f08 | jnthn++ | src/vm/moar/QAST/QASTOperationsMAST.nqp:
Map captureexistsnamed/capturehasnameds on MoarVM.
17:33
FROGGS ohh nice! 17:46
jnthn++ # :D
jnthn FROGGS: Oh hi...want a task? :D 17:46
FROGGS jnthn: sure! 17:48
jnthn FROGGS: We need to be able to build a so/dll for the Perl 6 ext ops 17:50
FROGGS hmmm, okay
jnthn FROGGS: That probably means we should install a thingy to do it...
FROGGS: Or make the info available to do it
FROGGS: Like, the cc and link invocation lines
FROGGS so, we need something like moar-config --libs and --cflags? 17:51
jnthn Well, don't think we need a separate app
I mean, if we can make nqp --show-config spit out the right stuff...
FROGGS right, just talking about what usually is there
jnthn Then we can simply use that. 17:52
Anyway, yeah, it's that kinda info
FROGGS hmmm, interesting task
jnthn I'm gonna be a bit occupied the next several days, but it's what Rakudo on Moar is blocking on 17:53
So it's a nice one to delegate :)
FROGGS k 17:54
btw, nqp/ext is intended to be buildable?
jnthn Yeah...needs moar/ext too though
FROGGS ahh 17:55
3rdparty/dyncall/dynload/libdynload_s.a(dynload.o): In function `dlLoadLibrary':
/home/froggs/dev/MoarVM/3rdparty/dyncall/dynload/dynload_unix.c:43: undefined reference to `dlopen'
looks like my submodules are busted
arnsholt Actually, nwc10 reported that just now 17:56
Probably a missing -ldl in a Makefile
(Reported it over in #moarvm, that is) 17:57
jnthn Yeah, looking at that...
Wonder why it build for not_gerd...
moritz heisen-ldl 18:00
lue read moritz++ 's blog post and refrains from making a useless comment to boot. 18:12
japhb__ moritz: in your scan blog post, the paragraph beginning "Inside the loop", there's a confusing typo: '%*REG<cur>' should be '%*REG<pos>'. (Also, remove the fourth word of the paragraph, but I only noticed that because I reread the paragraph a couple times trying to figure out what I wasn't understanding.) 18:15
moritz japhb__: thanks, fixed 18:17
std: my $a .= ++; say $a 18:18
camelia std a0bcfb1: OUTPUT«ok 00:01 123m␤»
moritz n: my $a .= ++; say $a
camelia niecza v24-98-g473bd20: OUTPUT«0␤»
grondilu I'm surprised that my $a .= ++ is ok. doesn't .= expect a term in the RHS? 18:23
hum no, I get it. ignore this^ 18:24
moritz ftr .= accepts a postfixish, of which a method name is the most common case (and which rakudo implements) 18:26
lue what was the method form for prefixes again? 18:30
.:<++> right?
moritz r: class A { has ($.x, $.y) }; say A.new(x => 1, y => 2).perl 18:32
camelia rakudo 455467: OUTPUT«A.new(x => 1, y => 2)␤»
arnsholt Arg, barg. I hate it when golfing a bug makes it go away 18:33
Hah. Intuition strikes gold :3 18:36
arnsholt jnthn: Golfed version of the role mixin problem I talked about a while back: gist.github.com/arnsholt/7059777 18:42
For some reason the role having an attribute breaks things. The derived JVM type inheriting from the wrong type or something like that? 18:43
pmurias japhb__: what does declaration_static do? 18:45
japhb__: sorry meant jnthn 18:46
japhb__ pmurias: I had a feeling ... :-)
pmurias jnthn: what does declaration_static do?
arnsholt jnthn: Oh, and changing the order of the traits on the sub also fixes it 18:47
japhb__ tries yet another angle on fixing this panda NFS problem 18:53
.oO( "Once more unto the breach ..." )
18:54
arnsholt Oh, NFS. Joy =)
japhb__ Yeah, that's one way of putting it. >.< 18:55
arnsholt I've thankfully not had any problems with our University's home-directories, but I've a friend who is full of NFS-related rants =) 18:58
diakopter . 19:10
yoleaux 18 Oct 2013 18:30Z <PerlJam> diakopter: Stop twiddling the bot and get back to work! :)
dalek Heuristic branch merge: pushed 25 commits to evalbot by moritz 19:11
moritz I've just merged host07 into master, and switched camelia to use that branch 19:12
no functional changes
diakopter rm: say('hi from rakudo on moar') 19:14
moritz rm -rf! 19:15
jnthn arnsholt: I wonder if it's the JVM backing type caching going wrong. 19:21
pmurias: It means that we capture the outer of the static code object. 19:22
pmurias: As opposed to assuming a clone.
pmurias: Used for methods, for example 19:23
arnsholt Ah, right
I was really mystified when the test script for a similar bug in the Parrot backend worked as it was supposed to =) 19:24
jnthn Take a look into inline_description and box_description 19:25
I never quite grokked them but I would not be surprised if they need implementing properly somewhere...
diakopter heh, extops with label operands 19:31
arnsholt jnthn: I guess that makes it P6Opaque.installJVMType? {box,inline}_description themselves don't seem to do much
diakopter *giggle*
jnthn arnsholt: Well, I guess they get called? 19:35
arnsholt Yeah, in installJVMType 19:37
diakopter jnthn: line 82 of roots.c 19:40
arnsholt Just your comment that you didn't grok them made me expect the methods to be something significant
diakopter is that a pointer pointer?
yes, nm. 19:41
diakopter jnthn: where's the thing to register new reprs 19:45
jeccer_ is this a good channel for a perl beginner to ask a question? 19:46
diakopter yes, but the answer to the question may be: "yes, but the answer to the question may be: "yes, but the answer to the question may be: "yes, but the answer to the question may be: "yes, but the answer to the question may be: "yes, but the answer to the question may be............ 19:48
jeccer_ Interesting
arnsholt Also, we talk about Perl 6
Which is probably not what you want
#perl is likely more relevant 19:49
jeccer_ Ok thanks, I'll look for the Perl channel then
ty
jnthn diakopter: in reprs.c prolly 19:58
diakopter no I mean I thought gerd added something to do it at runtime or something 20:00
jnthn Oh...I thouught there was a dyn repr thing too 20:06
yeha, there it is.
MVM_repr_register_dynamic_repr
arnsholt jnthn: I've no idea what's going on with my bug. I'll try to give it another whack tomorrow. But the methods associated with a class and its backing type are mostly separate, no? 20:09
jnthn arnsholt: Correct
arnsholt: The backing type is all about the attributes
arnsholt Yeah, that's what I thought 20:10
Which piece of the puzzle keeps track of the methods?
jnthn The method cache hanging off the STable initially
er, typically I mean
It may then fall back to calling find_method on the meta-object but that's unusual
e.g. you gotta have a special situation for it.
Like handle * or so 20:11
*handles
arnsholt Yeah
So in this case it'll be hanging off the STable
jnthn method cahce does, yeah
changetype switches the st
That's the only place where an object ever changes its type. 20:12
arnsholt Excellent. Then I have a couple more places to pick at this problem tomorrow 20:13
arnsholt Hah! Found it 20:19
Forcing P6Opaque.change_type to always create a delegate fixes the problem
Figuring out how to fix it can wait 'till tomorrow
TimToady rosettacode.org/wiki/Zhang-Suen_thi...thm#Perl_6 20:20
jnthn arnsholt++ 20:21
TimToady gah, shoulda used gather/take; push is a smell 20:23
colomon smells like victory! 20:24
jnthn There's some meta-op use :) 20:25
TimToady fixed 20:27
r: my \neighbors = <a b c d e f g h>; say neighbors.rotate
camelia rakudo 455467: OUTPUT«No such method 'rotate' for invocant of type 'Parcel'␤ in block at /tmp/V7qktYmTaa:1␤␤»
TimToady r: my \neighbors = <a b c d e f g h>; say neighbors[].rotate 20:28
camelia rakudo 455467: OUTPUT«b c d e f g h a␤»
TimToady a bug, methinks
n: my \neighbors = <a b c d e f g h>; say neighbors.rotate
camelia niecza v24-98-g473bd20: OUTPUT«b c d e f g h a␤»
TimToady niecza can rotate a parcel
n: my \neighbors = <a b c d e f g h>; say neighbors.rotate.WHAT
camelia niecza v24-98-g473bd20: OUTPUT«(Parcel)␤»
TimToady it even stays a parcel :)
rakudo has to listify the Parcel before it can rotate it, which is suboptimal 20:29
Mouq r: sub rotate(Positional \p) {(p.WHAT)( p[].rotate )}; my \neighbors = <a b c d e f g h>; say rotate(neighbors).WHAT 20:39
camelia rakudo 455467: OUTPUT«(Parcel)␤»
Mouq r: sub rotate(Positional \p) {(p.WHAT)( p[].rotate )}; my \neighbors = [<a b c d e f g h>]; say rotate(neighbors).WHAT
camelia rakudo 455467: OUTPUT«(Array)␤»
japhb__ Oooh, I forgot about 'repeat while' together at the top of the loop 20:44
japhb__ Is the logic in IO::Handle.close() at line 116 of src/core/IO.pm correct? Instead of checking $!PIO with nqp::istrue, shouldn't it be checked with nqp::isconcrete? 21:00
(For context, I'm tracking down a problem in which a filehandle is closed in Perl 6 code, but lsof shows the file is still open, sometimes. My current reading is that sometimes line 116 decides not to nqp::closefh when it should, and then we fall back to when garbage collection gets around to closing the underlying PIO after it is turned into garbage by line 117.) 21:02
Mouq japhb__: That's what it looks like to me too, considering that it's set to a type object right after that line. Other places do use nqp::isdefined in IO::Handle, although method opened(){} doesn't 21:05
*nqp::isdefined($!PIO)
jnthn japhb__: Hmm... 21:06
japhb__: I know that on Parrot, true/false on a file handle PMC is open/closed
japhb__: I wonder if that's also true of JVM.
japhb__: Maybe that's the problem... 21:07
(I'm assuming you're on the JVM here.)
But if it sets it to the type object on closing then the test should still work
since a type object is always false, an an instance is by default true...
lue TimToady: I am shocked you didn't take advantage of a prime opportunity to use unicode. :) 21:11
japhb__ Hmmm. jnthn, will trying to close an already-closed filehandle PMC blow up on parrot?
Actually, will it on any backend?
Then I'll just go with nqp::isdefined (nqp::isconcrete is only for SMOs, isn't it?), and risk sometimes telling the backend to close a file handle that had already been closed behind Rakudo's back. 21:13
(And thanks Mouq++ for pointing out nqp::isdefined)
jnthn japhb__: I dunno without trying it 21:14
japhb__ OK, I'm going to try that patch, rebuild and see if tests go kablooey. 21:15
dalek nda: d8b4f4f | (Geoffrey Broadwell)++ | lib/Panda/ (2 files):
Make sure we .close after every open
22:20
kudo/nom: e55c66b | (Geoffrey Broadwell)++ | src/core/IO.pm:
Fix intermittent delayed closure of the VM-level file handle in IO::Handle.close()
22:24
p: 1f1544a | dwarring++ | examples/rubyish/ (5 files):
add rubyish <=> cmp ops. refined .call syntax
22:35
rl6-most-wanted: 1c5ba0b | (Andrew Egeler)++ | most-wanted/modules.md:
Update modules.md
22:50
japhb__ \o/ With the above fixes, panda bootstraps and installs additional modules on NFS with both the parrot and jvm backends! 22:57
jnthn \o/ 23:00
japhb__++
japhb__ While I was debugging that on rakudo-parrot I noticed something suboptimal: rakudo leaks open filehandles to subprocesses (e.g. when I shelled out to an 'lsof | grep' variant, lsof showed that sh, grep, and sh all held open the same file that perl6 did). 23:06
er: ... sh, grep, and lsof all ... 23:07
Of course, sometimes you want to do that, but I don't think that should be the default.
jnthn japhb__: What are the Perl 5 semantics / way of deciding, ooc? 23:09
retupmoca r: say "asdf".encode("ascii") ~~ Buf 23:17
camelia rakudo e55c66: OUTPUT«False␤»
retupmoca isn't Str.encode supposed to return a Buf?
or am I misunderstanding things?
timotimo r: say "yoink".decode("utf8").WHAT 23:18
camelia rakudo e55c66: OUTPUT«No such method 'decode' for invocant of type 'Str'␤ in block at /tmp/iFLXpoP8O_:1␤␤»
timotimo r: say "yoink".encode("utf8").WHAT
camelia rakudo e55c66: OUTPUT«(utf8)␤»
timotimo r: say "yoink".encode("utf8") ~~ Buf
camelia rakudo e55c66: OUTPUT«False␤»
BenGoldberg r: utf8.^methods.say 23:19
camelia rakudo e55c66: OUTPUT«decode encoding new elems bytes chars Numeric Int list subbuf unpack contents of Str at_pos Bool Stringy gist perl␤»
retupmoca r: my Buf $x = "asdf".encode("utf-8"); say 1;
camelia rakudo e55c66: OUTPUT«Type check failed in assignment to '$x'; expected 'Buf' but got 'utf8'␤ in block at /tmp/To3NBksbsL:1␤␤» 23:20
timotimo r: say utf8.^mro
camelia rakudo e55c66: OUTPUT«(utf8) (Any) (Mu)␤»
BenGoldberg Peculiar, it's not related to either Str or Buf 23:21
r: say Buf.mro
camelia rakudo e55c66: OUTPUT«No such method 'mro' for invocant of type 'Buf'␤ in block at /tmp/mWeiEyQLex:1␤␤»
BenGoldberg r: say Buf.^mro
camelia rakudo e55c66: OUTPUT«(Buf) (Any) (Mu)␤»
BenGoldberg r: say Str.^mro
camelia rakudo e55c66: OUTPUT«(Str) (Cool) (Any) (Mu)␤»
Mouq Buf.pm: "my class utf8 does Blob[uint8] is repr('VMArray') {..." 23:22
r: buf8.^mro 23:23
camelia ( no output )
Mouq r: buf8.^mro.say
camelia rakudo e55c66: OUTPUT«(Buf[uint8]) (Any) (Mu)␤»
japhb__ jnthn: OK, checking. perl -e 'open my $fh, "<", "test"; system "lsof | grep test"' does not leak the FH. On parrot, perl6 -e 'my $fh = open "test"; shell "lsof | grep test"' leaks, but on jvm it does not. 23:24
BenGoldberg r: say utf8 ~~ buf8 23:25
camelia rakudo e55c66: OUTPUT«False␤»
BenGoldberg r: say utf8 ~~ Blob[uint8] 23:26
camelia rakudo e55c66: OUTPUT«True␤»
BenGoldberg r: say Buf ~~ Blob[uint8]
retupmoca n: say "asdf".encode("ascii") ~~ Buf
camelia rakudo e55c66: OUTPUT«False␤»
niecza v24-98-g473bd20: OUTPUT«True␤»
BenGoldberg r: say "asdf".encode('ascii').WHAT 23:27
camelia rakudo e55c66: OUTPUT«(Blob[uint8])␤»
BenGoldberg n: say "asdf".encode('ascii').WHAT
camelia niecza v24-98-g473bd20: OUTPUT«(Buf)␤»
timotimo ah, blob, yeah. blob is immutable, so that's what corresponds to strings 23:28
jamie21 Hey room
:) 23:29
BenGoldberg Why do we use the name blob, anyway? :) ISTR that it stands for Binary Large OBject... but most of our blobs seem to be fairly small ;) 23:30
timotimo at least they are binary
geekosaur SQL has that meaning for them, but well before SQL there was the usage for random binary data that most stuff didn't care about the internal structure of 23:31
jnthn japhb__: Ah, so Parrot is the odd one out there... 23:33
re Blob vs. Buf, Blob is immutable 23:34
And if we let you mutate a utf8 then you might make it invalid utf8 :)
BenGoldberg geekosaur: Doesn't "opaque" fit that meaning better?
TimToady
.oO(Binary Little Object)
23:35
BenGoldberg laughs
Binary L-ambiguously-sized OBject 23:36
geekosaur formally yes, blob is informal 23:38
Mouq BLOB's, Like, an Object that's Binary
geekosaur and those of us used to the original meaning found SQL's adoption of a formal BLOB type to be quite amusing
BenGoldberg rn: say "".encode('ascii') 23:40
camelia rakudo e55c66: OUTPUT«Buf:0x<>␤»
..niecza v24-98-g473bd20: OUTPUT«Buf.new(...)␤»
BenGoldberg rn: say "".encode('ascii').WHAT
camelia niecza v24-98-g473bd20: OUTPUT«(Buf)␤»
..rakudo e55c66: OUTPUT«(Blob[uint8])␤»
BenGoldberg While I don't have an opinion of whether Buf or Blob is more appropriate, I do think that we need to use the same type for all implementations. 23:41
Err, Str.encode needs to return the same type, for all implementations 23:42
Or at least, a compatible type
timotimo yes. either spec work is necessary, or one or both of our implementations is diverging 23:43
retupmoca afk & 23:44
Mouq S32 says it should return a Blob 23:45
r: "abcd".encode('UTF-8').WHAT.say
camelia rakudo e55c66: OUTPUT«(utf8)␤» 23:46
BenGoldberg Which is ok, since
r: utf8 ~~ Blob[unit8]
camelia rakudo e55c66: OUTPUT«===SORRY!=== Error while compiling /tmp/jyJg0ef0KZ␤Undeclared routine:␤ unit8 used at line 1. Did you mean '&uniq'?␤␤»
BenGoldberg r: utf8 ~~ Blob[uint8]
camelia ( no output )
BenGoldberg r: say utf8 ~~ Blob[uint8]
camelia rakudo e55c66: OUTPUT«True␤»
BenGoldberg So rakudo does return a blob, even when it's returning a utf8 23:47
Mouq BenGoldberg: The spec says explicitly that's (utf8) what it should be
BenGoldberg And it
And it's niecza that's wrong :)
jnthn Yeah, spec says return narrowest 23:52
Note that Blob is a role, which is why it doesn't show up in .^mro
Again, by spec.