»ö« | Temporary spam alert: Please register your nick to speak in chan or /msg an op for +v | perl6.org/ | nopaste: paste.lisp.org/new/perl6 | evalbot usage: 'perl6: say 3;' or rakudo: / pugs: / std: , or /msg p6eval perl6: ... | irclog: irc.pugscode.org/ | UTF-8 is our friend!
Set by sjohnson on 22 January 2010.
00:00 simcop2387 left, simcop2387 joined 00:14 jferrero joined 00:26 ihrd joined, rgrau` left 00:27 ihrd left
colomon japhb: no naming conventions for modules yet that I'm aware of. 00:29
00:34 lumi left, lumi joined
japhb I was thinking either Algorithm::Name or Algorithm::Problem::Name, so in this case: Algorithm::MiniSat, Algorithm::SAT::MiniSat, or Algorithm::Satisfiability::MiniSAT. The latter construction would work well if there was a parallel space for specialty data structures, such as Structure::BalancedTree::RedBlack or Structure::BVH::Octree. 00:35
00:36 payload joined 00:39 pmurias left 00:41 ericholscher joined, ericholscher left 01:01 meppl joined, lestrrat is now known as lest_away 01:03 mssm left 01:05 lumi left 01:07 ashizawa joined, lumi joined 01:16 justatheory left 01:23 bpa joined
japhb phenny, tell pmichaud Now that we're both back ... we had discussed a couple months ago moving gitorious.org/parrot-plumage/parrot...b/Util.nqp into NQP-rx, possibly with a name change to NQP::Util or somesuch, but that you wanted to think about the details. What are your current thoughts on this? 01:25
phenny japhb: I'll pass that on when pmichaud is around.
01:29 niros left 01:31 lest_away is now known as lestrrat 01:34 drbean joined 01:36 jferrero left 01:47 araujo left 01:51 Chillance left 01:54 TiMBuS joined, bpa left 01:55 popo joined 01:56 popo left 02:01 lumi left, lumi joined 02:06 justatheory joined 02:08 orafu left 02:09 orafu joined 02:12 hitsubunnu joined 02:13 hitsubunnu left 02:14 am0c joined 02:15 am0c left 02:16 FCO left 02:36 orafu left, orafu joined 02:37 issacclee joined, meppl left 02:39 issacclee left
japhb phenny, tell masak What is the current status of proto's installed-modules branch? 03:27
phenny japhb: I'll pass that on when masak is around.
japhb carlins?
What is Carlin Bingham's nick here? He appears to be the most recent proto committer .... 03:29
03:31 agentzh joined 03:35 araujo joined 03:38 cotto left
colomon japhb: I think just carlin. 03:39
I don't think installed-modules is ready for prime-time yet.
japhb *sigh* 03:40
colomon yeah.
japhb I just want to see it merged, so I can reasonably import it into Plumage.
colomon I want to see it working, because I think it would be a huge help getting ng moved over to master smoothly. 03:41
japhb phenny, tell carlin What is the current status of proto's installed-modules branch? You appear to be the only committer of late ...
phenny japhb: I'll pass that on when carlin is around.
japhb colomon, nodnod. Speaking of which, what's the ng status?
03:52 cotto joined
colomon japhb: goal is to switch ng to master this Thursday, with a target of passing about 75% as many tests. 03:58
my gut feeling is it takes another week to reach that. 03:59
things have gotten fouled up a bit because we keep refining how to handle lazy lists.
(the list concept underwent significant revision this week in the spec as a result.)
still, I think it will be exciting to watch all the check-ins to the ng branch this week -- I expect a lot of progress very quickly. 04:08
afk (off to bed) 04:09
japhb colomon, thanks for the info 04:17
04:25 ooops joined, ooops left 04:53 redicaps joined 04:54 nihiliad left 05:24 diakopter sets mode: -R 05:28 diakopter sets mode: +oo japhb Tene 05:30 d4l3k_ left, dalek joined 05:31 diakopter sets mode: +v dalek
diakopter every time I port Sprixel back and forth from/to JS to/from C#, it improves. "I am not making this up." 05:42
06:14 agentzh left 06:28 pnate left 06:30 pnate joined 06:40 redicaps left, redicaps joined 06:56 gfx joined 06:57 pnate2 joined 07:07 Lorn left 07:09 pnate left 07:10 pnate joined 07:14 kaare joined, justatheory left 07:15 pnate2 left, kaare is now known as Guest34084 07:21 Lorn joined 07:30 jferrero joined 07:33 Su-Shee joined
Su-Shee good morning 07:33
07:34 Baggiokwok joined 07:36 diakopter sets mode: +o Su-Shee
diakopter does anyone remember that tweet about the tweet that got erased from the web (including all caches)? I can't find it anywhere. 07:45
07:48 pnate2 joined
diakopter reminds me of that sci-fi book about a book that causes its readers to forget they read it. funny, I'd forgotten all about it. 07:49
07:58 he_ joined 08:00 jonasbn joined, pnate left 08:05 k23z__ joined
Su-Shee reminds me of the micro phage in the shockwave rider. ;) 08:08
diakopter Su-Shee: exactly! 08:11
08:11 iblechbot joined
Su-Shee which is one of the best scifi I've ever read. 08:12
08:16 pnate joined 08:17 mssm joined 08:20 meppl joined 08:21 gfx left 08:23 Baggiokwok left 08:29 pnate2 left
diakopter [More OT] 'Avatar = awesome. I wish the whole world was in 3D.' 08:37
08:37 cotto left 08:40 cognominal joined 08:41 blackbart joined, blackbart left 08:42 k23z__ left 08:48 cotto joined 08:52 Baggiokwok joined, TiMBuS left 08:53 kloeri__ left 09:00 cognominal left, cognominal joined, payload left 09:01 payload joined 09:02 pnate2 joined 09:05 pnate left 09:09 dakkar joined 09:16 cottoo joined 09:17 cotto left 09:27 ejs joined 09:47 xomas_ joined 10:09 redicaps left 10:11 xomas_ is now known as xomas 10:34 drbean left 10:39 Baggiokwok left 10:43 payload left
colomon diakopter: I got glasses for the first time two weeks ago. the effect on my vision is almost exactly like wearing 3D glasses to a movie. I had completely failed to notice that I wasn't seeing depth properly until I started seeing it again... 10:56
mathw weird 11:07
But I guess it was a bit like when my eyes started to go and I didn't realise that I was *supposed* to be able to see the writing on the blackboard 11:08
colomon I do feel like I perceive depth with the glasses still. 11:09
but when I put them on, everything becomes more delicate and I really see in 3D. 11:10
s/with/without/
it is weird, but cool
moritz_ good localtime 11:11
colomon morning! 11:12
11:12 lumi left, lumi joined
mathw colomon: at least there's an improvement to make it worth the effort :) 11:16
hi moritz_ 11:17
colomon mathw: definitely
moritz_ hi mathw - how are things?
mathw I'm bored out of my skull 11:27
waiting for a very large program to compile
and hoping I won't have the urge to throw the computer out of the window when I run it again
(segmentation faults are not a good way to start the week)
11:34 lestrrat is now known as lest_away 11:39 k23z__ joined 11:43 drbean joined 12:04 payload joined 12:05 k23z__ left 12:12 SmokeMachine joined 12:33 ashizawa left 12:34 Baggiokwok joined 12:35 bluescreen joined 12:48 k23z__ joined 12:57 lest_away is now known as lestrrat 13:00 patspam left 13:08 simcop2387 left 13:14 ruoso joined 13:19 lumi left 13:20 lumi joined 13:23 mariuz joined 13:27 JohnDoe365 joined 13:29 iblechbot left 13:33 simcop2387 joined 13:42 bluescreen left, bluescreen joined 13:43 payload left 13:44 payload joined 13:59 JohnDoe365 left 14:08 mariuz left
colomon moritz_: I'm thinking some of us should conspire to try to finish proto's useful branch in the next couple of days. 14:09
moritz_ colomon: some of us should, but currently I'm in a very unpleasant mixture of being either stressed out or offline (or both, sometimes) 14:10
colomon I'm sorry to here that. If there's anything we can do to help with the stress...
*hear 14:11
(gack, my spelling is awful today for some reason)
moritz_ nope
colomon I'm actually going to be offline most of the rest of the morning and at least part of the afternoon myself. Just hoping to get wheels moving... 14:13
14:17 Baggiokwok left 14:34 LaVolta left 14:47 drbean left 14:48 rgrau left
colomon okay, I pulled the latest installed-modules, and now I'm taking the boy to the library for storytime. 14:49
14:49 colomon left 14:51 ash_ joined, jonasbn left 14:54 xinming_ is now known as xinming 14:59 Guest34084 left 15:01 PacoLinux joined
ash_ in S07, it referrer to roles called like List::PushBack, does that seem odd to anyone else? I am referring to naming it List, since lists are generally assumed to be immutable why would a list be able to push back? 15:04
15:04 iblechbot joined
moritz_ seems odd, yes 15:05
15:08 jaldhar left 15:09 payload left, payload joined 15:11 lumi left
ash_ there is a List::Unshift too, so just 2 references to it, just thought i'd comment on that 15:11
15:11 lumi joined
mathw yes it does seem odd 15:16
ash_ ng: @*INC = 1, 2; 15:22
p6eval ng 7daa82: Cannot assign to readonly value␤current instr.: '&infix:<=>' pc 14470 (src/builtins/Junction.pir:113)␤
ash_ are globals not implemented in ng?
moritz_ ng: @*:INC.push: 3
p6eval ng 7daa82: Confused at line 1, near "@*:INC.pus"␤current instr.: 'perl6;HLL;Grammar;panic' pc 500 (src/stage0/HLL-s0.pir:328)␤
moritz_ ng: @*INC.push: 3
p6eval ng 7daa82: Method 'push' not found for invocant of class 'Undef'␤current instr.: '_block14' pc 29 (EVAL_1:0)␤
moritz_ could be 15:23
s/globals/contextuals/
ash_ S02: $*foo dynamically overridable global variable i thought the * twigil was 'global' ? 15:24
moritz_ thought we had no globals :-)
ash_ ah, i was worried something had changed in the spec and i had not even realized it 15:26
15:28 payload left 15:34 mberends joined
ash_ does anyone know off hand of a set of tests for twigils? 15:35
or is there a way i can verify that the * twigil is working properly?
pmichaud good morning, #perl 15:38
phenny pmichaud: 01:25Z <japhb> tell pmichaud Now that we're both back ... we had discussed a couple months ago moving gitorious.org/parrot-plumage/parrot...b/Util.nqp into NQP-rx, possibly with a name change to NQP::Util or somesuch, but that you wanted to think about the details. What are your current thoughts on this?
pmichaud er, #perl6
ash_ good morning pmichaud 15:40
moritz_ oh hai 15:42
15:44 payload joined, saschi left, Psyche^ joined 15:45 ejs left
jnthn morning, pmichaud 15:48
15:48 Patterner left, Psyche^ is now known as Patterner 15:51 ash_ left
mathw hello! 15:51
pmichaud I'm still searching for the magic constellation of relationships between iterators, arrays, and lists :-| 15:54
15:54 alester joined 15:55 jaldhar joined 15:56 jaldhar left, jaldhar joined 15:57 lumi left, lumi joined 15:58 jferrero left 16:00 jferrero joined 16:01 ejs joined
pmichaud how does an iterator signal "no more elements?" 16:10
diakopter return instead of yield? oh wait, that's IEnumerable
jnthn pmichaud: Nil last I checked... 16:12
pmichaud jnthn: how does one check to see if an iterator returned Nil, then ?
jnthn pmichaud: But it keeps changing.
pmichaud: Nil.ACCEPTS($ret_val) - but that's kinda uncheap...
pmichaud Nil isn't a type
jnthn So?
pmichaud so, what you wrote is the same as ().ACCEPTS($ret_val)
jnthn Nor is 42 but I can smart-match against that. :-)
What type of thingy is Nil?
I guessed an empty parcel.
pmichaud Nil is an empty Parcel
jnthn OK, so can an empty Parcel smart-match against another? 16:13
Oh wait...
...calling a method on a parcel forces it into item context.
Hm
pmichaud using a Parcel in item context converts it into a Seq
and I suspect an empty Seq should match like an empty array
jnthn Yeah 16:14
I mean, detecting if you have an empty parcel is possible by checking (a) is it a Parcel and (b) is it empty, but I'm not sure how that looks in Perl 6, since they tend to evaporate when touched.
16:15 nihiliad joined
pmichaud I have been thinking that perhaps method calls aren't sufficient to force a Parcel into item context 16:16
16:16 KyleHa joined
pmichaud i.e., that we could invoke methods on a Parcel without forcing it to be an item. That would be very helpful now -- especially for dealing with .Capture 16:17
(some methods would force the Parcel to become a Seq, but not all)
jnthn Use the Junction rule
"If the method ain't defined on Parcel itself, we make it a Seq"
(the junction one being "If the method ain't defined on Junction, we auto-thread" 16:18
pmichaud could do that, too. I suspect there aren't that many methods where it matters.
jnthn Right.
Could work. 16:19
PerlJam good morning #perl6
jnthn Let me know if you needs a dispatcher tweak.
pmichaud well, it could work, yes, but even at that Nil.ACCEPTS($ret_val) is really ugly/slow.
jnthn True. 16:20
pmichaud I think I would almost prefer an exception-based model in that case
jnthn I've preferred to avoid using Nil in-band to indicate this all along.
16:21 partisan left
pmichaud well, on thinking about it further, we probably have to be able to check for Nil anyway 16:22
because of the possibility of: sub foo(*args) { return; } 16:23
jnthn Yes, that is true.
isnil dynop. ;-)
pmichaud oh, could just have a .isnil method on Parcel 16:24
jnthn Well, that's cleaner, yes.
16:25 cdarroch joined
PerlJam you want to use Nil to signify that an iterator is "done"? 16:25
pmichaud PerlJam: I want to know (1) how an iterator signifies that it's done, and (2) how to detect when something returns Nil 16:26
PerlJam okay. Because I don't think that "returning Nil" can be the answer to (1)
pmichaud I'm fine with that -- thus my original question 16:27
16:08 <pmichaud> how does an iterator signal "no more elements?"
moritz_ TimToady and ruoso had some extensive dicussions about that
pmichaud moritz_: recently? 16:28
moritz_ but I don't remeber their outcome
pmichaud as in, within the last 3 days?
moritz_ pmichaud: no, more like a year ago
pmichaud moritz_: okay. The array/list/iterator spec was significantly redone over the weekend.
moritz_ and we didn't have a Nil back then 16:29
pmichaud hmmm. in general, "exception" means "return a failure" in p6
so perhaps we need a StopIteration role or something 16:31
or maybe IterationFailure 16:33
actually, thinking about it more, it's Seq (or the notion of immutable array/list) that seems to give me the most heartburn 16:38
16:40 payload left
pmichaud for example, if I have 16:40
16:40 payload joined
pmichaud my $b = 20; my $a = (1..5, $b); $b = 21; say $a.perl; # what gets output? 16:40
16:41 gabiruh joined
diakopter the C# compiler generates a state machine class (IEnumerable<EnumeratedType>), whose MoveNext method returns true until it is out of items; that generated MoveNext method wraps the user's generator code. 16:43
The generated class contains a IEnumerator<EnumeratedType> field that stores the last enumerated item, so when MoveNext returns true, the call puts the EnumeratedType in some out parameter somewhere, and it's returned 16:44
pmichaud diakopter: so, it basically has two parts -- "yes, I got another element", and "here is the element I got" 16:45
diakopter yes
pmichaud colomon++ was suggesting something along those lines
that could be made to work 16:47
16:47 SeaSalt45654322 joined
pmichaud I have to think a bit more about list/seq... talking a walk 16:48
diakopter walk your talk, too! :)
pmichaud *taking 16:49
:) 16:50
SeaSalt45654322 Hi all..can anyone recommend a good IDE to get started with perl 6? 16:51
moritz_ SeaSalt45654322: do you happen to like vim?
if yes: there's a Perl 6 plugin for vim. If not: padre.perlide.org/ 16:52
16:55 Salada345 joined
Salada345 moritz: thanks. I've never used it outside the linux shell...the ideal IDE for me would have a debugging feature that shows me my variable values after i run my scripts 16:56
moritz_ Salada345: that's an ability that a debugger has to provide, an IDE can only integrate that nicely with the editor 16:57
Salada345: and we don't have such a debugger yet :/
Salada345 mortiz_:gotcha...is that just for perl 6 or is it also the case for perl 5? 16:58
moritz_ Salada345: perl 5 has better debugger support 16:59
diakopter it's especially great on Windows using ActivePerl's Perl Dev Kit, whose debugger listener is compatible with both ActivePerl and Strawberry Perl.
Salada345 moritz_: Thank you for your help! I'll keep myself updated on VIM 17:00
diakopter , which facilitates step-through, breakpoints (conditional or not), step-out, etc
moritz_ goes offline, see you tomorrow 17:01
diakopter visually, I mean
moritz_: g'night
Salada345 diakopter: nice, that is exactly what i was looking for. 17:02
diakopter Perl Dev Kit costs money, though...
oh, I didn't realize they had it for all those other platforms too (Mac, Linux, Solaris, AIXppc) 17:03
Salada345 do you know any others that are comparable? but free? 17:04
diakopter yes 17:05
www.epic-ide.org
if you're accustomed to Eclipse
17:07 clintongormley joined 17:08 zloyrusskiy joined
diakopter a quick google search turns up others: perl-express.com, also ActiveState's Komodo Edit 17:08
commute& 17:10
17:11 payload left 17:12 saschi joined, SeaSalt45654322 left 17:16 Salada345 left 17:17 jaldhar left
pmichaud lunch 17:32
17:33 ejs left 17:36 FCO joined 17:50 supernovus joined 17:53 ejs joined 17:55 SmokeMachine left 17:56 stephenlb joined 18:01 lypanov joined, jettero joined
jettero what's going on with xs for perl6 so far? I was googling for things, but I keep finding really old stuff 18:02
seems like a hard problem since there's multiple implementations and things 18:03
supernovus when defining multi subs with different parameters, shouldn't (Num $a, Num $b) outweigh (Object $a, Object $b) ?? 18:10
18:10 dakkar left
TimToady supernovus: I would think so 18:11
jnthn Should do.
PerlJam jettero: there is no XS for perl6. See? Easy peasy :)
18:12 rgrau joined
TimToady XS is one of the p5 things that p6 thinks should get broken. so only a co-interpreter running perl5 will be able to support XS directly 18:12
unless someone resurrects ponie
supernovus Hmm, in rakudo trunk I have: multi sub infix:<should-be> (Num $a, Num $b) { ... } and multi sub infix:<should-be> (Object $a, Object $b) { ... } and if I do a "1 should-be 2" it dispatches to the Object one. If I comment out the Object one, it goes to the Num one. 18:13
TimToady smop might eventually make it easy to meld run-loops for p5 and p6
18:13 zloyrusskiy left, ShaneC1 joined
TimToady what happens if you change Object to Any? 18:14
18:14 meppel joined
TimToady (Object is going away in favor of Mu, btw) 18:15
18:15 ejs left
TimToady Any is more correct in any case, unless you want to allow junctions as arguments 18:15
18:19 ejs joined
diakopter Mu Cool Any -> Yo Am UNCOL 18:22
18:25 stephenlb left, simcop2387 left, jjore left, stepnem left, ingy left, Khisanth left, c9s__ left, _ilbot2 left, ssm left, cognominal left, hercynium left, tomaw__ left, eternaleye left, yahooooo left, nadim_ left, BinGOs left, kraih_sri left, lisppaste3 left, pmichaud left, pugs_svn left, sjohnson left, spinclad left, zorgnax left, awwaiid left, sunnavy left, gbacon left, sbp left
diakopter »ö« | perl6.org/ | nopaste: paste.lisp.org/new/perl6 | evalbot usage: 'perl6: say 3;' or rakudo: / pugs: / std: , or /msg p6eval perl6: ... | irclog: irc.pugscode.org/ | UTF-8 is our friend!
meppl left
supernovus Well, changing to Any as well as fixing a typo (duh!) fixed the dispatching problem :-) 18:26
TimToady rather than making Parcel respond to some methods and not to others, we might place parcel responses on the macro/nonmacro boundary with .WHAT etc 18:28
which means maybe there's .NIL and maybe .NOTNIL macros
maybe
(and I hope ng isn't still trying to treate .WHAT et al. as real method calls...) 18:29
*treat in modern english 18:30
PerlJam TimToady: and how does an Iterator signify that there are no more items to iterate? 18:31
(I would think that it would return Mu() or the appropriate "undef" thing)
TimToady that would still be Nil, as per current spec
Mu is not the absence of an object 18:32
Nil is
18:32 pmichaud joined, hercynium joined, tomaw__ joined, eternaleye joined, yahooooo joined, nadim_ joined, BinGOs joined, ssm joined, kraih_sri joined, lisppaste3 joined, awwaiid joined, sbp joined, zorgnax joined, spinclad joined, sjohnson joined, irc.freenode.net sets mode: +ovoo pmichaud lisppaste3 spinclad sjohnson, pugs_svn joined, gbacon joined, sunnavy joined, irc.freenode.net sets mode: +vo pugs_svn gbacon, ejs left
PerlJam When reading from a socket and there's nothing to read, do we get a Mu-thingy or a Nil ? the iterator isn't "done" because the socket is still open and available, but there's just no data. 18:33
18:33 Khisanth joined, stephenlb joined, simcop2387 joined, stepnem joined, jjore joined, ingy joined, _ilbot2 joined, c9s__ joined, irc.freenode.net sets mode: +ov Khisanth _ilbot2
PerlJam (assume a non-blocking read obviously) 18:33
pmichaud PerlJam: blocking read? 18:34
oh, non-blocking
I would expect we'd get some sort of failure object
TimToady sockets are a bit biased towards the exception model
pmichaud TimToady: did you see my earlier question asking "how does an iterator signal that it's done?" 18:35
TimToady did you see my response above?
pmichaud er, "how does it signal 'no more elements'?"
no
maybe it occurred during a netsplit or something...?
TimToady hmm 18:36
tkr PerlJam: .. Mu thingy? Is that like Maybe monad in haskell?
pmichaud goes to check irclog
TimToady missing there too
PerlJam pmichaud: ...
<@PerlJam> TimToady: and how does an Iterator signify that there are no more items to iterate? 18:37
<@TimToady> that would still be Nil, as per current spec
pmichaud If Nil, then how does one check that an iterator returned Nil ?
(or any other function, for that matter)
TimToady by current spec, iterators never return Nil
except to indicate the end 18:38
pmichaud right
so, how do we check that we reached the end?
TimToady @TimToady> rather than making Parcel respond to some methods and not to others, we might place parcel responses on the macro/nonmacro boundary with .WHAT etc
10:28 <@TimToady> which means maybe there's .NIL and maybe .NOTNIL macros
10:28 <@TimToady> maybe
tkr why cant iterators return Maybe, haskell style?
TimToady 10:29 <@TimToady> (and I hope ng isn't still trying to treate .WHAT et al. as real method calls...)
10:30 <@TimToady> *treat in modern english
tkr: all non-native types are Maybe in Perl 6 18:39
but we want to be able to return undefined values
up to and including Mu 18:40
tkr and what is the Just in perl 6?
TimToady subset types
tkr TimToady: return !!0 .. aka. false.
TimToady I don't follow you there. 18:41
tkr you can return undefined, defined, and defined but false. right? 18:42
I think Im too perl5.
TimToady well, !!0 would be true
sbp .NOTNOTNIL? 18:43
TimToady pmichaud: I could perhaps be argued into a NIL value that is always guaranteed to return Nil no matter how many times you try
esp if it goes with a .NIL macro
oh wait
that makes NIL() hard 18:44
well, makes NIL require parens, at least
pmichaud right now we have Nil
tkr TimToady: I dont follow you anymore. !!0 is false as against "0 but true"
18:45 cognominal joined
TimToady nevermind, not enough caffeine 18:45
!!0 is Bool::False, ye
yes even
truth is determined by whatever .Bool returns, which is what 'but' overrides 18:46
well, it'd have to be 'but True', since there's no lower-case truth in Perl anymore :)
pmichaud there is so :) 18:47
tkr so the iterator could return a Maybe, with Just or Nothing.
.. or the Haskell way. where is mauke?
18:49 ejs joined, colomon joined
TimToady or possibly we should divorce Nil from the concept of () a bit 18:52
such that return () returns an 'epsilon' that can be removed, while return Nil terminates by promising to always return ()
PerlJam interesting 18:53
18:53 _Jedai_ left
TimToady possibly Nil is the *undefined* Parcel 18:54
PerlJam then what's Parcel() ?
or are they just synonyms
tkr !!0 != () ... thats a fact.
18:55 _Jedai_ joined
tkr no. 0 = () # synonym 18:55
I think they did this silly thing with == vs === in php. which is similarly funny. 18:56
PerlJam tkr: but Perl 6's == vs === isn't funny? :)
TimToady ==== would be funny 18:57
<=> is funny if you've seen Star Wars
PerlJam TimToady: I guess that's why we don't have :::: instead of <cut>
tkr what wait. what does "===" do? :) 18:58
TimToady what it's supposed to do, we hope
tkr if (0 === !!0 and !!0 === ()) { # ? 18:59
pmichaud 0 === !!0 # false
TimToady that can't possibly be true, since === will never be true for two different types 19:00
pmichaud === checks type and value equivalence, iirc
diakopter my sardonicism detector must be broken
Su-Shee you guys make me afraid sometimes.
PerlJam Su-Shee: afraid of what?
pmichaud TimToady: the case I'm playing with atm is ($a, $b, 1..10, $c).map( { ... } ) 19:01
what's the invocant of .map ?
Su-Shee PerlJam: overall anxiety. deep german angst what you might invent out of a combination of =?!::= or something :)
TimToady pmichaud: looks like a Seq to me, currently
pmichaud TimToady: yes, but I don't want it to be a Seq, because I don't want to be preserving those 1..10 values as I process them 19:02
[particle]1 ==== is spacetime equivalence.
KyleHa =?!::= is the Su-Shee incremental anxiety operator.
19:02 [particle]1 is now known as [particle]
pmichaud I want it to be a List of some sort, where I can get the flattening characteristics of a list but without the "I remember all of the positionals" of Array or Seq 19:02
19:02 ejs left
Su-Shee it'll be like vim .. every typo will show a useful result. ;) 19:02
TimToady pmichaud: gotcha
19:03 Chillance joined
pmichaud so far I'm seeing a variety of cases... let me see if I can enumerate them (will do it in another window then paste results) 19:03
19:03 hercynium left
Su-Shee [particle]: how about ~~~~~ for biological/dna equivalent? can't think too soon about biocomputing. ;) 19:04
[particle] with perl 6, you can discover new species in one line of code! 19:05
Su-Shee well we have phasers, Mu and eigenstates - the bio realm is a little underrepresented ;) 19:07
tkr how woud you build as subroutine zipWith ($sub, \@x, \@y) in perl 6 without using the << = >> stuff . or how it was.
without the hyperoperators. from the basic building blocks? 19:08
19:08 ash_ joined, ash_ left
tkr I was bit surprised that I couldnt do it in perl5 without a loop. 19:08
is prober currying implemented? I could try some perl6 out on my free time. :) 19:09
19:12 ash_ joined
pmichaud TimToady: some of what I have so far: gist.github.com/286129 19:13
oh, and there's another case 19:15
(writing)
diakopter $r = 1..4, @a;
TimToady Useless use of @a in void context 19:16
diakopter o
pmichaud gist.github.com/286131 # updated with additional case 19:18
19:19 justatheory joined
ash_ is S07's reference to List::PushBack and List::Unshift correct? Should those be Array:: instead of List::? 19:20
pmichaud ash_: that's what we're trying to work out now, I think :)
ash_ ah, okay, cool 19:21
pmichaud and S07 has been conjectural anyway, as opposed to being blessed (in the sense that implementations have agreed to it)
ash_ hence the [DRAFT] mark on it still? 19:22
as apposed to say S06 that doesn't have [DRAFT] anymore
TimToady I don't think we can simply say that iterators with pushback/workahead are just Arrays
Arrays don't directly provide the iterator interface 19:23
pmichaud I've been wondering if they should
tkr might I ask why on earth "() === 0" instead of "() == !!0" ? 19:24
ash_ but, calling them a List seemed confusing to me, since List's are immutable...
pmichaud ash_: I think we have to kind of "forget what we thought was true" and restart from first principles
tkr: () === 0 # false
tkr pmichaud: so should be !!0 == () 19:25
pmichaud tkr: at the moment, that would raise a "use of undefined value" exception
because () is Mu which is undefined
tkr undef != !!0 19:26
TimToady () isn't Mu
pmichaud () is Nil
which becomes Mu in item context, yes?
TimToady yes 19:27
pmichaud and == imposes (numeric) item context on its values
tkr ahh. so () could me a "Maybe" with values of !!0 or undef
s/me a/be a/
pmichaud I should've said "because 'item ()' is Mu which is undefined", then
tkr do you use !!0 = 19:28
?
TimToady why do you keep talking about !!0 ?
tkr it's a very good false.
pmichaud tkr: !!0 is just False
ng: say (!!0).WHAT 19:29
p6eval ng 7daa82: Int()␤
pmichaud oops
that's a bug :-|
should've been Bool
ash_ rakudo: say (!!0).WHAT
p6eval rakudo 1d4928: Bool()␤
tkr pmichaud: it should me Maybe -> Nothing -> False 19:31
TimToady .map wants to get some kind of object and tell it "you need to be iterable according to my current context, which is (list|slice)"
tkr Mothing is more like a undef
pmichaud tkr: ! returns a Bool
19:32 jferrero left
pmichaud TimToady: that's not precisely the way I've been viewing it (more) 19:32
.map gets some kind of object that already has a context (list|slice), and knows how to iterate it
I can see the other view, however. 19:33
(I don't quite see how to implement it, though)
TimToady that seems wrongish, or we can never have a method override its outer context
like .slice or .list
tkr pmichaud: perl -MDevel::Peek -wle 'Dump(0); Dump(!!0);' # perl 5
pmichaud tkr: we're talking about Perl 6 here. 19:34
TimToady a method is parsed as a postfix, but the postfix actually is in charge of the semantics of its argument, generally
tkr pmichaud: and that's whats Im trying to understand. what a coincidence!
pmichaud tkr: in Perl 6, prefix:<!> returns a Bool. 19:35
19:35 zaxklone joined
pmichaud and !!0 would complain about a ternary having a !! without a ?? 19:36
ash_ tkr a useful thing in perl 6 is .perl if you want to see how whatever you have would define itself
TimToady pmichaud: not as a prefix
pmichaud std: say !!0;
p6eval std 29585: ===SORRY!===␤Ternary !! seems to be missing its ?? at /tmp/1pG9Mob9ic line 1:␤------> say ⏏!!0;␤ expecting infix stopper␤FAILED 00:01 106m␤
pmichaud std: say(!!0);
ash_ rakudo: my $a = 5; say (!$a).perl;
19:36 [particle]1 joined
p6eval std 29585: ok 00:01 106m␤ 19:36
rakudo 1d4928: Bool::False
pmichaud okay.
std: if 3 = !!0 { say 'ok'; } 19:37
p6eval std 29585: ok 00:01 107m␤
TimToady std: say (!!0)
p6eval std 29585: ok 00:01 106m␤
ash_ so, saying !$a where $a = 5; its returning Bool::False
pmichaud bad example on the say there, but... yes, you're correct
(on my say, not TimToady's)
TimToady well, perhaps overzealous <terminator> matching on the say parsing
19:37 lumi left
pmichaud TimToady: I don't quite understand "method override its outer context" 19:38
19:38 lumi joined
TimToady list ($a,$b,$c).item vs item ($a,$b,$c).list for instance 19:39
jnthn back for a bit... 19:40
jnthn backlogs latest lists discussion
19:40 zaxklone left
pmichaud I don't see the conflict in that example. 19:40
tkr Int $x overrides your String $x if you are writing a subclassed method which is defined as Int $x ..?
pmichaud list ($a,$b,$c).item # a parcel in item context (becomes a Seq or List) that is then evaluated as a non-flattening item in list context 19:41
ash_ tkr: can you give an example?
TimToady single dispatch doesn't pay attention to types of anything other than the invocant 19:42
19:42 [particle] left
colomon supernovus: 1 and 2 are not Num, they are Int. (Not sure if someone else has pointed this out or no.) 19:42
pmichaud item ($a,$b,$c).list # creates a list from the Parcel, and then treats that list in item context
TimToady pmichaud: but what you said seems to indicate that ($a,$b,$c) knows its in list context
*it's
pmichaud I think I was saying that .map treats its invocant as being in list context
if its invocant is a parcel 19:43
TimToady okay
pmichaud and that in order to do a map on slices, we'd have to have something that explicitly turns the "invocant" into a slice
TimToady but there's a question about transitively passing on contexts like slice or hyper 19:44
tkr ash_: actually, Im having trouble at the moment, but trying to hold the thought.
pmichaud (1,2 Z 3,4).map: { ... } # list or slice processing?
tkr pmichaud: its jsut array members. ("1,2", " Z 3", "4") .. imho. what is your $" ? 19:47
.. list members.
no wait. ("1", "2 Z 3", "4") .. 19:48
ash_ tkr: Z is a zip operator to zip the two lists together
pmichaud tkr: ... what ash said
PerlJam tkr: (1,2 Z 3,4) == (1,3), (1,4), (2,3), (2,4)
ash_ its going to zip 1,2 to 3, 4
pmichaud tkr: in slice context, it becomes (1,2), (3,4)
PerlJam oops. no
pmichaud er 19:49
(1,3), (2,4)
PerlJam needs caffiene
pmichaud in list context it becomes (1,3,2,4)
tkr this is about I was asking in the beginning
PerlJam tkr: Z is the zip operator :)
pmichaud so my question is, how many iterations does .map perform in that case?
if we imagine the map operator as working on slices, then it has two elements it works on
tkr 1:07 < tkr> how woud you build as subroutine zipWith ($sub, \@x, \@y) in perl 6 without using the << = >> stuff . or how it was.
pmichaud if we imagine it to be working on lists, then it has four elements
tkr 21:08 < tkr> without the hyperoperators. from the basic building blocks? 19:50
PerlJam tkr: in native Perl 6, we'd just use zip and map I think :-)
tkr yes, so "zip" is as native as it gets? 19:52
Id like to build a "zip" function myself, so that it works with infinite lists just fine.
supernovus colomon: I know, I used Num as I wanted the comparison to be used by any numeric values, and Int will dispatch to Num.
pmichaud tkr: in perl 6, or perl 5? 19:53
tkr ... in perl of course, if that isnt obvious.
pmichaud: well ATLEAST in perl 6. geez.
pmichaud tkr: in perl 6, the builtin zip operator will work with infinite lists just fine
tkr yes. but "zip" is then as basic as you can get?
pmichaud tkr: I don't know what you mean by "basic" 19:54
jnthn pmichaud: Put another way, would you expect that we can write zip in Perl 6?
tkr well compared, to let's take it to extreme "from nand to tetris in 12 steps"
pmichaud if you're asking "is it possible to write a version of the zip operator in Perl 6 itself", I think the answer is "yes" but I can't tell you how to do it at the moment because we're still revising the way that lists and iterators work
colomon In fact, the zip operator is one of the ones I've been keeping in the back of my mind during this whole list rewrite discussion. 19:55
tkr pmichaud: ok, thanks. its still under work, I completely understand. :)
TimToady slice context is more basic than zip, and slices are what zip is built out of
tkr I was just curious.
ash_ isn't zip already written in perl 6?
pmichaud ash_: not one that understands slice context, or is lazy.
(at least, not in Rakudo)
tkr pmichaud: where it has? 19:56
pmichaud tkr: I don't understand the question. 19:57
19:59 ejs joined
tkr can some other release to give the perl programmer to feel of wonderfulness of writing a zipwith() function in perl6 without using the builtin "zip" -function? 19:59
pmichaud tkr: the part we're struggling with now is a language design issue, not an implementation issue
so, no. 20:00
tkr Im sorry for all the preposition erros etc, byt I wasnt sure to whom I was talking to. ;)
pmichaud: thank you a million for all the effort you will be doing for perl 6, and also thse answers. :) 20:01
pmichaud you're welcome. apologies that they're not clearer today.
20:01 cotto_work left, cotto_work joined 20:04 pmurias joined
TimToady errands & 20:06
20:06 KyleHa left 20:07 ash__ joined
pmichaud colomon: gist.github.com/286189 # guess #1 at infix:<Z> 20:07
probably lots of errors in it, but that's my first draft guess. 20:08
colomon That is crazy and beautiful. pmichaud++ 20:09
I think I'd been assuming you'd construct an iterator type to do that.... 20:10
jnthn Wow.
pmichaud the iteration is assumed by .list
and .shift
20:10 [particle]1 left
jnthn pmichaud: btw, any ideas what might cause a block to come out with its :outer pointing back on itself? 20:10
pmichaud jnthn: in PAST? 20:11
jnthn Yeah
pmichaud sounds like a broken reference somewhere
jnthn pmichaud: The lazy sig blocks seem to be coming back like that in PIR.
pmichaud do they contain references to themselves?
jnthn Shouldn't...
I'll dig in.
pmichaud if yes, such references have to go through a PAST::Var :scope('register') 20:12
ash__ whats the parameter **@ called? (i thought slurpies only had 1 star)
pmichaud ash_: I think that's a slice
jnthn Oh, I thought it was *@@
:-)
ash__ ah, that slurpies in slice context?
PerlJam I thought it ... what jnthn said
pmichaud ah, yes, *@@
pmichaud fixes
gist.github.com/gists/286189 # fixed 20:13
20:13 k23z__ left
pmichaud ....but even this small example starts to illustrate the difficulty I'm having with iterators. What if one of the iterators returned Nil? 20:14
(to mark the end of the iteration)
20:15 ash_ left
ash__ iterators could raise special exception instead of returning a specific thing? 20:15
pmichaud ash__: in which case, we'd need a try block here (and everywhere) that we happen to be using an iteration
that doesn't seem right.
ash__ the control structure could catch it, that could signal 'i am done iterating' 20:16
pmichaud which control structure. the 'while'?
ash__ i am not sure, maybe you'd need to use for loops instead? i duno, just thinking out loud. 20:17
pmichaud replace "for loop" with "map" and we might have an answer
(since "for loops" are really just "map")
20:18 [particle] joined
ash__ then you'd never have to worry about looking at what was last returned, just wait until the proper exception was raised 20:18
colomon you might not even have an enclosing loop, at the level you want to worry about.
I mean, think of how lazy map would be implemented -- basically it makes a new iterator which iterates the original iterator once (maybe more) and then processes the result and returns that. 20:19
map would need to know that it shouldn't process that "Nil" result. 20:20
ash__ colomon: are you suggesting a lazy map that could return a gather? 20:21
pmichaud keep in mind that the result of a gather tends to be an iterator also
so at some point we have to use a circularity saw to break the cycle
colomon yeah, that's a simplified version of how you would implement gather. 20:22
pmichaud: keep in mind it would be pretty easy to take the suggestion from HOP and just implement a special code for "iterator is finished" instead of Nil. 20:24
pmichaud we still have to check for it
colomon like a singleton Iterator end class.
pmichaud and checking for it makes things icky
colomon yes, I'll be really impressed if you can figure out a way to avoid checking.
PerlJam colomon: an Iterator returns an Iterator() to signify the end? :)
colomon PerlJam: that's simpler than I was thinking, but seems pretty reasonable to me. 20:25
20:27 lumi left, lumi joined
pmichaud gist.github.com/286189 # more infix:<Z> possibilities 20:27
PerlJam Maybe the "end signal" should be a parameter of the iterator (though I guess that would mean we're just talking about the reasonable default then)
pmichaud oops, forgot some >>
ash__ if you don't want to check the return of each iteration the only control structure way i can think of to find the end is to use an exception handler then you only have to raise when your done and there is no individual checking of results
pmichaud gist.github.com/286189 # reload 20:28
if we check iterator return values for a sentinel, then we get something like 20:29
gist.github.com/286214 # a sentinel version (at end) 20:31
where "== SENTINEL" is some sort of test 20:32
so far I like #2 best 20:33
Tene ng: for (1..3) Z (1..5) { say "$^a - $^b } 20:35
p6eval ng 7daa82: Unable to parse blockoid, couldn't find final '}' at line 1␤current instr.: 'perl6;Regex;Cursor;FAILGOAL' pc 1664 (src/stage0/Regex-s0.pir:907)␤
Tene ng: for (1..3) Z (1..5) { say "$^a - $^b" }
p6eval ng 7daa82: Could not find non-existent sub &infix:<Z>␤current instr.: '_block14' pc 29 (EVAL_1:0)␤
Tene rakudo: for (1..3) Z (1..5) { say "$^a - $^b" }
p6eval rakudo 1d4928: 1 - 1␤2 - 2␤3 - 3␤
ash__ pmichaud: gist.github.com/286221 fork of yours with an exception :P
Tene ew 20:36
pmichaud move the CATCH outside the gather, I think
Tene no, that won't work. 20:37
pmichaud gather { take @iters>>.get; }; CATCH SENTINEL { };
Tene What he has is right.
pmichaud why won't it work?
Tene You're returning the gather.
pmichaud oh
ash__ it can be outside of the loop though 20:38
pmichaud okay, then... gather { loop { take @iters>>.get }; CATCH SENTINEL { } } # maybe?
ash__ i wasn't sure which to put it in, the loop or gather
Tene pmichaud: why that instead of CATCH { last } ?
ash__ .get would have to raise SENTINEL when it can't find what to get next though
don't want to catch everything... i think personally 20:39
Tene Right.
pmichaud Tene: so we're not constantly creating/undoing an exception handler, I suppose.
Tene pmichaud: Ah.
pmichaud keep in mind that whatever we ultimately come up with will also be the mechanism for map
and for all list context stuff
which means we'd really like it to be fast-ish
Tene ash__: I really don't think that throwing exceptions is the right thing to do there. It would ake working with iterators very awkward.
ash__ in parrot how expensive are exception handlers?
pmichaud ash__: very. 20:40
Tene You have to put exception handlers all around every tie you work with lists... really not feasible at all.
20:40 bluescreen left
ash__ yeah, that seems kinda bad then, i was just trying to avoid the checking of every result to find the SENTINEL thats all 20:40
pmichaud the use of a sentinel seems bad to me at any rate. I'd prefer to have a definitive "okay to move to next element" 20:41
ash__ from S04: To return from your immediate caller, you can say: 20:42
caller.leave(1,2,3)
is there anyway to take advantage of that?
Tene That's not going to help here, no.
pmichaud ash__: the iterator might be nested several calls deep
we could be iterating a lazy array that contains a lazy list with a lazy range in it...
ash__ but if you use blocks you'd have your own call frames to reference
so to return from 1, you move up 2 and exit .leave it 20:43
just thinking outloud again
pmichaud at the moment, I kind of like the idea that we have .next/.value, and then .get is simply method get() { .next ?? .value !! Nil } 20:44
Tene you really don't want the data structures reaching out and anipulating your control flow. That would work very badly.
pmichaud: I like that.
pmichaud or, if we assume that .next sets the "value" to Nil when it reaches the end of iteration, it's just 20:45
method get { ?self && .next; .value; }
or even
method get() { .next; .value; }
ash__ so in that case SENTINEL would be Nil 20:46
Tene Are we sure that Nil wouldn't cause a seipredicate problem? 20:47
pmichaud Nil has problems
in general
for one, we don't have a good way to test for Nil
unless we introduce macros to do it 20:48
PerlJam Perl 6 needs macros anyway :)
Tene I like Parrot's ethod of having truthiness of the iterator indicate whether there are more elements, or at least an explicit "more?" ethod.
pmichaud the problem with "truthiness" is that we can't always know
that's why my solution #1 doesn't work
in general: 20:49
Tene PerlJam: I' still waiting on soe resolutions to the spec from TimToady before I start working on them.
20:49 bluescreen joined
pmichaud while ($iter) { $iter.get; } # what do we do if .get determines there are no more elements? 20:49
Tene PerlJam: So, if you're interested in macros, pls harass TT.
PerlJam Tene: What part(s) of the spec need clarifying? 20:50
pmichaud ...can we work on macros another day? plzkthx
Tene pmichaud: .Bool tries to fetch another value, and if it can get one, it saves it in a buffer, and .get checks that buffer.
pmichaud Tene: that sounds like .next 20:51
Tene: but I don't want every .Bool to imply "fetch next value"
Tene pmichaud: .Bool checks the buffer, and if it's empty, tries to fetch another value. .get checks the buffer, and if it's used, clears it and returns that value, otherwise fetches a new value. 20:52
20:52 fridim_ joined
pmichaud I'd prefer not to do "clears it" 20:52
Tene pmichaud: how else can you deterine if there can be more elements besides trying to get another element?
pmichaud I'm not saying we shouldn't try, I'm saying that .Bool shouldn't necessarily be that request 20:53
Tene pmichaud: Sure, that's fine. method can_has_more? { ... };
pmichaud regardless, if we go the .Bool route, then someone implementing an Iterator still has to write a method (that is neither .Bool or .get) that fetches the next value
Tene That's not internal iterator logic? 20:54
pmichaud it's different for each type of iterator, I think.
unless we expect every Iterator to implement its own "see if buffer is filled, if not, fetch value into buffer; return true/false" and "return value in buffer, clear buffer" methods 20:56
20:56 renormalist joined
pmichaud seems like that logic should be factored out, so that there's really just a "fetch next value" method and the Iterator role handles the buffer and boolean logic 20:56
20:58 eternaleye left, fridim_ left
pmichaud a very interesting variation on this would be to be able to vary the size of the buffer, and have a .getlast($n) method that gets the last $n values of the buffer 20:58
that could be very useful for implementing the series operator :)
as well as handling batch iterations
so, we could have .next($n) # retrieve the next $n items into the buffer 20:59
ash__ just curious, what's involved for handling iterations in parallel?
pmichaud .get # get the last item
.getlast($n) # return the last $n items from the buffer
Tene Hm. I' becoming progressively more convinced that throwing an exception on being asked for more items when there are no more is reasonable. 21:01
pmichaud why?
Tene Unless there's a reason why returning Nil for that isn't a semipredicate issue.
pmichaud well, I'm pretty sure we want some sort of out-of-band communication (more) 21:02
the question is whether that should be exception based or some sort of query/response
I'm thinking now that query/response gives more flexibility and options 21:03
Tene The question I have there is what should the behavior of .give-me-another be when .are-there-ore? returns false?
pmichaud oh, in that case it returns Nil
Nil isn't the sentinel in that case, it's just the value you get when you ask an iterator for more elements and there are none
or, perhaps some iterators get to choose that as well.
21:03 xinming_ joined 21:04 ash__ left, fridim_ joined
pmichaud but if an iterator is done, it can return values (without those values having to be treated as "sentinel" values) 21:04
21:04 ash_ joined 21:05 FCO left
pmichaud and, of course, .give-me-another can return Failure objects 21:06
Tene Can iterators use 'fail'?
pmichaud sure 21:07
Tene Heh. Exactly.
pmichaud this is what Rakudo (master) does now, in fact
rakudo: my @a; my $x = @a.shift; say $x;
p6eval rakudo 1d4928: Undefined value shifted from empty array␤␤
Tene Then .give-me-more will throw exceptions when isused under 'use fatal', etc.
21:07 ash_ left
pmichaud note that the "undefined value" message takes place at the point of the 'say', not the shift 21:08
21:08 ash_ joined
pmichaud rakudo: my @a; my $x = @a.shift; say "here"; say $x; 21:08
p6eval rakudo 1d4928: here␤Undefined value shifted from empty array␤␤
Tene ng: my @a; my $x = @a.shift; say 'hi';
p6eval ng 7daa82: hi␤
Tene Okay, I like that. 21:09
pmichaud so, when an iterator reaches it end, its .get (or whatever) just calls 'fail'
method get() { $value || fail 'no more values to iterate' }
but we can't use a generic test for Failure as a sentinel, because we might be iterating over a list of failures :-) 21:10
...which is another reason why I'd prefer not to use Nil as the "I'm at the end of iteration" signal (more) 21:11
by returning a Failure, we can give better information about the type of iteration that we went beyond the end of
21:12 payload joined, ash__ joined, spinclad left 21:13 ash__ left
colomon pmichaud: backing up a sec, are you proposing the basic iterator interface should be .get with in-line end-of-iteration status, with some sort of generic adapter code to get the .next / .value interface? 21:14
21:14 ash__ joined
colomon (with current quibbling being over how .get should signal end-of-iteration?) 21:14
pmichaud colomon: I'm not at the point of a proposal yet (more)
21:15 eternaleye joined
pmichaud I'm saying that at the moment, I like (1) .get returns failure objects if we attempt to go beyond the end of an iteration sequence, and (2) those objects aren't the way that we signal "end of iteration" 21:15
Tene s/returns failure objects/calls &fail/ 21:16
21:16 xinming left
colomon ah. 21:16
pmichaud &fail is "return failure object"
that's what &fail means :-)
colomon well, in that case, I'd like to put in strong support for what I thought you were saying.
Tene &fail is "return failure objects, except under dynamic 'use fatal' conditions, when it throws exceptions instead" 21:17
21:17 Su-Shee left
pmichaud Tene: okay, that's really what I meant, yes :) 21:17
Tene colomon: how can you iterate over failures, then? 21:18
pmichaud I'd really like to separate the notion of "generate the next value of the iteration" from "retrieve the next value of the iteration"
at the moment, .get is the latter
Tene is that different from "advance to the next ite / fetch the current item"? 21:19
pmichaud I'm thinking about it in terms of $file.get
Tene I'm a little bit hazy on uses of "next" in your description.
pmichaud currently, .get means "advance to next item and return it"
i.e., it's the primary external mechanism for iterators 21:20
colomon sorry for interruption, my boy just spit partially digested milk all over my leg. 21:21
pmichaud colomon: don't cry over it :-)
colomon groan.
my issue with "advance to the next item / fetch the current item" as a basic approach is it means lots of iterators will have to have internal buffers. 21:22
pmichaud colomon: yeah, I'm not too keen about that either
well, *somewhere* there's likely to have to be a buffer 21:23
colomon and on the other hand, if you have the "get the next item or return special flag" interface, you can easily generate an adapting class with buffer that will allow that approach to dealing with the world.
pmichaud maybe instead of defining .get in terms of .next and .fetch, we define .next and .fetch in terms of .get
colomon yes, pmichaud, that's exactly what I'm proposing.
pmichaud so: method next() { $buffer = .get; ?self; }
method value() { $buffer; } 21:24
colomon you just said it eloquently.
Tene pmichaud: under that scheme, you can have 'next' return a failure when there are no more items.
pmichaud Tene: well, I really want .next to return true/false
colomon and then the only question is what is a reasonable "I'm done" value for .get to return.
Tene Right, yes, that would be much better.
pmichaud colomon: I think .get should return a Failure (more) 21:25
but I think it should also set the "I'm finished" flag of the iterator to true
Tene colomon: Please tell me what kind of objects you're absolutely certain nobody would ever want to iterate over.
pmichaud i.e., the way that .get signals it's done is that it sets the iterator's boolean value to false
Tene It can't be failures. Iterating over $! is explicitly discussed in the specs. 21:26
colomon Tene: we can make a special object exactly for this purpose. If some crank wants to iterate over it, it's on their head.
pmichaud colomon: I don't like the sentinel approach, for reasons cited above
ruoso pmichaud, calling fail is not the same as returning a failure
Tene ruoso: already discussed.
ruoso ah.. right
pmichaud, in my mind... we need to have the Iterators working at a similar level then the one of Unix Pipes 21:27
I mean...
pmichaud ruoso: to me, the phrase "returning a failure" implies a call to &fail, just like "displaying a value" implies a call to "&print" or "&say"
colomon pmichaud: was there reason other than the resulting code isn't so elegant?
ruoso pmichaud, the semantics are different... calling fail means that the exception is thrown...
returning a failure might not mean that
colomon (sorry, it's been the kind of day where following the conversation isn't necessarily the same as understanding it.)
pmichaud ruoso: calling fail means that an exception is thrown if "use fatal" is in effect 21:28
ruoso pmichaud, really? I thought that was only for the "lazy exceptions"...
Tene ruoso: and 'print' actually prints to $*OUT, which ight not display to anyone. "display a value" is still a fairly reasonable way to talk about calling &say.
pmichaud ruoso: most exceptions are lazy. If we want to throw an exception, we use 'die' 21:29
Tene ruoso: No, &fail only throws if you've "use fatal"
pmichaud &fail is "soft failure"
ruoso pmichaud, sorry... dislexia on my part
I meant die...
pmichaud ruoso: np :)
ruoso but anyway
about iterators
I think an iterator is like an unix pipe 21:30
in the sense that you can have separated threads in each end of it
in fact, I kinda assumed we would have "implicit threading"
by creating threads for the iterator usage
like...
my @a = map { ... }, @b; 21:31
this would mean at least three interpreter threads
one to produce the values in @b
other to consume that values and pass through the map block
and other to consume the values from the map and store in @a
pmichaud ruoso: that makes sense, but doesn't really conflict with any of what we've been saying 21:32
(or resolve)
ruoso I know it doesn't... ;) I was just brainstorming ;)
pmichaud okay
yes, I tend to think of iterators as being independent "threads" as well.
(always have) 21:33
ruoso and Control Exceptions would be used to signal "Buffer Empty", "Buffer Full" and "Data Available"
ash__ so... just thinking about how other languages do things, ruby does iteration inside out with yield and do block's, python does iterators with .next() and raising an exception, php does iterators by implementing an interface with foreach blocks that call next(), valid(), key() and current() till next returns false()
21:34 ash_ left
ruoso pmichaud, about get and fetch... the issue with .hasNext(), .next() (as in java) is that it doesn't make sense for intensive parallel programming 21:34
doing a simple operation that might fail is more parallel-friendly 21:35
ash__ you could have 2 iterator types (at least), one for parallel that can grab multiple things at a time, and 1 that just does things in order
next(Int $count) grabs next $count then sends those to $count number of threads?
ruoso but when you consider "implicit threading" an iterator that "does things in order" is too restrictive 21:36
ash__ s/next/get/
ruoso ash__, in my head that's implemented by map itself (or any other parallellizing op/sub) 21:37
Tene colomon: so, where are you going to store this sentinal value? In a namespace? What happens when you ask for a list of objects in that namespace?
21:38 spinclad joined
pmichaud Tene: we can certainly come up with a sentinel that always has the meaning "iteration done". I'm not saying we should, but we can. 21:38
colomon Tene: I'm not saying it's possible to create a value that can never be used wrongly.
Just that we can create one that exists solely for the purpose of being a sentinel. 21:39
ruoso I'm a bit off the discussion... but I liked more the idea of the iterator throwing an exception when it was over 21:40
instead of retuning a special value
ash__ i think that was argued against because exception handling is expensive 21:41
ruoso because you can always ask: "what if you want to return the special value as an item of the iteration?"
pmichaud ruoso: TimToady "solved" that particular objection by saying that Nil was the "special value", and that iterators never return "Nil" except at the end of the iteration.
Tene ash__: using &fail works well there, though, because you can explicitly ask the iterator if it's done, or if you want exception semantics, just 'use fatal'.
pmichaud that brings up other issues, though.
ruoso it's like null-terminating strings... 21:42
ash__ its kinda an issue of "never return XXX" vs "never raise XXX" ? 21:43
ruoso it worked fine, untill someone came with utf-16
pmichaud except that strings can have null bytes, but arrays and lists can never have Nil
ruoso but Nil is an object
that needs to be returned somehow 21:44
pmichaud no
Nil is ()
which is an empty list in list context, or Mu in item context
ruoso yeah yeah... but in the VM it needs to be represented somehow
it *is* something
pmichaud an empty Parcel
ruoso precisely
pmichaud but an empty Parcel can never occur in a list 21:45
ruoso if it *is* something, you might need to work with it
pmichaud okay
ruoso I mean... semantically, it's confusing
pmichaud I'm not saying I agree with TimToady's suggestion (I don't -- see above), I'm just saying that he resolved it by saying that value could never be part of an iteration
ruoso it's the valdemort value 21:46
pmichaud which was your objection :)
ruoso ;)
spinclad speaking haskelly... Nil is Nothing, and everything else is Just itself
ruoso s/valdemort/voldemort/ 21:48
pmichaud so, if we say we're doing an exception-based model, then we'd have to have
spinclad (the Vole of Death)
pmichaud method get() { return the next value if available || die StopIterationException } 21:49
ruoso pmichaud, yeah... something like that 21:50
pmichaud afk, picking up kid
ruoso and if performance is an issue... CPS might be an interesting way to solve it... the optimizer can take the exception handling code as well as the regular continuation and call $list.get(&continuation_with_value, &continuation_without_a_value) 21:51
spinclad was just composing something on a two-continuation model... you beat me to it 21:52
ruoso but... 21:53
ruoso need to run before the parking keeps his car for the night...
ash__ i think ruby's yield semantic is pretty elegantly and simple. then you can figure out how you want to handle all the implementation details, but its kinda an inside out way of doing things 21:54
spinclad $stream.get: -> $it { ... }, { #`(eof) ... }
a bit like 'if' 21:55
ruoso likes spinclad idea
and considering .get is something that is not for the most regular use 21:56
(using in list context is what the regular use will be)
ruoso really needs to go & 21:57
21:57 ruoso left
ash__ i don't see the purpose of the 2nd block 21:57
spinclad that's what you call if the stream is done
ash__ why not let the first block do that at the end of itself before it returns?
21:57 clintongormley left
ash__ i guess i am saying doesn't the $stream know how to handle the finishing up of things? 22:00
spinclad mm? the first block is called if the stream isn't done. why should the stream always be done after one value?
ash__ like, here, one sec, let me write an example
spinclad the $stream can do what it likes. this is what _you_ want to do if the stream is done. 22:01
22:01 bluescreen left, supernovus left
PerlJam ash__: spinclad is basically parameterizing the iterator with the end-of-iteration action. 22:02
spinclad the $stream.get above is the same as: 22:03
ash__ gist.github.com/286309 is kinda what i was thinking
spinclad if $stream.hasmore { $it = $stream.get; ... #`(first block here) } else { #`(second block here: eof) } 22:04
ash__ then it makes the person who implements it responsible for if they want to thread, or if they want to take things 1 at a time or 2 or n at t time
22:06 fridim_ left
colomon oh, I see. 22:07
22:16 niros joined 22:18 fridim_ joined, sjohnson sets mode: +ooo spinclad ash__ colomon 22:20 [particle]1 joined
diakopter sigh 22:21
ash__ why the sigh? 22:27
22:27 niros_ joined 22:28 cognominal left 22:32 [particle] left 22:34 ejs left
ash__ does ng have 'loop' implemented yet? 22:35
its not passing S04-statements/loop.t so i guess not... 22:36
22:36 mikehh joined
colomon it does have loop! 22:38
ng: my $a = 1; loop { say $a++; if $a == 5 { last; } } 22:39
p6eval ng 7daa82: 1␤2␤3␤4␤
22:40 niros left
ash__ hmmm it doesn't seem to be passing that test though 22:40
although that might be a different issue
maybe its the: my ($i, $continued); in it 22:41
ng: my ($i, $continued);
p6eval ng 7daa82: Redeclaration of symbol $i at line 1, near ";"␤current instr.: 'perl6;HLL;Grammar;panic' pc 500 (src/stage0/HLL-s0.pir:328)␤
22:42 lumi left, lumi joined
ash__ updated gist.github.com/286309 to an example that is functional in ng and master rakudo 22:44
Tene ash__: indeed, list declarations are NYI in ng. 22:45
ash__ well, maybe it passes those tests once those are working then
22:45 snearch joined
Tene ash__: you could rewrite that test to not use list declaration syntax. 22:46
ash__ i can try 22:48
ng: ng: my $i; loop ($i = 0; $i < 10; $i++) {} say $i; 22:50
p6eval ng 7daa82: Confused at line 1, near "ng: my $i;"␤current instr.: 'perl6;HLL;Grammar;panic' pc 500 (src/stage0/HLL-s0.pir:328)␤
ash__ part of it doesn't seem to be getting parsed correctly, i think
ng: my $i; loop ($i = 0; $i < 10; $i++) {} say $i; 22:51
p6eval ng 7daa82: Confused at line 1, near "loop ($i ="␤current instr.: 'perl6;HLL;Grammar;panic' pc 500 (src/stage0/HLL-s0.pir:328)␤
ash__ ng: my $i; loop ($i = 0; $i < 10; $i++) {}; say $i;
p6eval ng 7daa82: 10␤
ash__ it seems to require a semicolon after the } on the loop, is that right?
Tene ng: my $i; loop ($i = 0; $i < 10; $i++) { say $i; }; say "done";
p6eval ng 7daa82: 0␤1␤2␤3␤4␤5␤6␤7␤8␤9␤done␤
Tene ash__: if it's not the end of the line, certainly.
ash__ but if it is the end of the line? 22:52
like, it seems to always require one
for ng to parse it
Tene Okay. So you either add one to the test file, as it's not incorrect to have one there, or you fix ng's parser.
ash__ even in the examples in the test that look like they shouldn't need one
well, i'd rather ng parse it correctly, so... i could do that, or i could add 1 more test that's an eval to check for the 2 cases and fudge the failing one and change the tests so they use a ; to let ng pass them... 22:53
i guess 2 more cases, not 1 more
22:54 lucs left 22:57 iblechbot left 23:04 fridim_ left
ash__ where is the std grammar located on the pugs repo? 23:07
23:07 niros_ left
pmichaud 21:55 <ruoso> and considering .get is something that is not for the most regular use 23:08
except that $file.get *is* for regular use
and as we have it spec'd now, it shouldn't throw an exception on eof
Tene is EOF specced for $file.get ? 23:10
sjohnson hi
23:11 sundar joined
pmichaud 22:03 <spinclad> if $stream.hasmore { $it = $stream.get; ... #`(first block here) } else { #`(second block here: eof) } 23:11
the problem with this is that it's possible that $stream.get actually resulted in EOF
in which case we don't want to do #`(first block here) -- we want to do the eof block
jettero earlier I asked about xs in perl6, and I was told that there won't be any. And what I really meant was: what will there be to interface with the local c libs? is that just going to be impossible? I can't accept that...
Tene pmichaud: isn't that what .hasmore *is for*? If that's the case, what does .hasore even do? 23:12
23:12 Helios joined
pmichaud Tene: the problem is that we often can't determine that we have more until we actually make the attempt 23:12
ash__ jettero: currently in rakudo, parrot supports an NCI system for calling c libs
pmichaud e.g., when reading from stdinput
Tene pmichaud: which means that .hasmore *needs to attempt*
ash__ but its part of parrot not part of perl 6
pmichaud Tene: if that was implicitly assumed by spinclad's example, I didn't catch it. 23:13
Tene jettero: Nothing is specified. It's likely to be implementation-dependent. Rakudo runs on parrot, which does support loading native libraries.
jettero ash__: I don't know what NCI is, but I have something to google for. Can you somehow invoke these from within perl6? Surely there's got to be some plans for this kind of thing.
Tene pmichaud: it's iplicit in the assumption that .hasmore would actually be useful for anything.
jettero There's a way for perl6 to speak implementation dependantly to the underlying implementation? or something?
ash__ yes, you can call them from perl6, but like Tene said, tis implementation dependent 23:14
s/tis/its/
jettero excuse my giberish.. I"m a little surprised by the answers I'm getting. I can't imagine not being able to ... invoke a syscall, or the like
Tene jettero: Yes, Rakudo can talk to C just fine. I've used it several ties.
ash__ sys calls are different, it can open another program if you want, thats in the spec, but calling a .so or .dylib or .dll is different 23:15
jettero well,I don't mean like exec() necessarily, but any of the POSIX stuff probably comes from a .so
and to write windows modules you'd need something like Win32 stuff... or gtk or wx... 23:16
23:16 lumi left, lumi joined
Tene jettero: parrot has a 'loadlib' opcode that loads a .so or .dylib or .dll or whatever, and a 'dlfunc' opcode to get symbols fro it. 23:16
jettero: look at github.com/tene/parrot-elementary/b...entary.pir for an example.
jettero so you can write extensions for perl6, they're just implementation specific... 23:17
ash__ yeah, that would be in S21 Calling Foreign Code but its really more of an implementation dependant functionality, rakudo has it out of the box, you might need to write some helpers though but it does work in parrot code
Tene jettero: To use that PIR file from Perl 6, you would say: "use Elementary:from<parrot>;"
jettero ok, great
I apparently just didn't know how to ask the qeustion 23:18
pmichaud jettero: it's implementation specific at the moment because we're looking for a reasonable "common interface". Someday there will likely be a defacto standard -- the language doesn't prescribe one at this time.
ash__ yeah xs specifically is gone, but there is a way to work around it
Tene jettero: I've seen a few projects that attept to auto-generate that stuff by parsing C header files, but I haven't seen any that are usable enough yet.
pmichaud afk, dinner
jettero yeah, I'm not in love with xs... I just wanted to know you can get down to the bottom, so to speak. And I know it's not done, but I didn't know how to read about what's working and what's not 23:19
ash__ jettero perlcabal.org/syn/ has a list of all the specs, and you can alway download your favorite perl 6 implemenation and run its test suite (if it has one) 23:20
Tene jettero: I' glad that I could help. Feel free to ask e for ore inforation if you want to actually try it yourself. I'd be glad to help.
ash__ a bunch of the specs (most actually) are still drafts since none of the implementations have solidified the details on them yet 23:21
23:26 xinming joined 23:32 niros joined, xinming_ left 23:36 ash__ left, snearch left, ash_ joined 23:40 ihrd joined, ihrd left
pmichaud (more iterator thoughts) 23:42
if we go with an exception-based model, and if we expect my $line = $file.get // 'default'; to continue to work, then .get shouldn't be the thingy that throws an exception. 23:43
that implies to me that an iterator probably implements some method other than .get to mean "get the next element and signal eof", and .get is a wrapper/driver method of some sort. 23:44
or, we go with something like what spinclad++ was mentioning, where something supplies an iterator a block that indicates code to be run when retrieving the next element would reach end-of-iteration 23:47
(end of thoughts for the moment)
afk, rb2 23:48
jettero Tene: thanks, yes, you did help. Is this channel logged? or shouldI attempt to cut and paste it? 23:49
(all those URLs)
Tene jettero: This channel is logger.
jettero k, I'll probably look for it tomorrow then. thanks again
23:51 payload left, payload joined
Tene The log is at irc.pugscode.org/ 23:51
jettero super
23:55 lumi left, lumi joined, ash_ left 23:59 nihiliad left