»ö« | perl6.org/ | evalbot usage: 'perl6: say 3;' or rakudo:, alpha:, pugs:, std:, or /msg p6eval perl6: ... | irclog: irc.pugscode.org/ | UTF-8 is our friend!
Set by moritz_ on 25 June 2010.
jnthn I guess so 00:00
pmichaud I'm having trouble distinguishing what makes an "only method" different from a multi method if it still allows inheritance. 00:01
(I agree the other interpretation doesn't make sense... so, I'm just confused)
isBEKaml sorear: I got git1.6.4. Besides, I just git pulled the remote repo and didn't have the branch in my local clone of the repo.
pmichaud anyway, I agree this makes things messier in the long run. 00:02
jnthn pmichaud: Well yes, there'll be a bunch of new corner cases to think out.
pmichaud: Rather than the ones I've already got used to thinking about. ;-) 00:03
pmichaud in the short run, we'll have to come up with a way to get closures working, and I'm not quite sure where to go from here.
jnthn Right, that's the important thing.
So our current blocking issue is essentially multi / closure interaction?
pmichaud also, as a side note, I really have only about 3.5 days of good hacking time available before I'm gone for a little over a week.
and autoviv is blocking on closures. 00:04
jnthn Or are we still struggling on methods generally?
pmichaud methods, primarily.
subs seem to work about as expected.
jnthn Do we have method problems beyond this traits issue?
pmichaud I don't know. I'm able to get down about 4 failing test files
but then the fixes for those cause a bunch of tests to fail. 00:05
jnthn One being the method introspection one, and the other 3 being?
(I'm wondering if they boil down to traits issues too)
pmichaud t/spec/S06-signature/errors.rakudo (Wstat: 0 Tests: 9 Failed: 3)
t/spec/S12-introspection/methods.t (Wstat: 256 Tests: 5 Failed: 0) 00:06
t/spec/S12-methods/default-trait.t (Wstat: 0 Tests: 6 Failed: 1)
t/spec/S06-operator-overloading/sub.rakudo (Wstat: 0 Tests: 63 .local pmc curried
t/spec/S03-smartmatch/disorganized.rakudo (Wstat: 0 Tests: 42 Failed: 2)
those are the fails.
I'm willing to regress the smartmatch one.
jnthn default-trait.t
That one is certainly same cause. 00:07
(as methods.t)
pmichaud well, even when I get the method of() problem fixed (which causes lots of other fails), methods.t still doesn't pass completely.
jnthn S06-signature/errors.rakudo - check these out more - are they real fails?
pmichaud building, checking. 00:08
00:08 isBEKaml left
jnthn pmichaud: Can you paste me the output of methods.t too - I'd like to know what else fails. 00:08
oh, I have a built here
00:08 cono left
pmichaud I didn't apply the patch that gets past the 'of' failure because it causes so many other things to fail. 00:08
jnthn Right 00:09
Can you recall why we didn't have a loadinit per our class, btw? 00:10
oh, that probably won't help us anyway though
pmichaud not only that, but it really shouldn't matter (more) 00:11
the things that go into the classes really need to be the static code, because they're compile-time thingies.
jnthn Yes, true
pmichaud it's only later that they should start acting like closures. 00:12
same for roles, for similar reasons.
jnthn Yes 00:13
pmichaud I think I need to sit down and make sure I understand what really happens with roles
jnthn pmichaud: fwiw 00:14
pmichaud: S12-introspection/methods.t passes everything but .of and .returns tests 00:15
With what is commited now
pmichaud right
jnthn You say a lot failed with the switch to static, but was it mostly looking traceable to broken roles? 00:16
pmichaud mostly, I suspect.
but it was all over the place.
jnthn Yes, though so are roles :-)
pmichaud if you'd like to try:
change 00:17
my $code := block_closure(blockref($past), $*METHODTYPE, $multi_flag);
to
my $code := block_code($past, $*METHODTYPE, $multi_flag);
in Actions.pm:1250
the errors.t failures are just in the error messages 00:18
I suspect it's just a breakage in perl6multisub that isn't producing the traces correct
jnthn Right, I suspected as much
pmichaud could be dump_signature isn't doing the right thing. 00:23
jnthn pmichaud: eek, it's getting late here
pmichaud sure
and I likely need a break as well -- I've been struggling with this for too many days now :) 00:24
jnthn pmichaud: I think we'd be better served with me sleeping and digging more tomorrow.
pmichaud I think you're right that block_closure needs to be block_code above, and that we need to find the source of the other failures.
it just feels more correct-er that what we pass to the builders is a static code object
jnthn pmichaud: However, here's some golf 00:25
(this is with your change to Actions.pm applied)
> role Foo[::T] { method foo { T } };
Foo()
> class A does Foo[Int] { }
!class_init_23
> class B does Foo[Str] { }
!class_init_32
> say A.foo
Str()
> say B.foo
Str()
say A.foo shoulda been Int()
pmichaud that looks like a closure bug :-)
something isn't be closed that should be.
(which is what I'd expect since we're sending static code objects instead of closure objects) 00:26
I think the creation of a closure needs simply be moved to somewhere else.
so, before you go, double-check my understanding of roles
role XYZ[::A] { } does two things
1. It creates "XYZ" as a master, if it doesn't already exist
2. It creates a multisub entry for the list of possible roles in XYZ 00:27
later, if something does
XYZ[Int]
the XYZ master looks to see if it already has something for XYZ[Int], if so -- it returns it.
If not, it then invokes its multisub of possible roles, and the winner there returns the actual role 00:28
00:28 lest_away is now known as lestrrat
pmichaud okay so far? 00:28
jnthn I prefer to say "possible role factories" in that the multi produces and returns a role
But yes, you're right so far.
pmichaud okay 00:29
last question, then
when I say class A does <role> { ... }
how/when/where do the methodsfrom <role> get composed?
jnthn This is slightly involved; let me walk you through it
The code generated from this looks like 00:30
trait_mod:<does>($the-class-we're-building, <role>)
That calls a handler in src/core/traits.pm 00:31
That boils down to:
$target.^add_composable($r);
Where $target is the class we're building
add_composable does *not* compose the role at that point
(note that it is a method on ClassHOW)
It just adds it to its list of roles to compose 00:32
pmichaud ...and those are in $!composees. got it so far.
jnthn It also knows when to call !select to generalize a role into is arity-0 variant (this kinda hides every role being parametric from those who don't want to think about parametric roles)
OK
The very last thing that happesn when we're building a class or a role is a call like 00:33
$type-obj = $the-class-we're-building.^compose()
It's compose that triggers the actual composition process.
At this point one of two things happens if we have any composees.
If we have just one composee we can compose it right into the class 00:34
If we have multiple, we build a temporary role and compose all of the others into it first
And then apply that one role to the class
(This factoring is lifted from Moose, fwiw.)
PerlJam \\\\\\\
jnthn That's what all of the RoleToClassApplier and RoleToRoleApplier classes do.
In fact, all that the compose method does is delegate to those 00:35
Note that we do *no* cloning of methods in any of these, and afaict nor shouod we.
btw 00:36
gist.github.com/463892
Your 1-line change + a 1-line changes from me and we pass the entire S12-introspection/methods.t 00:37
further
sorear I'm starting to really hate augment
jnthn > role Foo[::T] { method foo { T } };
Foo()
> class A does Foo[Int] { }
!class_init_23
> class B does Foo[Str] { }
!class_init_32
> A.new.foo
Int()
> B.new.foo
Str()
pmichaud jnthn: I tried that earlier and it didn't work for me. Perhaps I did something else I shouldn't have. 00:38
But note that there's no Code.clone currently defined.
I did define one, perhaps I shouldn't have.
jnthn pmichaud: Heh, perhaps Object.clone does enough...
pmichaud relying on Object.clone feels fragile to me.
jnthn Me too
pmichaud especially because the resulting $!do object won't have any of its properties. 00:39
(no $!llsig)
jnthn not troo iirc
I think actually Mu.clone preserves them.
pmichaud oh.
jnthn Provided it's an object that you transform_to_p6opaque'd.
pmichaud I don't see anything in Mu.clone that preserves properties. 00:40
jnthn See P6opaque
pmichaud oh 00:41
it's in the vtable
jnthn I overrode the Parrot low-level clone
Right
(yes, I know, I'm evil)
S12-methods\default-trait.t ==> pass with this patch too
pmichaud /* If it's a sub, we need a separate hash, so copy each property over. */ 00:42
still true?
my redesigned version assumes that all clones of a sub share the same prophash
jnthn I think you've made it un-true then. ;-)
pmichaud in fact, it's highly desirable they do, so that when _any_ sub figures out its $!llsig or other properties they all know it. :-) 00:43
jnthn oh grr, for some reason it's not running parallel spectets
pmichaud yes, now you have to explicitly set TEST_JOBS=3
jnthn Thought I had
Not to worry
pmichaud defaulting to parallel was causing people grief on systems with low memory footprints
jnthn My beer isn't out yet 00:44
sorear jnthn: my class Foo {}; for ^4 -> $x { my class Bar { method y { $x } }; augment class Foo is Bar { }; }; say Foo.y; # Please rate this on the insane-o-meter
jnthn sorear: Rakudo is going to say NO if you add a new parent in an augment.
It's very low on my priority list to fix.
sorear jnthn: I'm not hacking rakudo. I'm trying to get lexical classes right the first time in Niecza.
jnthn sorear: If you declare it just too evil and I do too, we've two implementations pushing for the spec to say "no way" 00:45
lue pmichaud: so me, right? :P
jnthn sorear: (right first time) Wow, you have the same optimism about Perl 6 implementation I used to. ;-) ;-)
sorear jnthn: Isn't infix:<does> basically adding a new parent in an augment?
jnthn No
sorear I've been hacking Perl 6 for about two months 00:46
jnthn It's deriving a new subclass, adding the role into it, and re-blessing the object into it.
sorear I thought that's what infix:<but> did
jnthn No
infix:<but> clones and then does infix:<does> on the clone
sorear: fwiw, Rakduo's versions of both are in Perl 6
src/core/operators.pm 00:47
sorear jnthn: how about: my class Foo {}; for ^4 -> $x { augment class Foo { method y { $x } }; }; say Foo.y; 00:49
pmichaud I'd expect a composition conflict. 00:50
i.e., multiple "method y"
jnthn I think Rakudo implements my best guess at that :-) 00:51
pmichaud it probably needs a supersede if you really intend to replace the method.
jnthn and I think it says composition conflict
Or similar
pmichaud i.e. augment class Foo { supercede method y { $x } } 00:52
(but that's just a guess on my part)
jnthn pmichaud: Into S04 - only that smart-match test regressed from mater so far.
sorear according to TimToady, augment statements are run at BEGIN time *only*
and composition for a given 'augment' happens ONCE
jnthn sorear: Yeah, I backlogged over that and thought...huh. :-)
sorear "this is the *whole point* of the traits paper"
pmichaud sorear: in which case that augment happens only once. :-)
and it should be just fine. 00:53
sorear well, sure
I understand how to implement this... loosely
pmichaud jnthn: the fails tended to begin in S05
sorear the main issue is that a class needs one OUTER:: per point of definition
pmichaud jnthn: I'm also quicktesting here.
sorear allowing augments to close over stuff means that classes need multiple outers 00:54
which gets very confusing, especially if the outers have conflicting definitions for a single lexical
I'm imagining diamondy patterns where a class winds up indirectly inheriting from two different instantiations of the same lexical superclass and *head explode* 00:55
pmichaud sorear: in this particular case, I'm suspecting it's similar to
jnthn sorear: No, the methods just have the outer of where the augment was
pmichaud for 1..4 -> $x { our sub foo() { say $x } }; BEGIN { foo() }
sorear pmichaud: yes, that's my imagination too. 00:56
jnthn pmichaud: S05 ain't looking problemantic for me
pmichaud: Into S06 now
pmichaud in that the $x that &foo sees at the time it's invoked is uninitialized and comes from the static lexpad
jnthn: yes, S05 is okay for me also. 00:57
sorear pmichaud: where did you get the BEGIN from?
pmichaud jnthn: so, perhaps it was my version of the clone method that was an issue.
sorear I was imagining it would be for 1..4 -> $x { our sub foo() { say $x } } ; foo() --> 4
pmichaud sorear: yes, it would
but as you said (that TimToady said), augment is like a BEGIN
00:58 meppl left
pmichaud so, the $x that we see is the one that exists before the pointy block ever executes 00:58
jnthn pmichaud: We still have the errors.t one
pmichaud I still have the operator-overloading sub one 00:59
errors.t I'm sure I can fix
so far this is looking raelly good
*really
jnthn Yes, operator-overlording.t one I have too 01:00
it's a curious
pmichaud ohhhhh
I bet I know why my earlier clone failed.
jnthn pmichaud: eval fail
pmichaud eval passed here.
jnthn (for the sub overloading one)
pmichaud S29-context/eval.t ?
jnthn no no
pmichaud oh, there. 01:01
jnthn no
t\spec\S06-operator-overloading\sub.rakudo
pmichaud got it.
jnthn The test that fails looks like this
is eval('sub infix:<+>($a, $b) { 42 }; 5 + 5'), 42, 'infix:<+>($a, $b)';
Note that taking that out of the eval works
it's only when you put it in an eval that it has a fail
Somethings off but I bet it's silly rather than deep.
It fails with the error 01:02
Can not re-declare sub &infix:<+> without declaring it multi at line 1
(that's int he failure the eval returns)
01:04 amkrankruleuen joined
amkrankruleuen Hello! 01:04
pmichaud (overloading error) I'm willing to regress that one if it's not an easy fix. 01:05
jnthn: but yes, with your patch I think we're good-to-go for now.
jnthn \o/
pmichaud thank you so much for sticking with it this late :)
jnthn I *really* want this branch to land. :-) 01:06
pmichaud I'll apply and then work on code cleanups.
jnthn And $dayjob is pretty light at the moment.
pmichaud then merge the branch.
we've already merged from trunk, so shouldn't be many problems there.
jnthn No, shoudln't be any troubles there.
pmichaud: !!! :-D 01:08
> role R { method foo() { say 42 } }; R.foo
42
oh but
role R { method foo() { say 42 } }; class C does R { }; C.new.foo
Doesn't work 01:09
Damm
It's laodinit all over again.
Anyway, not a regression
Just not yet fixed
pmichaud oh!
jnthn Yeah 01:10
pmichaud operator-overload probably puts &infix:<+> into the block's symbol table.
jnthn Oh
pmichaud and so the code things it's already been defined. 01:11
*thinks
jnthn Ah! 01:12
01:12 zorgnax left
jnthn Anyway, those aside, I think tests are looking decent. 01:12
pmichaud what part handles operator overloading? 01:13
jnthn It's at the bottom of Grammar.pm, the name escapes me
(we gotta do at least some of it in grammar.pm otherwise custom operators break --target=parse)
pmichaud gen_op_if_needed 01:14
jnthn gen_op_if_needed
ah, beat me
But I don't see it doing anything the @BLOCK.symbol
pmichaud me neither 01:15
the only way that we get the Can not re-declar message is if the symbol already exists, though.
jnthn Yes, I don't understand how it's happening
Oh
Unless @BLOCK somehow contains stuff from the setting 01:16
pmichaud at that point, @BLOC...... oh. right.
it might.
because we collect up all of the lexicals.
from the outer contect
jnthn pmichaud: this is very telling
> eval('{ sub infix:<+>($a, $b) { 42 }; 5 + 5 }')
42
pmichaud although I would've expected that to not be the current block.
right.
jnthn not extra curlies
*note
pmichaud yes, it's because the outer_context has them already. 01:17
jnthn OK, some needs fixing but not too nasty
pmichaud that needs a bit of fixing anyway, to better handle the repl 01:18
but yes, not hard to fix.
jnthn I won't be bothered if we regress on that one fwiw.
As long as we file an RT about it.
Because I doubt it'll hit the app cheese.
pmichaud I'll see if I can find a better test than just "does the symbol exist"
jnthn Well, I'm a bit surprised we don't end up with an extra PAST::Block layered in somewhere containing the symbols 01:19
And the oen that's the main scope of the eval is one inside of that.
pmichaud right.
sorear jnthn: Also, I'm playing with drawing a line between protoclasses and classes
pmichaud I've been thinking that there should be an extra block
sorear I think I can do all non-'does' composition at compile time 01:20
pmichaud also, at some point I want to switch @BLOCK from a package-scoped variable to a contextual.
so that each compilation unit has its own @*BLOCK
anyway, I think we're good on the closures branch. Just a few things to clean up. 01:22
I need to take doggie out for a walk, so I'll bbiaw (and likely see you tomorrow)
01:22 masonkramer joined
jnthn pmichaud: OK, I"m going to sleep now. I'm almsot asleep already 01:23
sorear: Try me on that when I'm concious. ;-)
night all o/
diakopter oo/ 01:26
01:42 TiMBuS joined
sorear aaaa it only gets harder 02:09
sorear needs to invalidate subclasses when superclasses are modified
ideally without making "but" leak memory
02:27 agentzh joined 02:42 chee is now known as rlwrap 02:43 rlwrap is now known as chee, xinming left 02:56 rv2733 joined 02:58 aubreyja joined 03:02 xinming joined
pugssvn r31548 | putter++ | elf, elfparse, and elf on sbcl, are all happy again. 03:02
r31548 | [elf_h] Fix isa/can/does.
r31548 | [elfparse] Revert r27867 halfbaked changes to std.pm.
r31548 | [on_lisp] Note SBCL 1.0.40 works, but "current" 1.0.29.11.debian doesn't.
03:08 rv2733 left 03:16 duzy joined
duzy xinming? 03:18
xinming duzy: ? 03:25
03:25 aubreyja left 03:32 tylercurtis joined 03:54 buubot left
duzy xinming: chinese? 03:55
xinming duzy: yes 04:00
04:28 chee left 04:29 chee joined 04:39 cotto joined 04:49 buubot joined 04:55 sorear sets mode: +vo buubot tylercurtis
diakopter o_O elf updated? 04:59
05:02 ashleydev joined, ashleydev left 05:14 christine left 05:16 christine joined
ingy how do I do 'next OUTER' ? 05:27
ingy has been RingTFMs 05:28
sorear what does next OUTER mean? 05:29
ingy next/last to a LABEL
sorear well you can't just say OUTER 05:30
you need an explicit name
ingy sigh 05:31
yes, OUTER is my label
sorear oh
well in that case, next OUTER 05:32
it's the same as p5
ingy seems to not compile.
I'll try again
sorear std: OUTER: { next OUTER; }
p6eval std 31548: OUTPUT«ok 00:01 111m␤»
05:33 sftp_ joined 05:34 sftp left
ingy std: OUTER: for $x -> $y { next OUTER; } 05:37
p6eval std 31548: OUTPUT«===SORRY!===␤Variable $x is not predeclared at /tmp/Ds6yu7yCzA line 1:␤------> OUTER: for $x⏏ -> $y { next OUTER; }␤Check failed␤FAILED 00:01 114m␤»
ingy std: my $x = []; OUTER: for $x -> $y { next OUTER; } 05:38
p6eval std 31548: OUTPUT«ok 00:01 113m␤»
sorear S04 defines OUTER.next; and next OUTER:; as acceptable variations 05:40
maybe rakudo parses one or the other
though I'm somewhat doubtful due to the way rakudo currently handles loop control operators
05:41 sftp_ left, sftp_ joined 05:44 Su-Shee joined
dalek kudo: f0cf54e | pmichaud++ | src/Perl6/Actions.pm:
Refactor handling of block references in methods.
05:47
kudo: 0ba07fa | pmichaud++ | (4 files):
Refactor 'make stresstest' to draw from t/spectest.data, and eliminate

we pass the man-or-boy test again, \o/
05:47 dalek left
ingy sorear: what's the problem with this code (which rakudo fails to parse) nopaste.snit.ch/21803 05:47
?
tylercurtis Does Rakudo support next? I don't see it in Gramma.pm
05:47 dalek joined
tylercurtis s/Gramma/Grammar 05:48
05:48 szabgab joined
spinclad (re thidk: shouldd't the -n- in -nk- dedasalise to -gk-?) # slowly slowly backlogging approaches RealTime 05:49
ingy pmichaud: do you know? (nopaste.snit.ch/21803 failure) 05:51
PerlJam ingy: rakudo doesn't do labels yet. 05:53
tylercurtis: yes, rakudo understands next. 05:54
05:54 uniejo joined
sorear ingy: rakudo doesn't support controlling any loop other than the innermost one 05:59
doesn't matter about parsing; Rakudo just doesn't have the internal protocols to control a distant loop
pugssvn r31549 | pmichaud++ | [t/spec]: Fudge some tests that fail in the closure branch. 06:01
chee macros. any implementations got them going on aoy? 06:09
PerlJam chee: don't think so. 06:11
chee D:
sorear aoy? 06:12
PerlJam as of yet
(that's what I guessed)
06:22 mberends joined 06:25 cono joined
mberends phenny, tell cxreg your MiniDBD::Pg passes 24 of the 32 common tests, you're welcome to merge when you like. 06:35
phenny mberends: I'll pass that on when cxreg is around.
moritz_ good morning 06:41
06:44 tedv left
moritz_ std: my $x; 5; my $x 06:44
p6eval std 31549: OUTPUT«Potential difficulties:␤ Useless redeclaration of variable $x (see line 1) at /tmp/rPwNPPjQnz line 1:␤------> my $x; 5; my $x⏏<EOL>␤ok 00:01 111m␤»
pugssvn r31550 | moritz++ | [t/spec] unfudges after the "llsig" branch merge 06:49
r31551 | moritz++ | [t/spec] test for RT #71476, invocant type constraint should be checked at method call time 06:55
06:57 lkk- joined
pugssvn r31552 | moritz++ | [t/spec] test for RT #69654 - mixing in method with "does" should make those methods show up in introspection 06:59
07:03 timbunce joined 07:05 timbunce left 07:13 mberends left 07:16 mberends joined
moritz_ rakudo: 'a' ~~ /a/; say ($/.orig).rindex('a', 1) 07:28
p6eval rakudo 67ebdc: ( no output )
moritz_ rakudo: 'foobar' ~~ /a/; say ($/.orig).rindex('a', 1)
p6eval rakudo 67ebdc: ( no output )
07:31 Trashlord left 07:32 Schwern left, Trashlord joined
mberends moritz_: the ",1" kills it 07:34
07:37 Schwern joined 07:59 tadzik joined 08:00 mberends left
mathw Hah 08:01
Problems at work with floating point numbers
I found myself thinking 'what we need is Perl 6's Rat type'
arnsholt That's usually the solution, yeah =)
mathw unfortunately, rewriting our server software in Perl 6 isn't particularly feasible at the moment 08:03
arnsholt Awwww =) 08:04
mathw We need a working multithreaded solution really 08:06
and some speed :)
one day, I hope, such things will be eminently possible
I'm sure they will
arnsholt Indeed. I look forward to that day like a child to christmas =) 08:10
08:17 timbunce joined 08:20 plobsing left 08:22 mberends joined 08:27 Ross joined, dakkar joined 08:30 masak joined
masak oh hai, #perl6! 08:33
so, closures fixed, eh? 08:34
pmichaud++
sorear chee: check out git://github.com/sorear/rakudo.git
branch 'topic/macros'
chee I have a sorear right now 08:35
sorear it's a proof of concept hack I did about three months ago and have no intention of porting to current rakudo
(I think Rakudo is going to get protolexpads in about a month, which will make macroage *way* easier)
chee sorear: cool :3
chee cloning
dalek kudo: 5a5d7ef | pmichaud++ | (2 files):
Rename src/cheats/setup-io.pm to src/cheats/process.pm .
08:40
kudo: 3312298 | pmichaud++ | (5 files):
Refactor $*IN, $*OUT, $*ERR. Add $*PERL. Add --version option.
kudo: 22578e8 | pmichaud++ | t/spectest.data:
Merge branch 'master' of github.com:rakudo/rakudo
08:41 timbunce left
sorear $*PERL? 08:41
tylercurtis "$*PERL S02 SoftwarePackage # perl version running under" 08:42
masak S02: 'Which Perl I'm running under"
guess that means "which version".
sorear Er. Right. 08:43
Stupid juxtaposition made me think it was a filehandle.
08:46 thebird joined 08:49 charsbar_ joined, charsbar left
pmichaud rakudo: say $*PERL; # probably 'not yet' 08:51
p6eval rakudo b3eafb: OUTPUT«Null PMC access in invoke()␤current instr.: 'perl6;Perl6Role;!select' pc 11403 (src/gen/RoleToClassApplier.pir:591)␤... call repeated 1 times␤»
pmichaud p6eval still broke?
tylercurtis rakudo: say 5
p6eval rakudo b3eafb: OUTPUT«Null PMC access in invoke()␤current instr.: 'perl6;Perl6Role;!select' pc 11403 (src/gen/RoleToClassApplier.pir:591)␤... call repeated 1 times␤»
masak aye :/
08:52 orafu left
tylercurtis It was working about an hour and a half ago. 08:52
08:52 orafu joined
pmichaud pmichaud@plum:~/rakudo$ ./perl6 --version 08:53
This is Rakudo Perl 6, version 2010.06-172-g22578e8
Copyright 2008-2010, The Perl Foundation
masak \o/ 08:54
pmichaud++
pmichaud > say $*PERL<name>
rakudo
> say $*PERL<version>
2010.06-172-g22578e8
masak is $*PERl a Hash? 08:55
pmichaud it acts like one.
masak s/l/L/
pmichaud (yes)
because one is supposed to be able to do things like
given $*PERL {
when :name<rakudo> :version<...> { ... } 08:56
I suppose it could be done with methods also, but using a hash seemed more straightforward for now.
masak aye.
what does the '172' mean?
pmichaud 172 commits since the 2010.06 tag 08:57
(it's the output of "git describe")
masak ah, nice.
pmichaud not sure this will work on windows systems yet, but I figure we'll get patches soon enough. :-) 08:58
masak I should use that subcommand more to communicate which commit I'm on.
pmichaud well, I think that's enough work for one day. Actually for two days. Actually for four. :-( 09:00
mathw pmichaud we love you!!
pmichaud mathw: :-)
well, I'm glad closures are finally working. 09:01
mathw But I've only got -1 minutes to get to a meeting
09:01 lkk- left
mathw & 09:01
dalek kudo: d9a5ac0 | pmichaud++ | src/cheats/process.pm:
Change $*PERL<name> to lowercase. Add $*VM.
09:03
pmichaud time for sleep 09:04
bbiaw
09:04 TiMBuS left 09:15 tylercurtis left 09:16 TiMBuS joined 09:17 masak left
sorear Should distinct instantiations of a lexical class share a HOW? 09:18
09:21 envi^home joined 09:22 Ross left 09:23 pmurias joined, Ross joined
pmurias ruoso: do you think it would make sense to switch from manipulating $LexicalPrelude to YOU_ARE_HERE? 09:25
09:27 Su-Shee left
spinclad now i've caught up on the backlog, i have to say: \\\oOo/// what a marathon, what victory! pmichaud += MANY ! 09:28
09:30 Trashlord left 09:32 Trashlord joined 09:35 pmurias left, jedai_ left
sorear yeah, pmichaud 09:40
my great rival :D
09:46 chee is now known as gcheechee 09:49 gcheechee is now known as chee
sorear tomorrow I need to extract from jnthn a simpler workable metamodel for classes 09:55
my current system is totally awesome but has lots of complications, like needing weak references 09:56
09:56 agentzh left 09:59 whiteknight joined
dalek ecza: 27fe603 | sorear++ | (2 files):
Add license & credits info
10:01
ecza: 99cd9d8 | sorear++ | notes.pod:
Brief note on protoclasses
ecza: bab5e87 | sorear++ | setting:
A few more notes on our ClassHOW
10:02 tadzik left 10:03 masonkramer left, masonkramer_ joined, masonkramer_ is now known as masonkramer 10:08 masak joined 10:09 lestrrat is now known as lest_away
masak > our $a = 42; { say my $a; { say our $a } } 10:13
ANy()
42
'our' seems to have a bit in common with binding.
hejki rakudo: our $a = 42; { my $a = 4; say my $a; say our $a; } 10:17
p6eval rakudo b3eafb: OUTPUT«Null PMC access in invoke()␤current instr.: 'perl6;Perl6Role;!select' pc 11403 (src/gen/RoleToClassApplier.pir:591)␤... call repeated 1 times␤»
10:17 _mpu joined
hejki ;< 10:17
masak p6eval busted :/
lunch &
10:28 thebird left, cotto left, Patterner left
szabgab jnthn, are your BPW slides online somewhere? 10:32
10:34 thebird joined, cotto joined, Patterner joined 10:39 Mowah left 10:48 ruoso left
arnsholt Looking at the NQP code, I see there's a rule statement_mod_loop:sym<for> but no corresponding action. Bug? 10:49
Nm. Looks like not 10:51
bbkr rakudo: my Hash $x; $x[1]; 10:53
p6eval rakudo d9a5ac: OUTPUT«No applicable candidates found to dispatch to for '_block39745'. Available candidates are:␤:()␤␤ in main program body at line 1␤»
10:54 Mowah joined
arnsholt bbkr: I think p6eval is broken 10:54
bbkr arnsholt: seems to work, because this is unfixed bug from RT queue :) 10:55
rakudo: say 0.00000000000000000000
p6eval rakudo d9a5ac: OUTPUT«0␤» 10:56
arnsholt Oh, goodie
bbkr rakudo: say 0.00000000000000000000000000000000 # checking rt.perl.org/rt3/Ticket/Display.html?id=73236
p6eval rakudo d9a5ac: OUTPUT«0␤» 10:57
bbkr rakudo: say 0.00000000000000000000000000000000000000000000000000000000000000000000000000 # checking rt.perl.org/rt3/Ticket/Display.html?id=73236
p6eval rakudo d9a5ac: OUTPUT«0␤»
bbkr fixed :)
10:59 whiteknight left 11:08 Mowah left
masak bbkr++ 11:13
11:17 timbunce joined
jnthn morning 6folk :-) 11:19
er, afternoon 11:20
:-)
szabgab: (slides) ENOTYET
masak jnthn: "morning"! :)
szabgab jnthn, good <morning afternoon>.pick 11:21
is your quick sort example available somewhere ?
masak jnthn: my charger had a packing fail and is still on the floow beside your computer. fortunately, I still have the spare one from Riga, so there's no panic. :)
jnthn szabgab: I shoved it on the Perl 6 wikipedia page at the weekend 11:23
Because the previous quicksort example they had for Perl 6 was crappy and boring
:-)
(masak++'s suggestion)
masak: FAIL!
szabgab jnthn, I'll lookat it
masak jnthn: yeah, don't know how that happened, really. I blame the vindaloo again. 11:24
szabgab I am gong to have a Perl talk at the next Python meeting in Tel Aviv and need some hard core ammunition :)
jnthn pmichaud: Yay, closures landed!
masak pmichaud++ # again 11:25
jnthn pmichaud++
masak: I....struggle to connect the two. :P
masak: Next time you come maybe I should tell you that you're only allowed a korma? :P
masak jnthn: vindaloo -> malaise -> reduced eyesight -> miss charger on floor 11:26
jnthn: yeah, korma next time. and no cold. :)
11:27 jedai joined 11:29 Mowah joined
moritz_ back 11:30
masak moritz_! \o/ 11:31
jnthn o/ Mowah
er
o/ moritz_ 11:32
I need a DWIMmier tab key.
masak wonders if there'd be a language where "Mowah" could be the diminutive of "moritz_"
jnthn masak: Yes, I'm hoping you didn't leave your scary northener cold here.
masak jnthn: I'm hoping that, too.
jnthn masak: I've very much caught up on sleep now though :-) 11:33
So hopefully that'll help. :-)
masak that's good. Wikipedia says there's three times the risk of infection if you sleep too little.
I... I'm not sure what I did last night counts as "sleep" :) 11:34
hm, that came out wrong. :P
I mean, it was more like "sitting up, folding legs in unnatural ways, keeping eyes closed".
if it'd been part of a sleep deprivation torture program, I'd consider it at least moderately successful. :P 11:36
jnthn Oh, I thought you were implying "söt flicka på buss" :P
masak yeah, I realized it could sound that way.
jnthn Oh well, at least I needn't be envious. :-)
masak my seat companion was a girl, actually. but there's no mile-high club for buses. 11:37
arnsholt A bus a mile high would be scary...
jnthn has been over a mile high on a bus
Well, above sea level anyway
masak jnthn: there's still no club, far as I know :P 11:38
jnthn I guess I'll just stick with the "sleepers beneath you club" on the railways then. 11:39
masak :P
pugssvn r31553 | moritz++ | [t/spec] unfudge tests for Rakudo 11:41
jnthn pmichaud: --version works right on Windows :-) 11:43
This is Rakudo Perl 6, version 2010.06-173-gd9a5ac0
\o/
moritz_ masak, mberends: I'd like an opinion on rt.perl.org/rt3/Ticket/Display.html?id=76376 11:45
the Date part looks good, execept that I'd prefer to have DateLike in a separate file
masak I haven't looked at the code yet. I briefly read through the summary. 11:46
moritz_ but I only glanced over the code, not done a proper review yet
masak "- Temporal and Date now use a role called DateLike which contains common methods." 11:47
I am unsure what this means, since there's no longer a type "Temporal".
it's just the file that's called that, through sheer inertia.
probably he meant "DateTime and Date". 11:48
something feels wrong with calling Date "Datelike". :)
11:48 sftp joined
masak maybe we should go with STD.pm6's nomenclature and call it Dateish... 11:49
11:49 sftp_ left
moritz_ or maybe it should be a lexical role that's not visible to the user code 11:49
11:50 chee left
masak that'd be nice -- but doesn't that presuppose Date and DateTime in the same file? 11:50
ISTR that mberends tried the extract-strftime trick and it didn't work. so it would be interesting to hear his views on this.
re new spectests -- why wait until the patch has been applied? we can fudge them in the meantime, or fail the tests for a short while. 11:51
moritz_ did he attach the new spectest file? 11:52
we can always put the file in the pugs repo, but don't run it yet. 11:53
masak he didn't attach the new spectest file.
moritz_ that would be a nice first step :-) 11:54
masak (but there's a one-line addition to spectest.data)
moritz_ yes, I know
masak reviews patch
11:55 orafu left, orafu joined
masak so, DateTime::strftime has to be applied as a mixin on every object you'd want to use it on? why isn't it simply flattened in as a role? 11:55
11:56 ruoso joined
moritz_ that seems... strange 11:56
11:57 jaldhar left
masak I'm not 100% sure I agree to making the .is-leap, and .days-in-month methods private. I could see external parties using those as class methods without harm and for good reasons. 11:57
moritz_ right 11:58
masak the role DateLike has attributes, but they're not declared at the top of the role. I consider that slightly confusing. 12:00
12:01 rhr joined
masak also, I consider it confusing that $.year, $.month and $.day are declared in DateLike, and $.hour, $.minute, $.second are declared in DateTime. but that might just be me. it does save a tiny bit of repetition. 12:02
12:02 szbalint left
masak I don't quite see the use of the :$noassert flag. seems to be a premature optimization of some kind. 12:06
end-of-review. 12:08
to be fair, maybe "loadable module" implies "mixin". I dunno.
12:10 szbalint joined 12:15 pnu joined, duzy left 12:22 takadonet joined
takadonet morning all 12:22
masak takadonet: \o 12:23
12:26 envi_home2 joined, envi^home left
bbkr rakudo: .say for ('X', '/' ~ * ~ '\'... 8) 12:27
p6eval rakudo d9a5ac: OUTPUT«===SORRY!===␤Unable to parse postcircumfix:sym<( )>, couldn't find final ')' at line 11␤»
bbkr rakudo: .say for ('X', '/' ~ * ~ q{\}... 8)
p6eval rakudo d9a5ac: OUTPUT«===SORRY!===␤Unable to parse postcircumfix:sym<( )>, couldn't find final ')' at line 11␤»
12:28 timbunce left
masak $ ./yapsi --version 12:29
This is Yapsi, revision 2010.07-2-gf2020b2
\o/
cognominal rakudo: multi sub f(@p, Range $r? ) { say 1 }; multi sub f([], Range $r) { say 2 }; f([], 1..2); multi sub f(@p, Range $r?, Bool :$mod ) { say 1 }; multi sub f([], Range $r) { say 2 }; f([], 1..2); 12:32
p6eval rakudo d9a5ac: OUTPUT«Ambiguous dispatch to multi 'f'. Ambiguous candidates had signatures:␤:(Positional (), Range $r)␤:(@p, Range $r?, Bool :mod($mod))␤:(Positional (), Range $r)␤␤ in main program body at line 11:/tmp/Hn_ii95sXs␤»
cognominal things are getting worse here, I have 3 signatures for 2 functions. 12:33
oops
I am wrong
jnthn Indeed
Rakudo is right here.
You really do have two subs with the exact same signautre. 12:34
cognominal rakudo: multi sub f(@p, Range $r? ) { say 1 }; multi sub f([], Range $r) { say 2 }; f([], 1..2);
p6eval rakudo d9a5ac: OUTPUT«2␤»
cognominal rakudo: multi sub f(@p, Range $r?, Bool :$mod ) { say 1 }; multi sub f([], Range $r) { say 2 }; f([], 1..2);
p6eval rakudo d9a5ac: OUTPUT«Ambiguous dispatch to multi 'f'. Ambiguous candidates had signatures:␤:(@p, Range $r?, Bool :mod($mod))␤:(Positional (), Range $r)␤␤ in main program body at line 11:/tmp/hHLa4w_dyb␤»
dalek psi: 513948d | masak++ | yapsi:
[yapsi] implemented --version
12:34 zamolxes left, zamolxes joined
cognominal I botched the first paste to rakudo. I still don't understand the behavior on my last paste. 12:35
jnthn cognominal: I do
cognominal: Though not quite sure if it's desirable... 12:36
But I get it's to do with the named param
As I've said before, if you're going to want named params to influence dispatch, you need to mark them as required to not end up in that candidate.
12:37 jaldhar joined
masak jnthn: but how does the addition of a named param cause two non-conflicting candidates to suddenly conflict, as above? :/ 12:38
I'm definitely not sure that's desirable.
jnthn masak: I'm not sure if that's the whole story there 12:39
masak that's what I see.
jnthn Oh, wait...that's all that was added
Oh
masak adds that to the ticket 12:40
jnthn I bet it's because it says "oh, there's a named parameter there, so I'd best make sure the signautre is bindable"
And then both have constraints
Both are satisfied
And thus conflict
The spec probably wants "first wins" though
But I don't like that.
Anyway, I'm not especially surprised by the conflict.
mathw Why wouldn't it amke sure the signature was bindable without the named parameter? 12:41
jnthn mathw: It doesn't have to go and do a full bindability check there
mathw: It can go purely on arity and types
mathw: It's only when you have where clauses, sub-signatures or named parameters that it then treats bindability as needed for a tie-break. 12:42
mathw okay yes that makes sense 12:43
I was struggling with the idea that adding an optional named param was changing the resolution order in a sense
but then I realised that of course it can
because you've changed the signature
although I'd still kind of expect the [] to cause the two-param version to bind more tightly there 12:44
12:44 rgrau_ joined
jnthn Nope 12:44
mathw but that's an intuitive, non-rigorous thought
jnthn There's no such thing as a "better constraint"
bbkr rakudo: .xyz # why it says <invocant of class ''> ? error message seems to be LTA..
p6eval rakudo d9a5ac: OUTPUT«Method 'xyz' not found for invocant of class ''␤ in main program body at line 11:/tmp/AvLJADWM5C␤»
cognominal it does not make any sense to me that adding that is in neither signatures creates an ambiguity. 12:45
I mean, "parameter that was originally in neither signature". 12:46
mathw jnthn: okay but there were no extra constraints
just a named parameter
jnthn Argh!
That *is* a constraint!!!!
mathw That's what I was afraid you were going to say 12:47
jnthn I already said it before, but nobody seems to want to believe me. :-)
mathw well
I don't understand how it can be a constraint when it's just a parameter 12:48
cognominal I believe you, I just don't feel that behavior is right
whatever the specs say.
12:48 sftp left
masak the presence of a named parameter must be a constraint, yes. 12:48
jnthn mathw: Because named parameters don't participate in multiple dispatch
So as soon as you have a named parameter - what masak said.
mathw Ooooooooooooh 12:49
(see that? that's the sun coming up)
jnthn The only issue we have with the spec vs Rakudo here is that Rakudo currently tells you about ambiguity when there are constraints
Whereas the spec last I checked says "oh just pick the first one"
Where first is this wonderfully fragile thing when you start importing candidates from elsewhere. 12:50
mathw yes
bound to make some heads explode
jnthn Not to mention that it means re-ordering your candidates or factoring some of them out to other places and importing them could then change your dispatch.
Which imo is just horrible. :-)
So I'm hoping the spec will revert to "complain" there 12:51
mathw in cognominal's example above, there is an argument that one of the alternatives matched two constraints instead of just one, and thus would be preferable...
but the spec places no value on that kind of thing?
jnthn No
mathw also, ambiguity bad 12:52
complaining preferable
jnthn If you really want to say "in event of conflict this one wins", the spec alredy provides an explicit mechanism for that (the is default trait).
Rakudo also implements that trait. :-)
mathw ambiguity without an 'is default' feels like an error 12:53
'is default' makes me a bit uncomfortable too
I doubt I'll be using it
jnthn Yes, I consider it last resort-ish.
And hope it won't be used much.
What really worries me is that we end up trying to add more rules and complications to the multi-dispatch algorithm. 12:54
mathw maybe we could patch Padre's Perl 6 highlighter to make it come up very big and very red :)
cognominal the default does not buy me anything here. I thought I had a way with a program with 6 multimethods to walk a tree and possibly modify it.
multi sub subtree(@a, @path, Range $r?, Bool :$mod?) { subtree( @a[@path.unshift], $r, $mod) } 12:55
multi sub subtree(@a, [], Range $r) { @a.splice( $r.begin, $r.end-$r.begin) }
multi sub subtree(@a, [$i]) { @a[i] }
multi sub subtree(Str $s, [], Range $r?) { $s.substr($.begin, $r.end - $r.begin ) }
multi sub subtree(@a, [$i], Range $r, Bool :$mod) {
my ($s, $e) = ($r.start, $r.end);
@a[$i] = $s == 0 ?? Nil !! $_[0..^$s], [ $_[$s..$e] ], ( $e == +$_ ?? Nil !! [ $e+1 ..^ +$_ ]);
} 12:56
multi sub subtree(@a, [$i], Range $r, Bool :$mod) {
my ($s, $e) = ($r.start, $r.end);
$_ = @a[$i];
@a[$i] = ( $s == 0 ?? Nil !! $_[0..^$s]), [ $_[$s..$e] ], ( $e == +$_ ?? Nil !! [ $e+1 ..^ +$_ ]);
}
use Test;
plan *;
my @test = "01234567809", ["01234567809"], ["0123", ["4567"], "809"];
say subtree(@test, [], 1..2)
oops
soory
I meant to paste that : nopaste.gamedev.pl/?id=7656
jnthn nopaste? ;-)
cognominal xchat--
jnthn :-)
cognominal :(
just to show you the kind of thing I try to do. 12:57
to see if multiple dispatch is appropriate here.
12:57 ash_ joined
jnthn In there you have two candidates that look identical to me: 12:58
multi sub subtree(@a, [$i], Range $r, Bool :$mod) {
(the last two)
mathw I assume one is for mod=true and one is for mod=false 13:00
cognominal yea, that should be one routine, and it should return the whole tree.
I had not really finished wirting it when I had problems with multiple dispatch 13:01
jnthn The thing is that
masak ooh! "static lexpad" is a wonderful name.
pmichaud++
jnthn (@a, [], Range $r) 13:02
And
(@a, @path, Range $r?, Bool :$mod?)
Both sort to the same level in terms of the arity/type sorting
And then both have to be dis-ambiguated on constraints.
And there's a case where both match the constraint. 13:03
cognominal I want to walk a tree and possibly modify it by adding a branch depending of the Range. The range is really position of the string crateed by walking the tree and concatenating the strings.
"position in the string".
what would be the way out? 13:04
masak EQUESTIONTOOUNSPECIFIC 13:05
mathw Insufficient Chocolate Error. Insert more chocolate to continue.
jnthn cognominal: You may need to break multi sub subtree(@a, @path, Range $r?, Bool :$mod?) { subtree( @a[@path.unshift], $r, $mod) } into a couple of candidates that don't conflict with other things 13:06
cognominal: e.g. maybe 13:08
multi sub subtree(@a, @path, Range $r, Bool :$mod!) { subtree( @a[@path.unshift], $r, $mod) }
multi sub subtree(@a, @path, Range $r) { subtree( @a[@path.unshift], $r) }
cognominal well, I will pass the $mod as lexical in a closure. It will be more elegany anyway.
jnthn That way, there's no way the two can overlap in a constrainty way and both match 13:09
cognominal but somehow, I don't like multiple dispatch as it is.
We will see how people will use it in teal programs.
*real 13:10
mathw I'm thinking my mental model of constraints is wrong 13:13
cognominal afk& 13:14
13:18 jedai left
jnthn On a walk to buy bread just now, it occurred to me the heart of it is this: if you are going to have multi candidates that will be dis-ambiguated by constraints, then the constraints should not overlap. 13:26
13:27 Lorn left, mantovani left 13:33 timbunce joined
masak isBEKaml, tylercurtis, snarkyboojum: I thought a lot about SIC and Yapsi last night; here's a summary of my thoughts. gist.github.com/464349 13:35
13:38 ive joined 13:42 sftp joined 13:46 Lorn joined 13:53 sftp left, rhr left 13:54 timbunce left 13:55 timbunce joined, rhr joined
slavik jnthn: O.o wha? 13:56
why can't I be smart enough to understand language design? :(
moritz_ svok.blogspot.com/2010/07/announcin...-team.html 13:58
14:00 amkrankruleuen left
mathw jnthn: yes maybe that's the right kind of route 14:02
What I'd like to understand is the reason why constraints all sort at the same level
Is it just too difficult to do them any other way?
jnthn mathw: Well, how do I order e.g. where { $^n < $limit } and where { $^n %% 2 }? 14:04
masak mathw: perhaps not, but we've toyed with less-than-super-simple resolution algorithms before, and it didn't lead to happiness those times.
14:04 PacoLinux joined
jnthn The easy example here is 14:04
mathw jnthn: there, indeed, you can't
jnthn multi foo($x where { $x >= 10) { } 14:05
multi foo($x where { $x <= 10 }) { }
er, missing }
Anyway, foo(10) is then ambiguous because the constraints overlap there
mathw yes
I'm not arguing that 14:06
jnthn OK, but my point is that cognominal++'s example conflict boiled down to the same kind of issue.
mathw Which I don't understand 14:07
masak me neither, not at once.
it's easier to see with blocks.
moritz_ what were the constraints?
jnthn moritz_: In one of them the subsignature
moritz_: In the other, the presence of a named parameter
moritz_ I think I remember an RT ticket (which I kinda thought was bogus, but not sure) 14:08
mathw That's what I don't understand, because they're constraints on different parameters
14:08 uniejo left
mathw well, okay, the named parameter isn't a parameter in that sense 14:08
moritz_ rakudo: multi a($x, $y) { }; multi a ($x, $y?) { }; a(1, 2) 14:09
p6eval rakudo d9a5ac: OUTPUT«Null PMC access in invoke()␤current instr.: 'perl6;Perl6Role;!select' pc 11403 (src/gen/RoleToClassApplier.pir:591)␤... call repeated 1 times␤»
jnthn ...
moritz_ that's ouch-y
jnthn rakudo: say "huh"
p6eval rakudo d9a5ac: OUTPUT«Null PMC access in invoke()␤current instr.: 'perl6;Perl6Role;!select' pc 11403 (src/gen/RoleToClassApplier.pir:591)␤... call repeated 1 times␤»
mathw ouch!
jnthn aww
our evalbot is fel again
mathw: It's more about the whole set of arguments than you pass. And if you can pass a set of arguments that causes both to match, you're in for a conflict. 14:11
mathw has a horrible suspicion that he's trying to think of a solution that's inevitably undecidable 14:12
jnthn :-)
mathw: What worries me about trying to make more multi calls be disambiguated is that it probably means making the algorithm more complex, when it's clear that it's already complex enough that it's non-trivial to grok. 14:14
moritz_ any disambiguation algorithm will have cases where it doesn't DWYM 14:15
jnthn Right
moritz_ and then it must be understood - jnthn is right here 14:16
14:16 MarkSenn joined, lest_away is now known as lestrrat
jnthn I guess it's a trade-off. We can try and make multi-dispatch richer and make it less likely that folks will hit a non-DWIM case, but in doing so we also increase the pain of understanding that's going on when people do get to such a situation. 14:17
14:17 lestrrat is now known as lest_away
jnthn And as moritz_++ points out, it's more when than if. :-) 14:17
At least, if you write enough non-trivial multis. :-) 14:18
er, *what's going on
mathw yes 14:19
I think my real surprise was just that named parameters are constraints rather than parameters
14:20 redicaps joined
mathw Then I was surprised about constraints on different parameters not DWIE 14:21
but thinking about it some more I realise there's a slippery slope there 14:22
14:22 takadonet left
mathw I do not want the system pausing for ten seconds in order to inform me that it can't find a suitable candidate without first solving the halting problem 14:22
moritz_ I guess it's just like starting with grammars: it's a relatively new programming concept, and people have to learn to use it. Even people who are otherwise experienced programmers. 14:23
mathw well, grammars were much easier
once I realised that token and rule were doing strange things I didn't like
and started just using regex :)
oh and back in alpha, when backtracking 'worked' 14:24
jnthn mathw: I think deciding something boils down to the halting problem may also be a case of the halting problem. ;-)
14:24 takadonet joined
mathw jnthn: in some cases, yes 14:24
jnthn Yes, not all :-) 14:25
mathw in fact, there was one case I identified in my attempt to get a PhD which was definitely the halting problem just figuring out if a particular thing was the halting problem...
that line of enquiry was not profitable for anybody
moritz_ rakudo: say 1 14:26
jnthn concentrates on $dayjob for a little bit
p6eval rakudo d9a5ac: OUTPUT«1␤»
moritz_ rakudo: multi a($x, $y) { }; multi a ($x, $y?) { }; a(1, 2)
p6eval rakudo d9a5ac: OUTPUT«Ambiguous dispatch to multi 'a'. Ambiguous candidates had signatures:␤:(Any $x, Any $y)␤:(Any $x, Any $y?)␤␤ in main program body at line 11:/tmp/7I_PoGnIjp␤»
mathw now that is definitely ambiguous
although I suppose you could say prefer the one that demands two over the one that could have one 14:27
but probably better to say it's just ambiguous, if you wanted one with one parameter just write one with one parameter! 14:28
jnthn mathw: That'd be my leaning, at this point.
14:28 plobsing joined
jnthn I guess whoever filed the ticket felt otherwise. ;-) 14:28
mathw explaining to people why their variant with the optional parameter never got called would just get silly
14:29 bjarneh joined
mathw the side of me which carries a big stick says people should choose their multi signatures carefully 14:30
cognominal I critize the current scheme but I can't get a better one... 14:32
14:34 takadonet left, takadonet joined 14:35 Trashlord left 14:37 MarkSenn left 14:39 redicaps left, takadonet left
masak std: my $object; $object.**(5)parent; # $object.parent.parent.parent.parent.parent 14:40
p6eval std 31553: OUTPUT«===SORRY!===␤Confused at /tmp/fgHwp9ci5b line 1:␤------> my $object; $object.*⏏*(5)parent; # $object.parent.parent.pare␤ expecting dotty method or postfix␤Parse failed␤FAILED 00:01 113m␤»
masak I know that's now currently allowed syntax... :)
...but when we have syntax-modifyiing modules, it just might be.
along with an `$object.?**(5)parent` form, too. 14:41
mathw that is... 14:43
definitely best left to syntax-modifying modules
14:43 takadonet joined
masak :> 14:43
mathw I think your brain's in sideways
masak no no, admit it, you want that syntax. 14:44
jnthn :P
mathw no I don't
I really don't
moritz_ masak: I kinda think that $object.**(5)method is a very dangerous thing
because it makes quite some assumptions about the underlying data structure 14:45
masak not sure I see what you mean.
it makes five method calls, that's all.
sure the dispatch might be different in all five cases...
mathw it's foul
moritz_ and it assumes that the first four all return objects where it makes sense to call .parent on it
mathw take it away!
moritz_: well, so does .parent.parent.parent.parent.parent 14:46
masak moritz_: well, the programmer assumes that.
moritz_ .parent.parent.parten.parent.parent is also a bad idea :-) 14:47
masak: yes, but that syntax encourages these assumptions
masak moritz_: I'd have that as $thing .= parent for ^5; in today's Perl 6.
mathw masak that's even eviller 14:48
moritz_ masak: which has the advantage of being easily extensible to give better error messages
masak mathw: there's just no pleasing you... :)
mathw nope
moritz_ for ^5 { die "OH NOEZ, \$thing can't do .parent at level $_" unless $thing.can('parent'); $thing.=parent; } 14:49
or better, access the depth in a CATCH block
mathw of course what you really want to do is just write it in Haskell
mathw runs
jnthn or use xpath ;-)
mathw parent $ parent $ parent $ parent $ parent thing 14:50
moritz_ but if you do $thing.**(5)parent, and you get an error message, you have quite some "fun" debugging
mathw jnthn: or have a better API design
which might be xpath
moritz_ eval '$thing' ~ ('.parent' x 5)
mathw a lovely scrummy xpath module
moritz_ SCNR
mathw **($n)method would of course have to expand at the macro stage to .method.method.method etc, hopefully before the compiler checks to see if it's plausible 14:51
moritz_ why would it need to be a macro? 14:52
mathw because I can't think of another route by which you could introduce that kind of syntax 14:54
14:54 takadonet left
moritz_ a postfixish meta operator? 14:54
masak std: my $thing; $thing.?=parent for ^5;
p6eval std 31553: OUTPUT«===SORRY!===␤Confused at /tmp/3KErTEND3F line 1:␤------> my $thing; $thing.?⏏=parent for ^5;␤ expecting dotty method or postfix␤Parse failed␤FAILED 00:01 110m␤»
masak std: my $thing; $thing = $thing.?parent for ^5; 14:55
p6eval std 31553: OUTPUT«ok 00:01 110m␤»
masak ...and afterwards, check for undef. 14:56
er, Mu. whatevs.
moritz_ std: 1.=?foo
masak check if not defined.
p6eval std 31553: OUTPUT«===SORRY!===␤Decimal point must be followed by digit at /tmp/IEgOgks95F line 1:␤------> 1.⏏=?foo␤Bogus term at /tmp/IEgOgks95F line 1:␤------> 1.=⏏?foo␤ expecting dotty method or postfix␤Parse failed␤FAILED 00:01 108m␤»
moritz_ std: 'bla'.=?foo
p6eval std 31553: OUTPUT«===SORRY!===␤Bogus term at /tmp/1VWVDJ7CT5 line 1:␤------> 'bla'.=⏏?foo␤ expecting dotty method or postfix␤Parse failed␤FAILED 00:01 108m␤»
jnthn moritz_: No. :P
masak moritz_: probably intentionally not allowed :) 14:57
jnthn They don't combine. :-)
masak on behalf of my brain, I wish to apologise for coming up with it in the first place. :P
mathw wouldn't it be .?= 14:58
even though it really is evil
and you shoudl be ashamed of yourself
moritz_ masak: compensate by answering to my mail on the perl6-workshop list :-)
mathw &
moritz_ mathw: masak++ tried .?= before
14:58 takadonet joined
masak right. didn't work either. 14:58
moritz_: hokay. :) 14:59
pmichaud good morning, #perl6
masak pm!!! \o/
moritz_ good morning, mr closure-fix!
pmichaud ...does it work? :-)
moritz_ autounfudge found quite some things 15:00
15:00 plobsing left
moritz_ rakudo: say [\+] [\+] 1 xx 5 15:00
p6eval rakudo d9a5ac: ( no output )
moritz_ colomon++ expected this to be fixed by the closure fix too, but he might be wrong 15:01
masak pmichaud: I've re-compiled Rakudo. let me try and rebuild GGE without the closure workarounds. :)
jnthn morning, pmichaud
pmichaud: Great work on landing the branch! :-D 15:02
pmichaud jnthn: I'm curious if my gen_version.pl stuff works under windows. (i.e., are you able to build current master branch? )
jnthn pmichaud: ah, you didn't backlog. Yes, it works.
pmichaud: I pasted the output.
pmichaud: It looked correct
pmichaud jnthn: (landing branch) thanks -- it was your fix that got us over the final hurdle.
(reading backlog now)
jnthn Heh, it was only a one line change. :-)
moritz_ well, the zen master can fix many bugs with one line of change 15:03
knowning where to change what matters far more than the number of lines involved 15:04
:-)
jnthn :-)
Aye, but it was one small fix compared to the many pmichaud++ did.
jnthn has fun eliminating locking and replacing it with lock-free stratergies for $dayjob 15:05
pmichaud "A programming language of a thousand features begins with a single patch." (or something like that)
masak "An implementation with a thousant RT tickets begins with a single RT ticket." Hm, doesn't quite have that ring to it. :) 15:08
moritz_ rakudo: say $*PERL
p6eval rakudo d9a5ac: OUTPUT«version 2010.06-173-gd9a5ac0␤name rakudo␤␤»
masak er. 15:10
the revision number after 'rakudo' doesn't match the onw in the version value.
pmichaud ? 15:11
moritz_ there's a stray 'g' in there 15:12
pmichaud that comes from git-describe.
it's not part of the revision number.
masak ah.
and then there's an extra 0.
pmichaud the revision number is whatever comes after the 'g'
masak right.
'g' can't be part of a hex number :)
moritz_ masak: the 0 is an artifact of using different lengths
pmichaud git sha1's can be shortened to any length (that keeps the unique)
*them
masak aye. 15:13
so, false alarm.
moritz_ p6eval is just a bit more nazi in shortening them :-)
masak squirms and falls silent :) 15:17
15:17 cotto left 15:19 tedv joined 15:25 macdaddy joined, macdaddy is now known as Guest77623
pmichaud jnthn: ping 15:28
jnthn pmichaud: pong
pmichaud is there currently a way that we could have methodcalls not de-containerize the invocant? 15:29
jnthn Well, I think we wanted to switch to that as a kind of default... 15:30
pmichaud switch to which?
jnthn Don't de-containerize 15:31
Otherwise :($inv is rw: ...) can never work
pmichaud right
jnthn Which I think we needed for auto-viv.
masak .oO( Is there a way not to immanentize the eschaton? )
pmichaud (guess what I'm working on now :)
jnthn Right
I thought up an Awesome Solution to this a while back.
I wish I could remember it.
We discussed it here so it must be in the logs somewhere. ;-) 15:32
pmichaud what's the reason we de-containerize now?
jnthn Oh oh oh!
pmichaud I forget.
jnthn I know it.
We de-containerize because if the thing in the container is a (non-object) PMC then Parrot guts get hugely upset over the wrapper. 15:33
Since they can't find their attribute data.
The answer was to only de-containerize if the thing in the container ended up being something other than an Object or P6opaque.
Which is a dirt-cheap check. 15:34
(check ->vtable->base_type)
pmichaud I'm having trouble following that. 15:37
might be too early here for me.
masak pmichaud: I got a 'Segmentation fault' when running the GGE tests. don't know yet if it's reproducible; will try running it again.
pmichaud the problem is that Parrot doesn't know how to deal with objectrefs
jnthn hands pmichaud a Dr Pepper 15:38
pmichaud: It's not really a "problem" of Parrots
pmichaud: A PMC has a data pointer off which hands a C struct holding its attributes 15:39
When you invoke a method on a PMC, it thus expects to be able to get at its data through the SELF pointer.
SELF PMC * pointr that is
Trouble is, if we wrapped the invocant, that's an ObjectRef PMC or a Perl6Scalar PMC, not the actual PMC that it expects 15:40
It just reads into memory it shouldn't and segfaults.
*thus
Or worse, does something weird. :-)
So the reason we de-containerize is so that methods invoked on a PMC that are implemented inside the PMC won't explode that way.
However, de-containerizing everywhere is a bit OTT
We only need to de-containerize things where this is actually an issue 15:41
masak swimming &
jnthn Which is basically anything that is not an Object (or in our case P6opaque, since we subclassed Object)
15:41 masak left
pmichaud by "methods implemented inside the PMC" do you mean the PCCMETHODS ? 15:41
jnthn Correct
15:41 Trashlord joined
pmichaud I have a bigger question, then. 15:42
well, several.
well, I answered one myself. I was going to ask if perhaps we wanted to somehow exclude such methods from dispatch anyway (e.g., to keep Parrot methods from leaking into our objects) 15:43
but the answer is that we don't want to exclude them -- we still want to be able to do dispatch on foreign PMCs
jnthn Right.
Well the problem is in say IO.pm 15:44
Where we want to make calls on a Parrot IO PMC
pmichaud right
so, how hard would it be to implement this new behavior?
jnthn Not hard
pmichaud also, I wonder if lexical 'self' should also be de-containerized. 15:45
jnthn We want a new decontainerize_invocant dynop
And to use that in place of the one that unconditionally does it
And that dynop is quite easy to write (5 lines or so...10 at worst)
pmichaud dynop should be deref_pmc 15:46
or depmcref
"decontainerize_invocant" is in fact the thing we're *not* doing :-)
jnthn this is only for invocants
well
15:47 TiMBuS left
pmichaud it's really derefifpmc 15:47
jnthn deref_invocant_if_it_refs_a_pmc
;-)
pmichaud well, we don't need "invocant" in the name
we may currently only be using it for method-dispatch, but it would work on non-invocanty things also.
derefnonobject 15:48
jnthn true
pmichaud deref_if_pmc
deref_unless_object
do you want to write it or shall I?
(yes, easy to do) 15:50
jnthn If you can, go ahead.
(i need to work on $dayjob bits a little today)
15:50 sftp joined 15:52 isBEKaml joined
pmichaud gist.github.com/464491 # basic opcode for jnthn++ 15:57
fixing syntax error :-) 15:58
jnthn yes that's what I had in mind
though
PMC * val;
val = $2;
Why not one line?
PMC * val = $2;
pmichaud it wasn't that way in the other opcodes
so I didn't copy it :-)
jnthn oh.
:-)
pmichaud er, so I copied it.
there are currently some "string_from_literal" calls for P6opaque that I'm also going to factor out 16:00
(and cache the type, like we do for p6s_id)
jnthn +1 16:02
TimToady is back home, and starting to feel rested 16:06
phenny TimToady: 03 Jul 22:40Z <sorear> tell TimToady Just to clarify my question from earlier: I only want to rename the Perl 5 modules in STD. STD.pm6 will be unaltered; viv will contain code to remap STD, Cursor, etc -> Perl6::* (like it already remaps so many renamed Perl6 functions)
TimToady: 04 Jul 08:53Z <sorear> ask TimToady what's the motivation separating sublongname and longname?
TimToady: 04 Jul 18:54Z <masak> ask TimToady could you have a look at this case of the new semantics for multies in an OO hierarchy? jnthn and I have an un-consensus about it.
TimToady: 04 Jul 18:55Z <masak> tell TimToady -- oh and here's the link gist.github.com/463655 :)
pmichaud TimToady: /o 16:07
arrgggh
TimToady: o/
TimToady why did you whack your head? :)
pmichaud It's just the way I feel lately, I guess. :)
.oO( /o ... o/ looks like a *real* multiline comment syntax )
16:08
/o or a multi-line
bubble thought
syntax o/
TimToady the ir clogs seem to not render currently...
doesn't like the &larr on line 40... 16:10
some quick impressions just skimming the last 24 hrs of backlog though
sorear: I revised my augment-is-like-BEGIN to say the statements don't run at BEGIIN time
on the declarations 16:11
I think multis don't run more than once; that is, a proto does not automatically fall back to its OUTER unless the proto requests it
pmichaud jnthn: are string_from_literal calls generally "expensive", either in terms of runtime performance or in creating gc-ables? 16:12
TimToady re STD->Perl6::* that seems fine, if you put it that way :) 16:13
16:15 jaldhar left
jnthn pmichaud: They make a GC-able 16:15
pmichaud: If the code is hot path, that's bad.
pmichaud so avoiding them would be a good thing.
like, say, in bind_llsig :-) 16:16
jnthn If it's not path, no biggie.
er, yes
That's hot path
pmichaud okay
jnthn Flaming path
pmichaud agreed
I just wanted to make sure I knew I was really optimizing something there :)
TimToady I'm assuming masak's multi example has a 'proto' on class A's foo method; it should probably error as it is
16:17 jaldhar joined, tylercurtis joined
TimToady that is, it should say "A" and fail on the nextsame, because there is no next candidate 16:18
16:20 sawyer_ left 16:22 meppl joined
TimToady I suspect we are going to say that there are no implicit protos, at least for now. 16:22
and more importantly, that no multi ever gets called without a proto mediating
there's no proto in that example, hence no call to either of the multis 16:23
and if class A's method foo is marked as proto, it will print "A\nC\nB\n" 16:26
because the say A is before the nextsame, and protos are no longer last-resort, but a wrapper around the multies
16:34 sawyer_ joined
TimToady sorear: re sublongname: well, the original motivation was to parse category-based operator names specially, but that may not be important any more; what is still important is allowing :{} as part of the name, since longnames reject :{} extension nowadays 16:35
we could conceivably factor those out to where <sublongname> is called, and then use longname, I guess 16:36
in that case category based things like infix:<op> would have to be recognized semantically instead of syntactically
it's quite possible that's the right way to go about it 16:37
16:38 mberends left
TimToady btw, restarting my firefox seems to have cleared my ir clog issue 16:40
cono rakudo: say $*VM.perl 16:41
p6eval rakudo d9a5ac: OUTPUT«Cannot substr on a null string␤ in 'Pair::perl' at line 1␤ in <anon> at line 4458:CORE.setting␤ in 'Any::join' at line 1␤ in 'EnumMap::perl' at line 4458:CORE.setting␤ in 'Pair::perl' at line 4220:CORE.setting␤ in <anon> at line 4458:CORE.setting␤ in 'Any::join' at line
..1␤ …
pmichaud jnthn: The new non-dereference thing appears to work just great. 16:45
jnthn++ 16:46
(spectesting now)
moritz_ rakudo: say %*VM<config>.perl
p6eval rakudo d9a5ac: OUTPUT«Cannot substr on a null string␤ in 'Pair::perl' at line 1␤ in <anon> at line 4458:CORE.setting␤ in 'Any::join' at line 1␤ in 'EnumMap::perl' at line 4458:CORE.setting␤ in main program body at line 11:/tmp/Jr_xIYk4Oe␤»
moritz_ pmichaud: is there a good reason for $VM not to re-use %*VM<config>?
pmichaud moritz_: I'm thinking that %*VM should go away.
At the very least, it doesn't belong in glue/run.pir 16:47
16:47 hudnix joined
dalek kudo: 1e7012c | (Patrick Abi Salloum)++ | src/core/operators.pm:
minor series code refactor
16:47
pmichaud there's no %*VM listed in the synopses -- we just have $*VM there. 16:48
(I suspect synopses changed.)
16:49 Sarten-X joined 16:55 sftp left 16:57 sftp joined 16:58 ashleydev joined
jnthn pmichaud: Great! 16:58
16:59 envi_home2 left 17:00 dakkar left
TimToady bbl & ~2hr 17:02
17:02 sftp left, envi^home joined 17:03 sftp joined, isBEKaml left 17:06 envi^home left
pmichaud jnthn: only a few spectest fails after switching to deref_unless_object . Some are likely clone-related (fixing now). 17:12
others are in the regexes... not sure why those fail but should be an easy fix.
(if 'clone' doesn't already fix them)
...and with the new deref semantics in place, autoviv looks like it will work just fine. 17:13
17:13 sftp left 17:14 sftp joined
cxreg how come "for [1,2,3] { .say }" produces different output than "[1,2,3].say"? 17:17
phenny cxreg: 06:35Z <mberends> tell cxreg your MiniDBD::Pg passes 24 of the 32 common tests, you're welcome to merge when you like.
cxreg both print a single line, one with spaces and one without
moritz_ rakudo: (1, 2, 3).say 17:19
p6eval rakudo d9a5ac: OUTPUT«123␤»
moritz_ rakudo: [1, 2, 3].say
p6eval rakudo d9a5ac: OUTPUT«123␤»
pmichaud #?rakudo todo '<!before>'
is(+('.2 1' ~~ /<!before \.> \d/), 1, '<!before>');
is +$/.keys, 0, '<!before \\.> does not capture';
moritz_ rakudo: for [1, 2, 3] { .say }
pmichaud ...huh? 17:20
p6eval rakudo d9a5ac: OUTPUT«1 2 3␤»
moritz_ pmichaud: should probably be <!after \.>
pmichaud moritz_: I guess we're testing the !, and not the 'before' part? 17:21
moritz_ pmichaud: might depend on where these tests are coming from
pmichaud t/spec/S05-metasyntax/angle-brackets.t 17:22
moritz_ then yes
pmichaud but the second line is odd also.
Rakudo says (and I agree) that $/.keys is 1
sorry
+$/.keys is 1 17:23
moritz_ is Match.keys the same as (Match.hash.keys, Match.list.keys).flat
?
pmichaud I think that we should treat $/ like any other scalar
my $a = 5; say +$a.keys;
rakudo: my $a = 5; say +$a.keys; 17:24
p6eval rakudo d9a5ac: OUTPUT«1␤»
moritz_ I think that's not a good idea
pmichaud and if you want the hash portion or the list portion, you have to explicitly ask for it.
moritz_ I can imagine two sensible reactions: either die, or return both hash and list keys 17:25
cxreg moritz_: so do you think that's expected, or just inconsistent use of whatever perl6's $" is?
szabgab is there a way to know if a for loop has ended naturally or via a call to last; ?
pmichaud cxreg: what you provided is expected
cxreg pmichaud: ok, in both cases say() is called once
just checking
moritz_ $/.keys always returning 0 would be very surprising
pmichaud cxreg: yes. It's the difference between say [1,2,3] and [1,2,3].say
moritz_ rakudo: say [1, 2, 3] 17:26
pmichaud moritz_: in that case, I'm okay with fail, yes.
p6eval rakudo d9a5ac: OUTPUT«1 2 3␤»
pmichaud anyway, I'm going to todo the test for now.
moritz_ pmichaud: I'd rather prefer the other interpretation, but both are fine
pmichaud (requesting spec clarification)
17:26 Sarten-X left
moritz_ pmichaud: then please change the test to use .caps 17:26
cxreg pmichaud: i see that theres a difference, but i dont know why :) i'll rtfs(pec|ource)
moritz_ then it's clear what's meant
pmichaud moritz_: well, .caps is broken in my branch also, so I need to get it fixed as well :) 17:27
moritz_ cxreg: say($thing) converts $thing to a string
pmichaud but yes, .caps ++
szabgab good evening everyone!
moritz_ cxreg: which inserts spaces
szabgab: good evening. I don't think there's a good answer to your questions, except maybe via a (NYI) CONTROL block setting stuff 17:28
pmichaud shortly one could do "last $sentinel" and then check the results for the $sentinel value... or stuff like that. 17:29
(nyi, but I hope to implement today or tomorrow)
szabgab python has this for .... else: thing
pmichaud szabgab: see "sink"
szabgab and else executes only if break was not called
or maybe if it was
moritz_ szabgab: I thought that checked if there was no iteration, not if it was prematurely aborted? 17:30
szabgab nope, it fires if break was called
moritz_ std: do for 1..3 { } || do { say "OH NOEZ" }
p6eval std 31553: OUTPUT«===SORRY!===␤Strange text after block (missing comma, semicolon, comment marker?) at /tmp/1IB1BtgpfW line 1:␤------> do for 1..3 { }⏏ || do { say "OH NOEZ" }␤ expecting horizontal whitespace␤Parse failed␤FAILED 00:01 113m␤»
moritz_ std: for 1..3 { } || do { say "OH NOEZ" } 17:31
p6eval std 31553: OUTPUT«===SORRY!===␤Strange text after block (missing comma, semicolon, comment marker?) at /tmp/9dGlVW6HoZ line 1:␤------> for 1..3 { }⏏ || do { say "OH NOEZ" }␤ expecting horizontal whitespace␤Parse failed␤FAILED 00:01 109m␤»
moritz_ std: for 1..3 { } or do { say "OH NOEZ" }
p6eval std 31553: OUTPUT«===SORRY!===␤Strange text after block (missing comma, semicolon, comment marker?) at /tmp/H31Ws4WgRq line 1:␤------> for 1..3 { }⏏ or do { say "OH NOEZ" }␤ expecting horizontal whitespace␤Parse failed␤FAILED 00:01 109m␤»
moritz_ std: my @a = do for 1..3 { }
p6eval std 31553: OUTPUT«ok 00:01 111m␤»
szabgab paste.scsys.co.uk/46353
that's prime in python
pmichaud szabgab: if I'm reading that correctly, the 'break' prevents the else, not causes it. 17:33
szabgab: if we find a factor, we break (and the 'else' doesn't get invoked)
szabgab yes, you are right
pmichaud in perl 6, one would do
for 2..10 -> $n { for 2..$n -> $x { last 1 if $n %% $x; Nil } || say "$n is prime"; } 17:35
might need a paren there
for 2..10 -> $n { (for 2..$n -> $x { last 1 if $n %% $x; Nil }) || say "$n is prime"; }
szabgab rakudo: for 2..10 -> $n { (for 2..$n -> $x { last 1 if $n %% $x; Nil }) || say "$n is prime"; }
pmichaud actually, the Nil isn't even needed.
p6eval rakudo d9a5ac: OUTPUT«2 is prime␤3 is prime␤5 is prime␤7 is prime␤» 17:36
szabgab rakudo: for 2..10 -> $n { (for 2..$n -> $x { last 1 if $n %% $x; }) || say "$n is prime"; }
p6eval rakudo d9a5ac: OUTPUT«2 is prime␤3 is prime␤5 is prime␤7 is prime␤»
szabgab nice
pmichaud I'm surprised that works in rakudo.
moritz_ if you don't bother about printing which number can be divided by which other, you can also get rid of the inner loop completly, and use a junction
pmichaud (it probably works "by accident" at the moment)
moritz_ if $n %% none(2..$n.sqrt) { say "$n is prime"; take $n; } 17:37
szabgab rakudo: for 2..16 -> $n { (for 2..$n -> $x { last 1 if $n %% $x; }) || say "$n is prime"; }
p6eval rakudo d9a5ac: OUTPUT«2 is prime␤3 is prime␤5 is prime␤7 is prime␤11 is prime␤13 is prime␤»
szabgab rakudo: for 2..16 -> $n { (for 2..$n -> $x { last if $n %% $x; }) || say "$n is prime"; }
moritz_ pmichaud: I've unfudged a whole lot of tests that use the return values of if/for/while/$whatever
p6eval rakudo d9a5ac: OUTPUT«2 is prime␤3 is prime␤5 is prime␤7 is prime␤11 is prime␤13 is prime␤»
Juerd Add a sqrt :)
moritz_ pmichaud: so even if it works "accidentally", it won't break accidentally :-)
17:37 Sarten-X joined
pmichaud anyway, the result of a for loop is the collected results of all of its block executions. 17:37
(like a .map) 17:38
szabgab rakudo: for 2..16 -> $n { (for 2..$n.sqrt -> $x { last if $n %% $x; }) || say "$n is prime"; }
p6eval rakudo d9a5ac: OUTPUT«2 is prime␤3 is prime␤4 is prime␤5 is prime␤6 is prime␤7 is prime␤8 is prime␤9 is prime␤11 is prime␤13 is prime␤15 is prime␤»
szabgab rakudo: 4.sqrt 17:39
p6eval rakudo d9a5ac: ( no output )
szabgab rakudo: say 4.sqrt
p6eval rakudo d9a5ac: OUTPUT«2␤»
moritz_ rakudo: for 2..16 -> $n { say "$n is prime" if $n %% none(2..$n) 0
pmichaud maybe ($n.sqrt)? (shouldn't be
p6eval rakudo d9a5ac: OUTPUT«===SORRY!===␤Unable to parse blockoid, couldn't find final '}' at line 11␤»
szabgab rakudo: for 2..16 -> $n { (for 2..sqrt $n -> $x { last if $n %% $x; }) || say "$n is prime"; }
moritz_ rakudo: for 2..16 -> $n { say "$n is prime" if $n %% none(2..$n) }
p6eval rakudo d9a5ac: OUTPUT«2 is prime␤3 is prime␤4 is prime␤5 is prime␤6 is prime␤7 is prime␤8 is prime␤9 is prime␤11 is prime␤13 is prime␤15 is prime␤»
rakudo d9a5ac: ( no output )
moritz_ rakudo: for 2..16 -> $n { say "$n is prime" if $n %% one(2..$n) } 17:40
p6eval rakudo d9a5ac: OUTPUT«2 is prime␤3 is prime␤5 is prime␤7 is prime␤11 is prime␤13 is prime␤»
pmichaud afk, lunch & errands
moritz_ every number is divisible by itself, so I need one() instead of none()
ash_ rakudo: for 2..16 -> $n { say "$n is prime" if $n %% none(2..$n.sqrt) } # moritz, i think that is slightly faster 17:41
p6eval rakudo d9a5ac: OUTPUT«2 is prime␤3 is prime␤5 is prime␤7 is prime␤11 is prime␤13 is prime␤»
moritz_ ash_: right
ash_ granted, there is probably another way thats faster than that
but still
Juerd s/slightly/much/ for big $n
17:41 patspam joined 17:43 clintongormley left 17:44 rgrau_ left
ash_ i like how in math, there are 'industrial strength' prime numbers, since its to computationally expensive to make sure they are really prime, they just check if they are statistically likely to be prime 17:45
i guess thats not for math, they use real prime numbers, i guess thats more for cryptography 17:46
moritz_ well, the strength of a good stochastic prime tests is quite good
17:46 kfo_ joined
moritz_ so good that the probabilty of getting a false positive through cosmic rays while brute-forcing it is higher than the a failure of the statistical test 17:46
ash_ is there a shortcut for getting the words of a file that is passed to a perl6 program? 17:47
arnsholt The joys of stochastic computing ^^
moritz_ ash_: lines».words 17:48
ash_ so @*IN.lines>>.words?
pmichaud $*IN
moritz_ I actually meant lines».words when I wrote lines».words :-)
lines() is like the perl 5 magic <> in list context
ash_ oh, neat
szabgab btw is there a way to specify the command line args similar to how one can specify params of a sub ? 17:49
ash_ it defaults to $*IN? nice
moritz_ szabgab: yes, sub MAIN($mandatory, Bool :$named-option) { ... }
rakudo: sub MAIN($mandatory, Bool :$named-option) { ... }
szabgab ty
p6eval rakudo d9a5ac: OUTPUT«Usage:␤/tmp/5eZMASNBBm [--named-option] mandatory␤»
17:49 kfo left
moritz_ and it's even implemented! 17:50
patrickas++
szabgab is rebuilding everything
sorear good morning #perl6
slavik morning? it's afternoon :P 17:51
szabgab moritz_, btw I was trying to build the smartlinks on Windows and it blew uo
up
moritz_ slavik: it's always morning *somewhere*
tylercurtis ash_: also, @*IN.slurp.words should work.
slavik I'm american, my time matters, not yous :P 17:52
szabgab is pugs:util/smartlinks.pl still in use for that ?
slavik yours*
moritz_ szabgab: yes
szabgab so in util/version_h.pl it has my $output = `svn info 2>&1; echo \$?`;
any idea why is the echo part there ? 17:53
moritz_ I probably cargo-culted it from somewhere
should be fine to remove it
szabgab so I uncargo cult it now :)
moritz_ szabgab++
szabgab and then see what else I need to change to make it work on my brand new windows machine :)
moritz_ I also get some strange behaviour from it: it says me that all $n smartlinks it finds are broken, but still smart-links them in the synopsis documents 17:54
pugssvn r31554 | szabgab++ | remove cargo cult 17:55
17:56 tadzik joined
szabgab oh boy, I should have never mentioned it :) 17:56
moritz_ szabgab: I don't expect you to fix it, fwiw. It's likely me who broke it :-) 17:57
18:04 dakkar joined 18:19 rv2733 joined 18:26 skids left 18:30 skids joined 18:32 arthur-_ joined 18:40 rurban joined 18:43 allbery_b left 18:44 allbery_b joined
allbery_b oops 18:44
18:45 orafu left 18:46 orafu joined 18:51 eternaleye left 18:53 rv2733 left 18:54 arthur-_ left 18:58 eternaleye joined 18:59 FardadJalili joined 19:02 ash_ left 19:05 mikehh joined, cono left 19:06 ash_ joined, cono joined 19:11 arthur-_ joined, arthur-_ left 19:13 clintongormley joined
arnsholt Making PAST trees has in it the potential of quite inscrutable code methinks ^_^ 19:15
19:17 whiteknight joined 19:18 lichtkind joined 19:22 FardadJalili left 19:24 skids left 19:25 skids joined 19:26 tylercurtis left
ash_ is perl6 io really slow currently? 19:28
arnsholt Rakudo certainly is kinda slow 19:29
What are you using it for?
ash_ ultimately, counting unique words 19:30
but it seems to be hanging at one point and i can't tell why 19:31
ah, nevermind i am just being dumb
moritz_ expect it to be 100 to 1000 times slower than Perl 5 atm
ash_ i am not worried about speed, just playing stackoverflow.com/questions/3169051...ency-chart is what i am doing 19:35
in perl6, there are ruby, perl, python, etc... most popular languages have solutions to it, i haven't seen a perl6 though
19:39 Ross left, Ross joined 19:42 whiteknight left 19:44 meppl left 19:45 mantovani joined
TimToady the differences between lines and words really bugs me today 19:47
mathw Any differences in particular?
moritz_ TimToady: do you want words() to default to $*ARGFILES, just like lines()? 19:48
TimToady lines("filename") vs words("string with words")
it's the Str case that bugs me
I don't mind either of them defaulting to IO 19:49
but I suspect lines("filename") should become lines("filename".IO)
and then both words(Str) and lines(Str) just do string splits/combs 19:50
alternately, IO is Cool enough to retarget string methods to an implicit slurp or cat 19:51
cat being a lazy slurp in my mind
szabgab I saw this example several times already if $x > all(@values) {} and while it is nice I am not sure this is all that convincing, so it might be faster than if $x > max(@values) but isn't there a better example ?
mathw Hmm that is an irritating inconsistency
TimToady szabgab: no, > all can short circuit, while max can't easily 19:52
szabgab yes, so it is faster, I understood that already :)
TimToady right, maybe I'm not entirely caught up on sleep yet...
szabgab but I don't think that's a huge gain in small arrays 19:53
TimToady when you say "better example", what kind of an example are you looking for?
szabgab so while my first reaction was "cool" I am now going to talk infront of a bunch of Python developers...
by "better example" I mean something that even after thinking about it a bit I still think it is a major gain :) 19:55
TimToady well, $min < all(@values) < $max is better
pmichaud ....except that probably doesn't work in Rakudo atm.
tadzik will be talking about Perl6 on a local Perl workshop 19:56
szabgab all(@values) ~~ regex {}
TimToady or any(@list1) > all(@list2)
that one might do as well with max though
if all(@a) == any(@b) 19:57
mathw I also like $needle == any(@haystack)
pmichaud if any(@list1) == any(@list2)
if any(@list1) == value
TimToady arguably we're just doing set theory there
so maybe something with none or one
pmichaud if one(@list) == value
if one(@list) > value 19:58
jnthn pmichaud: Why wouldn't that work in Rakudo ATM?
pmichaud jnthn: because we don't chain junctions properly.
jnthn ...chain junctions?
ash_ rakudo: say 1 < 2 < 3 19:59
pmichaud $min < all(@values) < $max doesn't decompose simply.
p6eval rakudo 1e7012: OUTPUT«1␤»
jnthn I figured $min < all(@values) < $max is really like $min < all(@values) && all(@values) < $max
TimToady rakudo: say [\+] [\+] 1 xx 5
p6eval rakudo 1e7012: ( no output )
ash_ rakudo: my @a = 3..5; say 1 < all(@a) < 6;
pmichaud $min < any(@values) < $max doesn't work, though.
jnthn pmichaud: e.g. each part collapses
TimToady that's still borked
szabgab the one(@list) > value seems to be already eliminating a lot more code
moritz_ (that's in RT and in some spectests already)
p6eval rakudo 1e7012: OUTPUT«all(Bool::True)␤»
moritz_ rakudo: say [\+] list([\+] 1 xx 5) 20:00
p6eval rakudo 1e7012: ( no output )
moritz_ rakudo: say [\+] [[\+] 1 xx 5]
szabgab I think implementing that would need a sort
pmichaud consider: 3 < any(1,7) < 5
p6eval rakudo 1e7012: OUTPUT«1361015␤»
szabgab or a loop
20:00 tri1 joined
pmichaud rakudo: say 3 < any(1,7) < 5; 20:00
jnthn pmichaud: Would be true
p6eval rakudo 1e7012: OUTPUT«any(Bool::True, Bool::False)␤»
pmichaud jnthn: would be true? which of 1 or 7 is between 3 and 5?
ash_ rakudo: say ?(3 < any(1, 7) < 5); 20:01
p6eval rakudo 1e7012: OUTPUT«1␤»
jnthn pmichaud: Ah, you're expecting the junction to thread through the whole thing?
pmichaud jnthn: that's what TimToady++ told me once
jnthn Oh.
TimToady it's hard
jnthn OK, rather you than me to implement that one.
pmichaud rakudo: my $x = 1|7; say ?(3 < $x < 7);
p6eval rakudo 1e7012: OUTPUT«1␤»
pmichaud rakudo: my $x = 1|7; say ?(3 < $x < 5); 20:02
p6eval rakudo 1e7012: OUTPUT«1␤»
TimToady basically, chained comparisons have to be a single variadic function of args and ops
pmichaud right.
and rakudo doesn't do that right now. :-)
rakudo is still doing the old decomposition into the && form
ash_ rakudo: my Str|Int $a = 1; # just curious...
p6eval rakudo 1e7012: OUTPUT«===SORRY!===␤In "my" declaration, typename Str must be predeclared (or marked as declarative with :: prefix) at line 11, near "|Int $a = "␤»
jnthn Ah, LTA error.
std: my Str|Int $a = 1; 20:03
p6eval std 31554: OUTPUT«===SORRY!===␤Multiple prefix constraints not yet supported at /tmp/VVEh2CwsxT line 1:␤------> my Str⏏|Int $a = 1;␤Malformed my at /tmp/VVEh2CwsxT line 1:␤------> my Str⏏|Int $a = 1;␤ expecting any of:␤ multi_declarator␤
..sco…
jnthn STD does better
TimToady ash_: that form isn't allowed anymore
pmichaud jnthn: the deref_unless_object mod works great EXCEPT
ash_ oh, thats not?
TimToady junctions are too ambiguous in typenames
pmichaud &CREATE_HASH_FROM_LOW_LEVEL seems to fail when given a parrot;Hash coming back from a match object.
any ideas?
TimToady note for instances that & is a valid sigil
jnthn pmichaud: huh, I thought it was meant to take a Parrot Hash and wrap it up in a Perl 6 one. 20:04
TimToady and | is a valid prefix
pmichaud jnthn: so did I.
it now gives me back some sort of object whose type I'm unable to identify
probably a punned class
jnthn pmichaud: I fear that may be a case of symptom rather than cause...
Oh
pmichaud er, punned role
jnthn Maybe
pmichaud (since Hash is currently a role)
jnthn But hm
Yeah...that ones brining in line with the others. 20:05
I'm not entirely sure why the change would lead to that.
ash_ TimToady: so, is there a way to represent some sort of union type?
jnthn When is this happening?
TimToady ash_: use a subset
jnthn At startup, or it just causes some test fails?
pmichaud Match.hash, primarily
TimToady or perhaps a where in the sig
pmichaud causes a few test fails, only in S05
TimToady rakudo: say [+] [1,2,3] # WRONG 20:06
p6eval rakudo 1e7012: OUTPUT«6␤»
pmichaud but I can reproduce the problem with Q:PIR also
TimToady: should be 3?
TimToady yes
pmichaud okay.
TimToady [] should never flatten in a listop
pmichaud I suspect it's a bug in reduce
rakudo: say + [1,2,3]; 20:07
p6eval rakudo 1e7012: OUTPUT«3␤»
ash_ something like: subset StrOrInt of Mu where { Str($^a) & Int($^a) } ?
jnthn self.Regex::Match::hash # this hands back a Parrot Hash?
TimToady just subset StrOrInt of Mu where Str | Int; 20:08
pmichaud jnthn: yes.
TimToady what you have coerces
ash_ ah, cool, thanks
jnthn rakudo: subset StrOrInt where Str|Int; say 42 ~~ StrOrInt; say 'lol' ~~ StrOrInt; say 4.2 ~~ StrOrInt
p6eval rakudo 1e7012: OUTPUT«1␤1␤0␤»
jnthn \o/
ash_ neat, it already works too
TimToady++ jnthn++ 20:09
jnthn ash_: That happens sometimes. ;-)
moritz_ jnthn, pmichaud: do you have any examples of how to iterate a (parrot) hash in NQP?
jnthn pmichaud: OK, color me confused. :-)
pmichaud jnthn: more to the point, '!dispatch_::'(match_obj, 'hash', Regex::Match) definitely gives me back a parrot;Hash
jnthn oh, interesting
pmichaud and it does that whether match_obj is containerized or not. 20:10
let me re-build and re-verify.
jnthn pmichaud: I wonder if !dispatch_:: is failing to deref and invocant or not
OK
I've got a feeling you'll need to push this somewhere for me to debug - it's rather hard to guess at.
pmichaud I tried having it deref the invocant, that didn't seem to help.
okay, I'll push to a branch. 20:11
TimToady sorear: I'm confused by irclog.perlgeek.de/perl6/2010-06-25#i_2478565 since proto subs always have an OUTER:: 20:12
moritz_, cognominal: re irclog.perlgeek.de/perl6/2010-06-25#i_2479440, every non-parameterized block has an implicit <-> $_ = OUTER::<$_> (or some such), which may be optimized away when we know at compile time there is no argument.
moritz_ wow, you're really far behind on backlog :/ 20:13
TimToady alas 20:14
jnthn pmichaud: OK. I need a break, so going for a short walk. bbi15 or so.
pmichaud jnthn: wfm 20:15
TimToady I'm also bugged by the need for parens in 'for lines() {...}'
pmichaud branch is 'deref' when you get back.
TimToady if we made lines and words only work on strings, and defaulted slurp and cat instead
pmichaud we could bring back =<> :-)
TimToady then it'd be 'for cat.lines {...}'
and since lines would be a method, it wouldn't need () 20:16
slurp and cat would also be defined in Str to take a string as a filename 20:17
so "filename".cat or .slurp would work
pmichaud that feels weird, unless cat changed recently 20:18
TimToady there is no cat yet
20:18 ciphertext left
pmichaud S32 has one. 20:18
our Cat multi cat( **@list ) 20:19
TimToady hmm, so there is
20:19 meppl joined
lue ohai o/ 20:19
ingy greetings 20:20
moritz_ I also thought we were moving away from misguided Unix names
TimToady well, we need some kind of lazy slurp that returns a Cat object
.sip or some such 20:21
20:21 bjarneh left
lue what is this Cat object? 20:21
TimToady a lazy string, basically
20:21 bjarneh joined
TimToady at least until you ask it for .chars 20:21
we'll need a way to ask, "is this position at the end of the string" without actually requesting the string length 20:22
pmichaud jnthn: found quite a few more clues -- still looking.
20:23 clintongormley left
lue is $a[$x] == $a[*-1] ? (where $a is the string and $x is any number.) 20:23
pmichaud in some sense we almost want $*ARGFILES to be shorter.
so that one could do:
for @$*ARGFILES { ... } 20:24
without it looking so ugly. :-)
ingy is there a nicer test than `grep` to see if an elem is in an array?
TimToady $elem == any(@array)
pmichaud ingy: if any(@array) eq $elem
TimToady or ===, or eqv, or...
ingy grazi
pmichaud any(@array) ~~ $elem
(since grep does smartmatching as well) 20:25
20:26 ciphertext joined
TimToady but has lazy tendencies rather than parallel, short-circuit tendencies 20:26
ingy is going to ask for a code review after he finishes this testml-pm6 port 20:28
TimToady lue: um, no
ingy going pretty well, all considered though
pmichaud jnthn: okay, I think I found it.
it's indeed a problem with !dispatch_:: . 20:30
timbunce java uses multiple dispatch to select a constructor that matches the arguments to new() based on the number and type of positional arguments. Any issues with doing the same for perl6? 20:31
timbunce feels uncomfortable trying to interface two languages where I don't know either of them well!
lue ah well, worth a shot :) 20:32
pmichaud timbunce: works in perl 6, yes.
timbunce pmichaud: cool, thanks.
pmichaud timbunce: btw, rakudo now has --version
timbunce pmichaud: :)
pmichaud text improvement suggestions welcomed.
pmichaud@plum:~/rakudo$ ./perl6 --version
This is Rakudo Perl 6, version 2010.06-174-g979a34a
Copyright 2008-2010, The Perl Foundation
for monthly releases, the version number is just "mmmm.yy" 20:33
for versions obtained via git checkout, you get the git-describe value.
ash_ timbunce: java doesn't do multi-dispatch, btw. It does method selection at compile time so its just overloading, not multi-dispatch
timbunce ash_: thanks, my terminology is all over the place. I'm mapping the overloading to perl6 multi-dispatch. 20:35
ash_ they are similar, but multi-dispatch happens at runtime not compile-time
ingy hi timbunce 20:37
timbunce I've forgotten which pastebin the channel uses (it's not in the header shown by my irc client) 20:38
timbunce waves at ingy
ingy :)
pmichaud timbunce: I don't think any of them automatically post to the channel.
TimToady though I suppose $string.substr($pos,1) would be "" if $pos were at the end of the cat string
so maybe we don't need a special method
pmichaud so, any pastebin you prefer is fine.
timbunce Here's an example of what java2perl6 produces at the moment: paste.scsys.co.uk/46360 comments welcome. (The particular class shown isn't relevant, I just happen to be using this one as it has lots of constructors.) 20:40
moritz_ those should be all 'multi method new(...)' 20:41
timbunce moritz_: ah, good, my first bug report :)
moritz_ timbunce: already reported 20:45
and there are tests for it too
lue About ::= "This does the same as :=, then marks any destination parameters as readonly". What are destination parameters here? 20:46
ingy can someone explain this to me please: nopaste.snit.ch/21815
pmichaud lue: targets
moritz_ if you want runnable code, substitute all the non-resolved java::bla type names with Any
pmichaud lue: it makes the lhs non-rebindable.
20:47 _mpu left
lue ah, I thought so. destination parameters made me think there was something in one of the variables :) 20:47
ash_ $a ::= $b; $a ::= $c # fails on the ::= $c, right? 20:48
pmichaud ash_: iiuc, yes.
20:48 sawyer_ left
ingy why doesn't $p bind to an elem of $pp? 20:48
20:48 sawyer_ joined
lue but ($a is rw) ::= $b; $a ::= $c would work, according to spec (?) 20:48
timbunce moritz_: there's a type-mapping mechanism so you can control the mapping on a per-project basis. Unmapped types get recursed into (by default) so a whole tree of .pm6 files get generated.
20:49 _mpu joined
ash_ ($a is rw) ::= $b; seems like it should fail, IMO, since they mean two different things, either that, or after the ::= is applied $a should be changed to readonly 20:51
lue "…any destination parameters as readonly (unless the individual parameter overrides this with either the rw trait or the copy trait)" 20:52
jnthn pmichaud: back 20:53
pmichaud: ah, found it?
lue std: my $a = 3; my $b = 2; my $c ::= $a; my $c ::= $b; 20:55
p6eval std 31554: OUTPUT«Potential difficulties:␤ Useless redeclaration of variable $c (see line 1) at /tmp/bjw_0NdTqZ line 1:␤------> y $a = 3; my $b = 2; my $c ::= $a; my $c⏏ ::= $b;␤ok 00:01 113m␤»
lue std: my $a = 3; my $b = 2; my $c ::= $a; $c ::= $b;
p6eval std 31554: OUTPUT«ok 00:01 110m␤»
lue O.o
lue thinks he found a STD bug (unless catching that is not STD's job) 20:56
pmichaud STD just checks syntax, I believe. 20:57
lue so STD won't help in finding out if ($a is rw) or ($a is copy) overrides the ro part of ::= 20:58
pmichaud in general I'm not sure it can, since ::= can be a runtime operation 20:59
lue the spec seems to say it has to ...
ah well, let's see if I can implement ::= ! 21:04
21:04 alexbobP left
pmichaud do you still have the := patch somewhere that I can review? 21:04
lue ah, lemme update the nopaste. 21:05
21:06 tadzik left 21:12 timbunce left, tri1 left
ingy if I have $module, $class and $method string variables, how can I load $module, lookup $method and call it (if it exists) on $class? 21:12
I think I got most of it, except the call part 21:14
jnthn you can do e.g. $obj."$method_name"() for that part
ash_ isn't it like ::<$module> to get the module? 21:15
lue pmichaud: gist.github.com/463775
(gah, I hate my computer. What should have taken 2 minutes took me 10 *sob*) 21:16
21:16 timbunce joined 21:17 Ross left
eiro 21:18
lue how do I revert one file that keeps me from merging (don't need the changes) ?
.u
phenny U+0006 (No name found)
pmichaud lue: git checkout file 21:19
works for me
ash_ .u comet
phenny U+2604 COMET (☄)
pmichaud .u snowman
phenny U+2603 SNOWMAN (☃)
ash_ .u dice 21:20
phenny ash_: Sorry, no results for 'dice'.
ash_ hmmm wonder how you get the die faces
lue .u die
phenny U+2680 DIE FACE-1 (⚀)
ash_ .u die face-2
phenny U+2681 DIE FACE-2 (⚁)
jnthn .u live
phenny jnthn: Sorry, no results for 'live'.
pmichaud .u fail 21:21
jnthn aw
phenny pmichaud: Sorry, no results for 'fail'.
lue is still hunting for the blue box unicode character :)
ash_ wrong meaning of die :P
pmichaud jnthn: okay, I figured out the problem I think.
jnthn OK?
pmichaud: What was it, ooc?
pmichaud I have to make sure that the thing I pass to Regex::Match::hash is dereferenced 21:22
jnthn Aha
ash_ rakudo: my $a = 'a b c'; $a.::Str::say
p6eval rakudo 1e7012: OUTPUT«a b c␤»
pmichaud but this points out a possible flaw in the "object" test
ash_ ingy: you can use that too, it seems
pmichaud because Regex::Match is an Object, but it's derived from Capture
jnthn Ah
ash_ ingy: $obj.::$module::$method 21:23
jnthn But that shouldn't really end up being an issue, I thought. :S
sorear TimToady: Unfortunate collision in terminology. In that line I was speaking of protosubs by analogy to protopads, nothing to do with MMD
jnthn Since at the end of the day that's really delegation-y
pmichaud it does here.
because we end up calling Capture.hash on the Regex::Match object
and .hash is still a PCCMETHOD
jnthn Ah
OK
ingy this worked: $class.can($method_name)($class); 21:24
this failed: $class.$method_name();
jnthn ingy: I said $class."$method_name"()
pmichaud so, testing the type of the PMC only helps with objectrefs to PMCs. It doesn't help with objectrefs to subclasses of PMCs
(quotes needed)
ingy ?! 21:25
jnthn ingy: Without the quotes it means "I have a code object"
pmichaud $class.$method() is different from $class."$method"()
the first attempts to apply $method to $class
the second looks up a method named "$method" in the class and invokes that
ingy I save all these crazy chatlogs. Someday I'll write a book. 21:26
or maybe a chapter in yours :P
pmichaud jnthn: anyway, I'm not sure the type test is going to work out 21:27
jnthn pmichaud: *sigh* what a pita
pmichaud it's okay as long as we don't have any PCCMETHODS on subclasses that we want to invoke
21:27 timbunce left
jnthn Well, guess you can check if there's any PMC parents too. 21:28
See class.pmc - if it wasn't changed there's a PMC flag that you can test to tell you 21:29
(no need to consider MRO, just chase the Object PMC's pointer to the Class PMC and a flag check)
It's a couple of pointer derefs and a bitwise op, which in the current slow grand scheme of things is a drop in the ocean. 21:30
lue MRO?
jnthn Method Resolution Order
Basically, a list of classes in the order we search them for methods
In single inheritance situation, just a list of the parent classes from most to least derived 21:31
In multiple inheritance, life is complicated :-)
But look up C3 for the usually preferred solution.
pmichaud jnthn: I don't see a flag in class.pmc that would tell us what we want. 21:33
jnthn pmichaud: look for alien, iirc
CLASS_has_alien_parents_SET(SELF);
if (class_check->vtable->base_type != enum_class_Class) {
/* Found one; that's enough. */ 21:34
CLASS_has_alien_parents_SET(SELF);
break;
}
pmichaud okay
lue
.oO(good thing it's not the '50s anymore ;) )
pmichaud ah, I was looking for "flag"
jnthn How...sensible. ;-) 21:35
21:36 ruoso left
ash_ alien's r in mah codez 21:38
jnthn ash_: Back then the idea was to have various interoperable "class universes", so languages could have their own class systems, and they'd just delegate when they hit the boundary. 21:39
lue Latest rakudo broke Test.pir somehow, causing not a single test to go ok. There is a new parrot though...
or rather, I upgraded parrot.
ash_ jnthn: makes sense, just an amusing name for it 21:40
jnthn ash_: Well, if it comes from another universe... ;-) 21:41
ash_ :P yes, it does seem to do that
lue any reason why my Test.pir could be completely broken? 21:42
pmichaud lue: I'm testing locally. 21:46
lue it could be something I did, though. 21:51
pmichaud lue: builds fine here, with PARROT_REVISION 21:54
trying again with parrot HEAD 21:55
lue the binding works fine in interactive mode, it's just the tests are failing. every. single. one. Running a test by itself revealed a major PIR error. 21:56
pmichaud afk for a bit 22:00
jnthn: ping 22:02
lue here's the PIR error I get, IIUC: gist.github.com/464732 22:03
pmichaud jnthn: unping (nm, I figured it out)
22:03 masonkramer left, masonkramer joined
jnthn pmichaud: ok :-) 22:03
pmichaud actually, re-ping :) 22:04
jnthn :-)
.oO( do I pong or wait for the re-unping? :-) )
pmichaud actually, un-ping
:)
I'm playing with the notion that we could somehow make our find_method a lot smarter than it is now.
but it's not worth pursuing yet.
lue [ jnthn: just send a waiting pong :) ]
jnthn OK 22:05
Oh, in p6opaque?
pmichaud (smarter about dealing with PMC types)
jnthn Yes, we could :-)
...?
pmichaud not just in p6opaque, but also in objectref
jnthn ok
pmichaud i.e., if find_method on an objectref determines that it's a PCC method, then do something useful at that point.
(where I'm not yet certain what "something useful" might be) 22:06
jnthn Me either ;-) 22:07
pmichaud but that generally is where we get into trouble.
if we could solve that, I think we could eliminate our need for descalarref on invocants altogether 22:08
jnthn Well
you could go and mess with the current contents of the current call signature ;-) 22:09
22:09 ive left
pmichaud at the point of the find_method, we're not in a call yet, are we? 22:09
jnthn No
We're finding the thing to call
pmichaud right
jnthn The args may well not have been set up though
Though I think they have
Oh, in fact I'm quite sure they have
We rely on that elsewhere
pmichaud I thought the find_method was done before the invocation 22:10
jnthn It is
pmichaud (or the call sig setup)
jnthn It isn't
set up call sig
find_method
invoke result
pmichaud oh!
is that newish?
like, since the pcc refactors?
jnthn I thought it was always that way?
pmichaud I always thought it was
jnthn Well actually
pmichaud $P0 = find_method invocant, 'method'
jnthn there is one op
callmethod
pmichaud $P0(invocant ... )
jnthn Which calls the find_method vtable and then invokes the result 22:11
pmichaud right
jnthn But that happens in one Parrot op
pmichaud and I thought the callsig was done as part of "invoke the result"
jnthn So the op that sets up the callsig must come before that.
pmichaud looks
22:11 _mpu left
pmichaud 0000 new P0, PC9 P0=PMCNULL PC9=Key=PMC(0x20b60f0) 22:12
0003 set_args PC2 (3), P0, "/dev/null", "r"PC2=FixedIntegerArray=PMC(0x20b60b0) P0=FileHandle=PMC(0x2072190) 22:13
0008 callmethodcc P0, "open" P0=FileHandle=PMC(0x2072190)
You're right!
oh, but not quite
find_method is the first thing done in the callmethodcc op
which is before the callsig setup
oh well. I'll have to keep thinking about "something useful" 22:15
anyway, I think I have the new branch working now. All spectests pass -- now just merging to trunk and retesting for safety. 22:17
afk for a bit
jnthn pmichaud: ...before the callsig setup? 22:21
I thought set_args did that? 22:22
ingy just spent 30+ mins debugging something and has a question... 22:26
lue I'm an idiot. I forgot to run `make install' :)
that's why Test.pir failed. *embarrased smile* 22:27
ingy I used module Xxx (containing a class Xxx). when I say my $class = eval('Xxx'); and then if ($class) { ... }; the 'if' is not true 22:28
even though I'm pretty sure $class contains a class object 22:29
~$class eq 'Xxx()'
jnthn ingy: Type objects are always undefined
ingy: And truth defaults to definedness
rakudo: if Int { say "oops" } 22:30
p6eval rakudo 1e7012: ( no output )
lue
.oO(Oi, ::= isn't even in the setting, and there's a panic coded in its definition in Grammar.pm!)
ash_ jnthn: is there something you can compare it to to see if its a class?
ingy does that make sense?
lue rakudo: if Int ~~ Perl6MultiSub { say "hrm" } 22:31
p6eval rakudo 1e7012: OUTPUT«===SORRY!===␤Missing block at line 11, near ""␤»
jnthn lue: Multi
ingy maybe a better question is how do I introspect modules (for things like classes)?
lue ah.
jnthn ash_: Not really
lue goes and implements ::=
ingy I hate being a newb 22:32
jnthn Looking at the metaclass is more useful probably
rakudo: say Int.HOW ~~ ClassHOW
p6eval rakudo 1e7012: OUTPUT«1␤»
ingy but at least I'm a newb with an agenda :D
ash_ rakudo: role Foo { }; say Foo ~~ Role
p6eval rakudo 1e7012: OUTPUT«1␤»
jnthn ingy: Introspection is done by looking at the metaclass
ash_ would be cool if there was a Class like there is Role
ingy :)
22:33 lest_away is now known as lestrrat
lestrrat ping: TimToady 22:34
jnthn rakudo: class Foo { method lol { } }; say Foo.^methods(:local)
p6eval rakudo 1e7012: OUTPUT«lol␤» 22:35
ash_ rakudo: module Foo { }; say Foo.HOW.WHAT 22:36
p6eval rakudo 1e7012: OUTPUT«Method 'HOW' not found for non-object␤ in main program body at line 11:/tmp/yPMMlA5L49␤»
ash_ no module how then?
pmichaud jnthn: in callmethodcc opcode:
if (!PMC_IS_NULL(signature))
Parrot_pcc_set_object(interp, signature, object);
cognominal when deriving a grammar, how to supress or redefine operators?
pmichaud so, I guess if signature is already set up....
lue ingy: I'm still a newb, and I know what that's like :)
cognominal ... or change their precedence.
pmichaud afk a bit longer 22:37
lue [it would help if an API/Design Document/etc. existed for rakudo :)]
ingy lue: :) 22:38
jnthn cognominal: I guess defining a new proto would do that 22:39
cognominal I did not try... just reading specs.
ash_ cognominal: if its a completely custom grammar you'd have to make your own precedence mechanism, i think... 22:41
lue what would happen in this: my $a = 2; my ($b is rw); $b ::= $a; 22:42
would ::= still make $b made ro?
dalek kudo: 979a34a | pmichaud++ | src/ (3 files):
Don't de-reference invocants for Rakudo (non-core-PMC) objects.
kudo: ef66ac3 | pmichaud++ | src/core/Match.pm:
Get Match objects to work with objectrefs in methods.
kudo: 22d0c39 | pmichaud++ | src/ (4 files):
Merge branch 'deref'
cognominal I was (idly) thinking of deriving a shellish grammar from Perl 6, with conventions to switch back to regular Perl 6 in subexpressions. 22:43
ash_ if its the perl6 grammar, you can do (like): sub postfix:<!> ($x) is equiv(&postfix:<++>) { ... } to make a new postfix ! with the same precedence as ++
lue std: my $a = 2; my ($b is rw); $b ::= $a;
p6eval std 31554: OUTPUT«ok 00:01 115m␤»
lue would $b here stays rw afterwards, or be overriden into ro? 22:44
ash_ std: sub postfix:<!> ($x) is equiv<++> { ... }
p6eval std 31554: OUTPUT«ok 00:01 112m␤»
ash_ std: my $a; $a is rw; $a is readonly;
p6eval std 31554: OUTPUT«===SORRY!===␤Two terms in a row at /tmp/AlJJkNWBi5 line 1:␤------> my $a; $a ⏏is rw; $a is readonly;␤ expecting any of:␤ bracketed infix␤ infix or meta-infix␤ statement modifier loop␤Parse failed␤FAILED 00:01 111m␤»
ash_ i guess you can't change read/write-ness after the declaration? 22:45
lue rakudo: my $a; $a is rw;
p6eval rakudo 1e7012: OUTPUT«===SORRY!===␤Confused at line 11, near "$a is rw;"␤»
lue rakudo: my $a is rw; $a is readonly;
p6eval rakudo 1e7012: OUTPUT«===SORRY!===␤Confused at line 11, near "$a is read"␤» 22:46
jnthn Can only apply the traits in a decl
ash_ does ::= imply a trait?
(readonly)
lue but would explicitly defining rw cause ::= to set or not set ro? 22:47
22:47 dakkar left
lue Consider this case: my $a = 2; my ($b is rw); $b ::= $a; 22:47
could I do $b ::= $c afterwards?
jnthn I would expect not
lue yeah, me too. That makes coding it much easier :P 22:48
jnthn Otherwise ::= is rather less useful as a compiler hint.
lue what I'm doing (out of laziness), is using := binding, and then setting ro. Is there anything wrong with that? 22:50
jnthn I don't think setting ro would do it 22:51
It's more about not having rw set
ash_ in S03, when it talks about ::= it says: " Note that the semantics of ::= are virtually identical to the normal binding of arguments to formal subroutine parameters (which also default to readonly)." So i'd just copy how parameters do it
pmichaud rakudo takes the position that only those things explicitly marked "rw" are writable. Everything else is considered readonly and immutable. 22:52
I'm fairly certain that's the safer approach.
lue so, set ro, or leave it alone? 22:53
pmichaud ah, yes, for containers and binding semantics, I've been of the opposite opinion. A container is assumed rebindable unless marked otherwise.
jnthn: btw, I'm wondering if we could get a bit of a win in bind.c if we deobjectref values before binding them to readonly parameters 22:54
but now that I think about it, I'm guessing there might be a case where it doesn't work. 22:55
lue so either pir::setprop to set ro, or pir::delprop to remove rw. 22:56
ash_ if the container is rw then ::= seems like it should be the same as :=
lue (you're making me think rakudo operates on quantum mechanics!)
pmichaud at one point not too long ago TimToady++ mentioned that he thought that ro parameters should still be rebindable.
perhaps that's changed, but when I specifically asked about it, he said it looked okay. 22:57
ash_ so... := and ::= are the same then?
pmichaud no
lue thereby eliminating ::=, right?
pmichaud thereby meaning that ::= is not the same as parameter binding
ash_ ah, got ya
pmichaud since something bound with ::= is not rebindable.
lue should it be ro or !rw then? 22:58
pmichaud we should probably ask for an update first.
or at least a confirmation of parameter rebindability
because that will likely decide which to use.
(being that parameter bindings happen far more frequently than either := or ::=) 22:59
lue
.oO(maybe invent rb and nrb traits. [JOKE])
23:00
lemme guess, in Rakudo, readonly is not the same as !rw. 23:01
pmichaud it is, at present.
if it's not rw, it's readonly.
but that's for the container itself, not the binding of the container to a symbol
in some sense the two attributes are orthogonal. one can have a readonly container that can be rebound, or a read/write container that cannot be rebound 23:02
lue maybe we need to differentiate between readonly and immutable, if it has to be.
pmichaud we need to keep in mind that there's readonly for assignment, and readonly for binding, and they aren't necessarily the same property.
or even directly related. 23:03
(TimToady++ of course may say I'm wrong about this, but so far I don't see a required relationship)
lue then maybe make it easier to differentiate the two. 23:04
lue goes and undoes his (very little) work on ::=, considering a good solution won't come soon. :) 23:05
23:09 lestrrat is now known as lest_away
sorear pmichaud: I've already decided that parameters cannot be rebound 23:12
if ::= creates a rebindable binding, then it's useless for TimToady's use cases
pmichaud sorear: both of those are opposite from what I understand 23:13
::= creates a non-rebindable binding 23:14
and parameters can be rebound
that's the last I heard.
lue ($a is rw) ::= $b should leave $a rebindable, if I read the spec correctly.
pmichaud lue: that really makes no sense to me at all. what part of the spec are you looking at?
lue S03, on ::= 23:15
ash_ S03 says that
"This does the same as :=, then marks any destination parameters as readonly (unless the individual parameter overrides this with either the rw trait or the copy trait)."
sorear pmichaud: ::= creates a non-rebindable binding. it has to, and I didn't contradict this 23:16
pmichaud right
you said "if ::= creates a rebindable binding..." I never suggested otherwise.
I never suggested that it did.
sorear I have a habit of speaking in impossibilities. It confuses people a lot. :( 23:17
pmichaud ash_: okay, re-reading S03, I see it differently.
lue I think that ::= binding w/ two Mu's would make a nonrebindable binding, no matter what. 23:18
pmichaud ::= *is* the same as parameter binding. It binds a variable and removes its rw trait, unless the container being bound explicitly had "is rw" set.
and containers may always be rebound -- there's nothing to prevent rebinding.
lue so, would ($a is rw) ::= $b be the same as $a is rw; $a ::= $b ? 23:19
pmichaud lue: well, "is rw" is applied at declaration time, iiuc. 23:20
so it would have to be (my $a is rw) ::= $b;
which would be the same as my $a is rw; $a ::= $b;
23:20 rgrau_ joined
lue yes, of course. I keep leaving those off. 23:20
pmichaud but that's a guess at the moment.
anyway, rereading S03 now I see that ::= talks about the rw-ness of the container, not of the symbol binding. Sorry for leading folks down a false trail. 23:21
lue Which would mean all of the multi subs for ::= would have to check for an explicitly set rw/copy . (not a difficult thing by any means, so that's not a complaint.)
then, would I pir::setprop for rw or pir::delprop for readonly? 23:24
gah! pir::setprop for *readonly*, and vice versa.
pmichaud pir::delprop, likely.
i.e., you remove any rw property on the container.
lue alright, I'll go try that. 23:25
would a getprop for rw return null if it were not explicitly set? 23:28
23:28 skangas left
pmichaud yes, that's currently what we primarily check for. 23:29
lue I would also have to check for the copy property, see if that's null (I'm assuming) 23:30
pmichaud we don't normally put 'copy' on containers at the moment. 23:31
lue ah. so don't bother checking for it?
pmichaud we may have to, but presently it's not there.
right now the only properties that need checking are 'scalar' and 'rw', I think.
(at least as far as what other parts of Rakudo have available) 23:32
lue hm, not sure what to do with the result of a scalar check.
pmichaud if scalar is set, you may need to itemize the source. 23:33
not sure about that one yet either.
lue I think I'll just check for rw then, for now.
pmichaud small steps are often good. :) 23:34
lue just to be sure, this check if rw is _not_ explicitly set: pir::isnull(pir::getprop__PsP('rw', $target)) 23:37
pmichaud it checks that the container is currently not rw, yes.
lue and then I delprop the rw property, correct? 23:38
pmichaud correct.
but you can delprop without having to check, too.
it doesn't hurt to delprop a non-existent property.
(at least it shouldn't) 23:39
lue what if rw is explicitly set, though? then according to the spec, it should stay rw.
pmichaud we don't have a way of handling that yet.
at the moment we don't mark containers with explicitly set "is rw" 23:40
23:40 ashleydev left
pmichaud other than to mark them "rw" 23:40
lue alright, so the conditional doesn't matter at all right now.
pmichaud correct.
lue
.oO(We keep coding 'till we stop knowing!)
23:45
ingy ZOMG!!!!!!!!!! PERL 6 CAN HAS TESTML!!!!!!!!!!!! 23:47
nopaste.snit.ch/21819
It frickin works!
lue and after Proxy goes away, I can haz NES emulatr in P6!
ingy where do I upload this thing??!!
:)
lue what's the purpose of Proxy anyway? 23:48
pmichaud lue: Proxy handles the case of my @a; @a[4] = 5;
what does @a[4] return?
it has to be something that when assigned to will also do the binding in @a
jnthn ingy: :D
pmichaud (this is all about to disappear in about an hour, fwiw)
ingy pmichaud: Perl 6?
:'( 23:49
pmichaud Proxy
ingy :)
jnthn lol
ingy: To get it on modules.perl6.org, normal way is to put it in a github repo (or gitorious) and then get it entered into github.com/masak/proto/blob/pls/poc...jects.list
ingy now I can port JSYNC (with its TestML tests) to P6.
lue because right now: 23:50
ingy jnthn: github.com/ingydotnet/testml-pm6
ingy pushes
sorear jnthn: Can you explain to me how lexical classes work in Rqakudo? 23:51
lue my @b = (0,1,2); @b[3] := @b[0]; say @b.perl returns (0,1,2)
jnthn sorear: Given what TimToady mumbled about them being made once at BEGIN time the other day, I suspect "wrongly" :-/
sorear lue: @b[3] returns my $x := @b[3]; $x;
lue what's the correct way to call pir::delprop? pir::delprop__Ps didn't work.
sorear __vPs 23:52
or just pir::delprop
jnthn sorear: Essentially they work just the same as building an anonymous class and then installing it in the lexpad though.
lue ah, dankon sorear.
sorear pmichaud *hates* people who use signatures needlessly
jnthn pmichaud hates me? :-D
ingy jnthn: pushed. 23:53
jnthn <- worst offender ;-)
lue last time I checked, just pir::delprop fails (it's been a while though)
ingy summons masak
jnthn rakudo: my @c; for 1..5 -> $x { my class foo { method m { $x } }; @c.push(foo); }; @c>>.m>>.say; 23:54
p6eval rakudo 1e7012: OUTPUT«5␤5␤5␤5␤5␤»
jnthn Meh.
23:55 Psyche^ joined
jnthn Though 23:55
rakudo: my @c; for 1..5 -> $x { my class foo { method m { $x } }; @c.push(foo); }; say @c[0] === @c[0] # sanity
p6eval rakudo 1e7012: OUTPUT«1␤»
jnthn rakudo: my @c; for 1..5 -> $x { my class foo { method m { $x } }; @c.push(foo); }; say @c[0] === @c[1] # insanity? ;-)
p6eval rakudo 1e7012: OUTPUT«0␤»
jnthn iiuTTc, that shoulda said 1 as well and the "all fives" would be right 23:56
I'm not too sure if that's a good thing though.
ingy should I bother masak with a pull request?
jnthn ingy: no, just phenny: tell masak ... him
imo
ingy :)
jnthn
.oO( tomorrow, see masak tell me off for not suggesting the pull request! )
lue 'cause unless proxy goes away, I'd have to define a 0x10000 size array first, just to bind things o.O 23:57
ingy phenny: tell masak Please register github.com/ingydotnet/testml-pm6 23:58
phenny ingy: I'll pass that on when masak is around.
lue rakudo: say "for those who can't count in hex, 0x10000 is {:16<0x10000>} in decimal";
p6eval rakudo 1e7012: OUTPUT«for those who can't count in hex, 0x10000 is 65536 in decimal␤»
23:59 Patterner left, Psyche^ is now known as Patterner