Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2008-05-14

Perl 6 | Reference Documentation | Rakudo

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

All times shown according to UTC.

Time Nick Message
00:01 pmichaud Tene++
00:08 * Eevee considers flooding http://www.perlfoundation.org/perl6/index​.cgi?glossary_of_perl_6_terms_and_jargon with perl 6 language constructs and links to associated synopses
00:08 lambdabot Title: Glossary of Perl 6 Terms and Jargon / Perl 6, http://tinyurl.com/ytvdje
00:08 pmichaud Eevee++
00:10 Eevee I will take that as approval
00:24 [particle1 joined #perl6
00:27 [particle1 left #perl6
00:29 Eevee are the globals still going to have single-symbol names?
00:38 Eevee well, whoops.  apparently I found a magical "close exactly the tab I don't want closed" keystroke, and of course socialtext uses a ridiculous javascript editor instead of a page with a textarea..
00:43 Alias_ joined #perl6
00:49 BinGOs joined #perl6
00:52 aindilis joined #perl6
01:04 ispy_ joined #perl6
01:04 ispy_ I <3 Perl6
01:07 vertog joined #perl6
01:25 Ched joined #perl6
01:32 ispy_ joined #perl6
01:59 [particle2 joined #perl6
01:59 [particle2 left #perl6
02:02 [particle2 joined #perl6
02:34 eternaleye joined #perl6
03:10 Diablo-D3 joined #perl6
03:10 Diablo-D3 heh, oh wow, this channel does exist
03:11 Diablo-D3 is there any way to future proof code against perl6?
03:20 Eevee well let's see
03:21 Eevee never use the dot operator
03:21 Eevee never use the arrow operator
03:21 Diablo-D3 dont use packages either
03:21 Diablo-D3 (which wipes out cpan)
03:21 Eevee don't use for
03:21 Eevee don't use three-arg for
03:22 Diablo-D3 can parrot speak perl5?
03:23 Diablo-D3 because perl6 isn't an issue if perl5 ends up being dragged along for the ride
03:24 Eevee there have been a few attempts at getting perl 5 running on parrot, yes; not sure where they are or what their status is
03:25 Diablo-D3 Im asking because atm I'm writing code
03:25 Eevee I think the goal is to distribute a binary that can run either
03:25 Diablo-D3 I expect this code to continue working 10 years from now
03:27 Diablo-D3 migration seems to be nearly impossible if I don't also drag a bunch of cpan modules with me
03:27 Eevee there is a huge body of existing perl 5 code; it's not like perl 5 is going to vanish the day perl 6 is released
03:28 Diablo-D3 no, but if it stops being released, then eventually it stops being able to be compiled on a modern system
03:28 Diablo-D3 thus, Im screwed
03:28 Eevee and even if it did someone would maintain it anyway, (open source)++
03:28 Eevee for all intents and purposes consider perl 6 to be a new language
03:29 Eevee perl 5 will probably live alongside it for a while, and I would be surprised if it weren't actively developed for another ten years
03:29 Diablo-D3 well, if they make parrot speak perl5 as well as the real perl5 does
03:29 Diablo-D3 then its a total non-issue
03:30 Eevee yes
03:30 Eevee only problem there is that nothing has ever spoken perl except perl
03:30 Diablo-D3 yes, and perl isnt very good at speaking perl sometimes, too
03:30 Eevee touche
03:31 Diablo-D3 I'm rather interested in parrot though
03:31 Diablo-D3 it seems to be effectively gathering all the smart bytecode vm coders out there
03:32 Diablo-D3 which means no matter what syntax you actually end up using for your code, you still get to leverage their knowledge and work
03:33 Eevee yeah, I really hope it takes off in OSS land as much as .NET has for microsofties
03:33 Diablo-D3 heh, I was thinking more like java
03:33 Diablo-D3 .net seems to be stillborn imo
03:33 Diablo-D3 well, C# anyways
03:33 Diablo-D3 .net is more than just c#
03:34 Eevee eh, I do see a lot of mention of .NET
03:35 Eevee not so much in end-user apps, but enough people seem to be using it for big enterprisey things or as ASP.NET
03:35 Eevee Java's mindshare looks to be gradually slipping
03:35 Eevee but this is all anecdotal really
03:50 alester joined #perl6
04:28 meppl joined #perl6
04:35 Psyche^ joined #perl6
04:38 kane__ joined #perl6
04:39 Alias__ joined #perl6
04:57 stalerx joined #perl6
05:10 dduncan out of curiosity, how is Rakudo now as far as completeness of the Perl 6 spec go ... eg, how much of the Pugs test suite run, versus what Pugs runs?
05:12 Eevee x% vs y%
05:12 Eevee (not sure, and that depends how correct *and* complete the test suite is..)
05:14 dduncan how much of the test suite does each run and pass?
05:14 dduncan note the smoke server seems to be down
05:21 dduncan left #perl6
06:13 masak joined #perl6
07:00 smtms joined #perl6
07:15 pbuetow joined #perl6
07:23 peepsalot joined #perl6
07:39 chris2 joined #perl6
07:49 elmex joined #perl6
08:20 syle is perl6 gonna be close to speed of c, or am i better off just writing things in c?
08:20 Diablo-D3 syle: fuck c, write it in assembly
08:20 syle will it have an eventloop based on something like eventlib and power of pthreads etc?
08:22 syle well current project i am coding is about 7 thousand lines of perl5, took me about 6 months, i traded devel time for speed, but not entirely linked alot of c libraries in, but fuck the time it takes to generate files in perl is fucking depressing
08:22 Diablo-D3 wait, are you implying perl5 is slow?
08:23 syle yes
08:23 Diablo-D3 wait, before or after the part where perl5 lets you run C?
08:23 syle shit man i;m doing basic file processing and can only do about 1200 files per min
08:24 syle i have linked in c libraries everywhere
08:29 syle sure gimme 2 years of rent and food and i;ll write the fucker in assembly, devel time is somewhat important unfortunately
08:29 moritz_ syle: did you profile your application?
08:30 syle no
08:30 moritz_ Perl 6 is designed to be optimizable, but how much of that will happen is up the implementors
08:30 moritz_ syle: well, do it
08:31 syle is perl6 compilable or just bytecode again?
08:31 moritz_ Perl 6 is a *language*
08:31 syle is perl6 compilable or just bytecode again?
08:32 moritz_ again, it's a *language*
08:32 moritz_ that can be implemented in different ways
08:32 moritz_ as an interpreter or as a compiler
08:32 moritz_ as a compiler to byte code or to native code
08:32 syle what is going to be the social norm?
08:32 moritz_ or to lisp
08:33 moritz_ that's too early to predict, but many expect it to be parrot
08:33 syle so pugs is a joke you think?
08:33 moritz_ no, a prototype
08:34 syle will it use more advanced event loops ie: epoll on linux , kqueue on fbsd?
08:34 syle heard about an internat eventloop
08:34 syle internal
08:35 syle was thinking eventlib would be a great start
08:35 moritz_ how portable is that?
08:36 moritz_ parrot has the goal to run on all platform that perl5 does
08:36 syle it works really great, it defaults to best types on almost every OS, epoll on linux, kqueue fbsd, poll solaris etc etc
08:36 moritz_ (including windows and VMS)
08:36 masak joined #perl6
08:36 syle omg people still use VMS
08:37 * syle pulls out his commodore 64
08:38 syle yes eventlib even supports those
08:38 syle windows is abit different
08:39 syle i been hearing perl6 will be threaded really efficiently
08:39 syle i am looking forward to sharing shit with other threads finally
08:40 moritz_ why would you want to share shit?
08:40 syle but am abit curious how thats being implemented , mutex locks etc
08:40 syle why, give ya a good example...
08:41 araujo please take it to priv
08:41 syle smtpd server, email comes in, has some blocking operations, love to pass email message off to a thread instead of using a pipe
08:43 syle well i been studying alot of IPC's, and i found pipes in perl5 to support the least latency
08:44 syle played with domain sockets, tcp sockets, files, pipes , share memory implementations , while shared memory will always be the fastest, not always feasible in alot of apps
08:45 syle someone sends you a 10 meg pictures, woot shared memory goes out the door
08:47 syle whats currently best way to deal with this situation? dish the shit to disk and let some other process pick it up
08:50 syle what you think , memory will one day replace harddrives entirely?
08:50 masak syle: you talk a lot
08:50 syle well cause you talk next to shit
08:51 syle today i am drunk again though, i can only work on big code bases so long before resorting to the wine
08:52 syle its quite interesting, after about 1/2 a liter you can still program well, at about the 3/4 mark you pretty much have to give up and chat irc bullshit
08:53 syle well its 4am i figure nothing interesting going on anyways, i wouldn;t interrupt the daytime people
09:00 masak how US-centric of you
09:03 syle oww fuk no, i;m no lame american, i;m a nice pot smoking, liquor drinking friendly canadian
09:04 masak congratulations
09:08 syle i been having a personal crisis lately, girls convicing me to be a lawyer instead of programming cause they actualyl might understand wtf i am talking about time to time
09:10 syle i been doing this shit over 10 years now, and live alone in a house, cause i program from home, i;ve actually contacted the law faculty locally here and toldme to write the LSAT before dec 30th for acceptance
09:11 syle i don;t think this is anything new, the new guy on the senate in the US was one of the top assembly programmers idk
09:11 * syle doesn;t know why he is saying this shit, very drunk
09:12 masak yes
09:13 * syle comes to realization you cannot work from home and be an efficient husband/father
09:13 * syle looks for psychologic counselling from someone.
09:23 REPLeffect joined #perl6
09:26 Diablo-D3 left #perl6
09:26 Alias__ syle: Pretty much
09:27 Alias__ How old?
09:27 Alias__ It's tricky to convince young kids that you are "away" when you are in the house
09:29 Alias__ Or so I imagine anyways
09:33 syle 32
09:34 Alias__ joined #perl6
10:03 ruoso joined #perl6
11:36 bsb left #perl6
12:13 kyrbe joined #perl6
12:15 kyrbe left #perl6
12:19 agentz1 left #perl6
12:34 agentzh joined #perl6
12:45 kolibrie @tell dduncan another term to consider is integration (re normalization, canonization)
12:45 lambdabot Consider it noted.
12:50 * diakopter chuckles at drunk ircing
13:13 cmarcelo joined #perl6
13:14 eternaleye joined #perl6
13:16 vixey joined #Perl6
13:27 rdice joined #perl6
13:39 TJCRI joined #perl6
13:56 cognominal_ joined #perl6
13:57 sscaffidi joined #perl6
13:58 cognominal_ joined #perl6
13:58 cognominal_ joined #perl6
13:59 alester joined #perl6
14:14 cjfields joined #perl6
14:46 fridim_ joined #perl6
14:51 pugs_svnbot r20431 | clkao++ | grrr hate
14:53 IllvilJa joined #perl6
14:55 pbuetow joined #perl6
14:56 pbuetow_ joined #perl6
14:59 [particle2 msg syle i encourage you to look at the parrot design documents: http://www.parrotcode.org/docs/pdd/
14:59 lambdabot Title: Parrot Documentation :: Parrot Design Documents - parrotcode
15:00 [particle] msg syle you'll find good information about the event and concurrency subsystems on the vm running under rakudo perl (perl 6 on parrot)
15:13 moritz_ [particle]: it's @tell here in #perl6 ;)
15:13 [particle] ah, right! thanks.
15:14 [particle] can i msg a bot with @tell, or does it have to be in chan?
15:17 kolibrie [particle]: I think you can msg lambdabot directly
15:17 moritz_ I'm quite sure you can
15:17 moritz_ lambdabot delivers across channel boundaries
15:17 moritz_ lambdabot++
15:18 [particle] kolibrie++ moritz_++ #done
15:21 pmurias joined #perl6
15:23 justatheory joined #perl6
15:24 allbery_b you can, just remember that the @ (or ?) prefix is still required on commands (unlike other bots)
15:24 allbery_b that seems to catch a lot of people by surprise
15:57 Juerd I'm used to ! in some other channels
15:57 Juerd Maybe it's time for a standard bot protocol :)
15:58 moritz_ and while you are it, standardize the character encoding for IRC
15:58 Eevee moritz_: utf8.  there that was easy!
15:58 [particle] no! ucs-2!
15:58 Eevee Juerd: imo bot commands should just be targeted at the bot, so nobody has to worry about guessing the sigil or whether another bot in the same channel is using it etc
15:59 moritz_ Eevee: I know too many people who use iso-8859-{1,15} :(
15:59 [particle] latin-1 is the only-1!
15:59 moritz_ Eevee: that's bad huffman coding
16:00 Eevee moritz_: me too.  but probably only because that's the default in mirc (I assume?) and nobody knows or cares to change it
16:00 moritz_ we should have a bot that kicks everybody who's not sending valid utf8 ;)
16:02 Juerd Eevee: But then you have to know which bot handles the command
16:04 Eevee Juerd: true, but if all the bots have different sigils anyway..
16:06 justatheory joined #perl6
16:23 meppl joined #perl6
16:26 pmurias joined #perl6
16:39 stevan_ joined #perl6
16:39 kane_ joined #perl6
16:50 rindolf joined #perl6
16:53 kane__ joined #perl6
17:07 Ched- joined #perl6
17:08 kane_ joined #perl6
17:18 mj41 joined #perl6
17:24 mj41 joined #perl6
17:25 kane__ joined #perl6
17:30 eternaleye joined #perl6
17:31 eternaleye joined #perl6
17:33 gbacon joined #perl6
17:36 kane_ joined #perl6
17:56 kane__ joined #perl6
18:05 meppl joined #perl6
18:26 iblechbot joined #perl6
18:39 Ched- joined #perl6
18:44 smtms joined #perl6
19:09 justatheory joined #perl6
19:26 sscaffidi joined #perl6
19:30 apple-gunkies joined #perl6
20:03 japhb joined #perl6
20:18 rindolf Hi all.
20:19 vixey hey rindolf
20:19 rindolf Hi vixey
20:19 rindolf vixey: so are you a l33t Perl 6 Hax0r now?
20:20 vixey hehe not really, just looking around :)
20:20 rindolf vixey: OK.
20:20 rindolf The IRC seems kinda quiet now.
20:20 fullermd_ joined #perl6
20:27 Caelum joined #perl6
20:29 ting_ joined #perl6
20:29 agentz1 joined #perl6
20:30 syle joined #perl6
20:40 simcop2387 joined #perl6
20:40 Eevee hm
20:41 Eevee if `for @array -> $i { say $i }` works, would `sub f { say $^a }; for @array &f` work?
20:42 ting_ joined #perl6
20:43 wolverian I don't think you can use ^ variables in subs
20:43 wolverian only in bare blocks
20:43 wolverian and it should be "for @array, &f", probably
20:47 Tene wolverian: you can't use placeholders in subs?  I don't recall that from the spec.
20:51 wolverian hm. apparently I misremembered.
20:52 wolverian sorry. :)
20:55 Eevee wolverian: well, there's no comma before a pointy block on a for.  I am just conjecturing wildly though; I've never seen this actually done, spec or otherwise
20:55 Eevee perl6: my @foo = [1,2,3]; for @foo -> $i { print $i }
20:55 [particle] you can't use placeholders in subs with param lists
20:55 exp_evalbot kp6: OUTPUT[1 2 3]
20:55 exp_evalbot ..pugs: OUTPUT[1 2 3]
20:55 exp_evalbot ..rakudo: OUTPUT[123]
20:56 Eevee perl6: my @foo = [1,2,3]; sub bar { print $^a }; for @foo &bar
20:56 exp_evalbot kp6: OUTPUT[no method 'APPLY' in Class 'Undef'␤ at compiled/perl5-kp6-mp6/lib/Ki​ndaPerl6/Runtime/Perl5/MOP.pm line 345␤   KindaPerl6::Runtime::Perl5::MO​P::__ANON__('HASH(0x824c37c)', 'APPLY', 'HASH(0x8e5ce00)') called at compiled/perl5-kp6-mp6/lib/Ki​ndaPerl6/Runtime/Perl5/MOP.pm line 169␤
20:56 exp_evalbot ..main::DISPATCH('HASH(0x824c37c)', 'APPLY', 'HASH(0x8e5ce00)') ca...
20:56 exp_evalbot ..pugs: OUTPUT[*** ␤    Unexpected end of input␤    expecting ":", "{", identifier, operator or block construct␤    at /tmp/gYzVezgMdZ line 2, column 1␤]
20:56 exp_evalbot ..rakudo: OUTPUT[too few arguments passed (0) - 1 params expected␤current instr.: 'bar' pc 99 (EVAL_11:35)␤called from Sub '_block11' pc 70 (EVAL_11:27)␤called from Sub 'parrot;PCT::HLLCompiler;eval' pc 785 (src/PCT/HLLCompiler.pir:458)␤called from Sub 'parrot;PCT::HLLCompiler;evalfiles' pc 1067
20:56 exp_evalbot ..(src/PCT/HLLCompiler.pir:587)␤called from Sub 'parrot;PCT::H...
20:56 Eevee perl6: my @foo = [1,2,3]; my $bar = sub { print $^a }; for @foo $bar
20:57 exp_evalbot kp6: OUTPUT[no method 'APPLY' in Class 'Undef'␤ at compiled/perl5-kp6-mp6/lib/Ki​ndaPerl6/Runtime/Perl5/MOP.pm line 345␤   KindaPerl6::Runtime::Perl5::MO​P::__ANON__('HASH(0x824c4ec)', 'APPLY', 'HASH(0x8e53cf4)') called at compiled/perl5-kp6-mp6/lib/Ki​ndaPerl6/Runtime/Perl5/MOP.pm line 169␤
20:57 exp_evalbot ..main::DISPATCH('HASH(0x824c4ec)', 'APPLY', 'HASH(0x8e53cf4)') ca...
20:57 exp_evalbot ..pugs: OUTPUT[*** ␤    Unexpected "$bar"␤    expecting operator or block construct␤    at /tmp/Sev1RJ3fWF line 1, column 58␤]
20:57 exp_evalbot ..rakudo: OUTPUT[Statement not terminated properly at line 1, near "$bar"␤current instr.: 'parrot;PGE::Util;die' pc 120 (runtime/parrot/library/PGE/Util.pir:82)␤called from Sub 'parrot;Perl6::Grammar;statementlist' pc 17940 (src/gen_grammar.pir:2661)␤called from Sub
20:57 exp_evalbot ..'parrot;Perl6::Grammar;statement_block' pc 15006 (src/gen_grammar.pir:1611)␤called from Su...
20:57 Eevee rakudo: my @foo = [1,2,3]; my $bar = sub { print $^a }; for @foo, $bar;
20:57 exp_evalbot OUTPUT[Could not invoke non-existent sub for␤current instr.: '_block11' pc 84 (EVAL_11:35)␤called from Sub 'parrot;PCT::HLLCompiler;eval' pc 785 (src/PCT/HLLCompiler.pir:458)␤called from Sub 'parrot;PCT::HLLCompiler;evalfiles' pc 1067 (src/PCT/HLLCompiler.pir:587)␤called from Sub
20:57 exp_evalbot ..'parrot;PCT::HLLCompiler;command_line' pc 1246 (src/PCT/HLLCompile...
20:58 [particle] rakudo: my @foo = [1,2,3]; my $bar = sub { print $^a }; $bar($_) for @foo;
20:58 exp_evalbot OUTPUT[123]
20:58 Eevee evalbot should probably just go "that didn't work" on parse errors
20:58 [particle] i think it's nice to tell you how it didn't work
20:59 wolverian Eevee, I think the lack of a comma is a property of the -> operator, not the for
20:59 Tene Again I'm seeing the "@foo = [...]" problem.
20:59 Tene That's the same as @foo := [ [...] ];
20:59 Eevee yeah but the backtrace is a little..  unnecessary
20:59 Tene Putting a list in @foo[0]
20:59 peeps[work] joined #perl6
21:00 Eevee rakudo: my @foo = [1,2,3]; say @foo[0];
21:00 exp_evalbot OUTPUT[1␤]
21:00 Tene Eevee: rakudo doesn't handle lists properly yet.
21:01 Eevee pugs: my @foo = [1,2,3]; say @foo[0];
21:01 exp_evalbot OUTPUT[1 2 3␤]
21:01 Eevee ah.
21:02 Eevee what exactly is [] constructing then?  if everything's an object now I'd assume everything's a reference, and thus from a user point of view references don't exist
21:03 Tene Hm...
21:03 Tene rakudo: for @foo, { say $^a }
21:03 exp_evalbot OUTPUT[A signature must not be defined on a sub that uses placeholder vars. at line 1, near " }"␤current instr.: 'parrot;PGE::Util;die' pc 120 (runtime/parrot/library/PGE/Util.pir:82)␤called from Sub 'parrot;Perl6;Grammar;Actions;_block2302' pc 109941 (src/gen_actions.pir:4313)␤called from Sub
21:03 exp_evalbot ..'parrot;Perl6;Grammar;Actions;_block2297' pc 109370 ...
21:03 Tene That's not quite right.
21:04 [particle] rakudo: for @foo { say $^a }
21:04 exp_evalbot OUTPUT[A signature must not be defined on a sub that uses placeholder vars. at line 1, near " }"␤current instr.: 'parrot;PGE::Util;die' pc 120 (runtime/parrot/library/PGE/Util.pir:82)␤called from Sub 'parrot;Perl6;Grammar;Actions;_block2302' pc 109941 (src/gen_actions.pir:4313)␤called from Sub
21:04 exp_evalbot ..'parrot;Perl6;Grammar;Actions;_block2297' pc 109370 ...
21:04 [particle] er, wait
21:04 Tene I'm curious why it things a signature is defined on that block.
21:04 Tene thinks.
21:04 Eevee pugs: for @foo { say $^a }
21:04 exp_evalbot OUTPUT[*** ␤    Unexpected " {"␤    expecting "::"␤    Variable "@foo" requires predeclaration or explicit package name␤    at /tmp/8rbJnBXDew line 1, column 9␤]
21:04 [particle] rakudo: for @foo -> $^a { say $^a }
21:04 exp_evalbot OUTPUT[Statement not terminated properly at line 1, near "-> $^a { s"␤current instr.: 'parrot;PGE::Util;die' pc 120 (runtime/parrot/library/PGE/Util.pir:82)␤called from Sub 'parrot;Perl6::Grammar;statementlist' pc 17940 (src/gen_grammar.pir:2661)␤called from Sub
21:04 exp_evalbot ..'parrot;Perl6::Grammar;statement_block' pc 15006 (src/gen_grammar.pir:1611)␤called f...
21:04 [particle] (checking pblock)
21:04 Tene for @foo -> $a { say $a }
21:05 Tene rakudo: my @foo = 1, 2, 3; for @foo -> $a { say $a }
21:05 exp_evalbot OUTPUT[get_iter() not implemented in class 'Integer'␤current instr.: '_block11' pc 67 (EVAL_12:29)␤called from Sub 'parrot;PCT::HLLCompiler;eval' pc 785 (src/PCT/HLLCompiler.pir:458)␤called from Sub 'parrot;PCT::HLLCompiler;evalfiles' pc 1067 (src/PCT/HLLCompiler.pir:587)␤called from Sub
21:05 exp_evalbot ..'parrot;PCT::HLLCompiler;command_line' pc 1246 (src/PCT/HL...
21:05 Eevee wait what
21:05 Eevee why is it trying to iterate over an integer
21:05 [particle] problems with list context
21:05 Tene I'm checking...
21:06 Eevee rakudo: my @foo = 4, 5, 6; say @foo[0], "\t", @foo;
21:06 exp_evalbot OUTPUT[get_pmc_keyed() not implemented in class 'Integer'␤current instr.: '_block11' pc 67 (EVAL_10:29)␤called from Sub 'parrot;PCT::HLLCompiler;eval' pc 785 (src/PCT/HLLCompiler.pir:458)␤called from Sub 'parrot;PCT::HLLCompiler;evalfiles' pc 1067 (src/PCT/HLLCompiler.pir:587)␤called from Sub
21:06 exp_evalbot ..'parrot;PCT::HLLCompiler;command_line' pc 1246 (src/P...
21:06 Eevee rakudo: my @foo = 4, 5, 6; say @foo;
21:06 exp_evalbot OUTPUT[4␤]
21:06 [particle] rakudo: my @foo = [1, 2, 3]; for @foo -> $a { say $a }
21:06 exp_evalbot OUTPUT[1␤2␤3␤]
21:06 [particle] rakudo: my @foo = [1, 2, 3]; for @foo { say $^a }
21:06 exp_evalbot OUTPUT[A signature must not be defined on a sub that uses placeholder vars. at line 1, near " }"␤current instr.: 'parrot;PGE::Util;die' pc 120 (runtime/parrot/library/PGE/Util.pir:82)␤called from Sub 'parrot;Perl6;Grammar;Actions;_block2302' pc 109941 (src/gen_actions.pir:4313)␤called from Sub
21:06 exp_evalbot ..'parrot;Perl6;Grammar;Actions;_block2297' pc 109370 ...
21:06 Tene rakudo: my $f = [1, 2, 3]; for $f -> $a { say $a }
21:06 exp_evalbot OUTPUT[1␤2␤3␤]
21:07 [particle] yep, see, it's treating @foo just like $f
21:07 wolverian Eevee, [1,2,3] === Array.new(1,2,3). the type of (1,2,3) depends on its context.
21:08 Eevee wolverian: I would kinda expect `@foo = Array.new(whatever)` to work like in javascript
21:08 pmichaud rakudo doesn't understand lists yet
21:08 pmichaud if you want to create an array, it's pretty much either
21:09 pmichaud my @f = (4, 5, 6);
21:09 pmichaud or
21:09 pmichaud my @f = <4 5 6>
21:09 Tene Eevee: Yes, most people do expect that, but that's not what the spec says.
21:09 Tene The spec says that the rhs of assigning to a list is in list context.
21:09 wolverian the @foo is already an array
21:09 wolverian that's what the @ means
21:10 Eevee wolverian: my Foo $foo = Foo.new() -- the $foo is already a Foo
21:10 pmichaud with  for @foo { say $^a }    I suspect that rakudo may be hard-coding a   -> $_   onto the block
21:10 Tene Ahh, look at method pblock.
21:11 Tene It does exactly that.
21:11 Tene Is that a special case?
21:11 wolverian Eevee, no, the value of $foo can be a Foo
21:11 pmichaud it was put in to get the 01-sanity tests passing.  The code isn't correct as written.
21:11 wolverian Eevee, $foo itself is Scalar
21:12 Tene pmichaud: do you know what the correct solution is?
21:12 pmichaud I'd have to go back and look at the code -- I put that in last December
21:12 pmichaud and haven't looked at it since :-)
21:13 Tene I'll look at it tonight.
21:13 pmichaud the part I'm not entirely clear on is when a block gets promoted to a -> $_   block
21:13 pmichaud and I think that might've changed in the past five months, anyway.
21:13 Eevee mm.  I can see the rationale but I can also see a lot of people tripping over it
21:14 Tene Eevee: My big objection is that I see a lot of people actually making that same mistake.
21:14 Tene I see a lot of people saying: @foo = [ ... ]
21:14 Eevee I can, in fact, literally see a lot of people tripping over it  :P
21:14 wolverian well. complain to larry. :)
21:14 Eevee I don't know what a good alternative is though
21:14 wolverian right.
21:15 Tene It seems kind of like the "sigils are weird" complaints.  Sure it makes sense, but real people actually have a hard time remembering it before they learn it well.
21:15 wolverian removing list flattening altogether is one.
21:15 wolverian and with it, contexts.
21:15 wolverian (context would be just return type polymorphism, though maybe it already is)
21:15 wolverian I doubt that'll fly though. :)
21:16 Eevee main problem being, what if I go my @foo = [1,2], [3,4] -- should it really be an entire dimension different from my @foo = [1,2]
21:16 Eevee maybe emit a warning when assigning a bare scalar to an array var
21:16 Tene in 'for @foo, { ... }', the {} is parsed as a pblock.
21:16 pmichaud tene: yes, but do all pblocks default to a -> $_ signature?
21:17 pmichaud it's not a question of parsing as much as semantics
21:17 Tene pmichaud: in rakudo they do unless there's a different signature already.
21:17 peepsalot joined #perl6
21:18 pmichaud tene:  I'm pretty sure rakudo is wrong there -- again, all I did was implement something to get 01-sanity to pass.  I wasn't aiming for correctness.
21:18 * Tene nods.
21:18 Tene So the question is what the specs say about whether $f = { ... } accepts any args.
21:19 pmichaud A bare closure without placeholder arguments that uses $_ (either explicitly or implicitly) is treated as though $_ were a formal parameter:
21:19 pmichaud $func = { .print if $_ };   # Same as: $func = -> $_ { .print if $_ };
21:19 Tene If @_ or %_ are used in the block, they get added to the signature.
21:19 pmichaud (from S04)
21:19 Tene pmichaud: what about just: $func = { .print };
21:19 Tene That uses $_ implicitly.
21:19 pmichaud 21:13 <pmichaud> the part I'm not entirely clear on is when a block gets promoted to a -> $_   block
21:19 pmichaud :-)
21:19 Tene does that count?
21:19 Tene Heh.
21:20 pmichaud more in S04:
21:20 pmichaud However, use of $_ with a conditional statement's block is not considered sufficiently explicit to turn a 0-ary block into a 1-ary function, so both these methods use the same invocant:
21:20 pmichaud if .haste { .waste }
21:20 pmichaud (Contrast with a non-conditional statement such as:
21:20 pmichaud for .haste { .waste }
21:20 pmichaud where each call to the block would bind a new invocant for the .waste method, each of which is likely different from the original invocant to the .haste method.)
21:21 [particle] urk
21:21 [particle] sounds fun to implement.
21:21 Tene So it should be 'for' itself that adds $_ if it's not already there?
21:21 [particle] yes, for, and not if
21:21 Tene Okay.  I can do that.
21:21 [particle] for takes a pblock
21:21 pmichaud the for statement should check the block for a signature, and add $_ if it doesn't already have one.
21:21 [particle] i don't think if does
21:21 pmichaud if takes a pblock also
21:22 pmichaud if    testa() -> $a { say $a }
21:22 pmichaud (pct doesn't support that yet -- that's another item I have to figure out how to do.)
21:22 Eevee oh cool
21:23 Eevee equivalent to perl 5 `if (my $a = testa()) { print "$a\n" }`?
21:23 pmichaud mostly, yes.
21:23 pmichaud (I don't know the scope of the 'my' in the p5 case)
21:23 [particle] it's internal to the if, in modern perls
21:23 Eevee it used to be the containing block, but at some point if()s got their own scope
21:23 Eevee yeah
21:23 pmichaud I never write code like that.  :-)
21:24 pmichaud for precisely that reason.  :-)
21:24 [particle] (assignment in conditional)--
21:24 Eevee I see it on occasion
21:24 pmichaud but yes, the p6 syntax is much more obvious and consistent.
21:24 Tene Okay, lunchtime.
21:24 Eevee yeah, I like that
21:24 Tene Then maybe hacking, or maybe work.
21:24 pmichaud @Larry++
21:24 lambdabot Unknown command, try @list
21:24 Eevee haha
21:25 Eevee what else was I going to say/ask about for..
21:26 pmichaud oh, I think I know how to solve the  if testa() -> $a { ... }  problem in pct
21:26 pmichaud cool.
21:26 pmichaud way too many solutions.  way too little time.
21:27 Eevee whoops, I thought of three things
21:27 Eevee is there an @array.kv or similar?  so I can go for @array.kv -> $i, $elem { ... }
21:28 [particle] eevee: yes
21:29 Eevee hooray
21:31 Eevee #2: `my @array = foo(); for @array { ... }; if (not @array) { ... }` seems to happen often enough to be irritating, yet no language has `for foo() { ... } else { ... }`
21:31 Eevee or 'empty' instead of 'else', or..  something
21:33 araujo joined #perl6
21:33 pmichaud python has an 'else' clause, I think.
21:34 [particle] yes, they do
21:34 mib_1864dswq joined #perl6
21:35 REPLeffect joined #perl6
21:35 Eevee really?
21:35 Eevee so it does.  didn't know that
21:35 Eevee clearly we also need one
21:35 Eevee oh, wait, no
21:36 Eevee python's is different
21:36 Eevee "When the items are exhausted (which is immediately when the sequence is empty), the suite in the else clause, if present, is executed, and the loop terminates."
21:36 pmichaud right, just checking that.
21:36 Eevee so it's for running code after the for is done, but not if it was broken out of
21:37 Eevee which I doubt perl needs, when it has block labels
21:37 mib_1864dswq pmichaud: where is the best place to ask a rakudo implementation question?
21:38 [particle] this chan works fine
21:38 pmichaud mib:  either here or #parrot
21:38 [particle] #parrot is on irc.perl.org fyi
21:38 pmichaud or on perl6-compiler@perl.org for mailing list questions
21:38 mib_1864dswq I was playing with rakudo and I found that .kv didn't work yet:  Method 'kv' not found for invocant of class 'Hash'
21:38 pmichaud correct, we haven't implemented .kv yet.
21:39 pmichaud there's a patch for it, but it needs a bit of work.
21:39 mib_1864dswq So I decided to dive into the code and see if I could implement it
21:39 mib_1864dswq But, it seems that nothing I do to Hash.pir has any effect
21:39 pmichaud I'm not agreeable with the current Hash implementation in rakudo.
21:39 pmichaud so it doesn't surprise me if it doesn't work :-)
21:40 mib_1864dswq Is languages/perl6/src/classes/Hash.pir the right place to look?
21:40 mib_1864dswq Or should I just not bother...
21:41 Eevee I should really give the rakudo source a perusal
21:41 pmichaud I'd have to check on Hash.pir
21:41 pmichaud the implementation for Rakudo's Hash was changed earlier in the year (by someone other than me) and I haven't had a chance to figure it out other than to note that I think it's "wrong" (for some value of "wrong")
21:42 Eevee how..  approachable is rakudo?
21:42 pmichaud easier than one might think
21:42 [particle] it's not C, for one :)
21:42 pmichaud but it's also frustrating at times
21:42 mib_1864dswq Ok.  In the file (Hash.pir) it seems that the class is Perl6Hash
21:42 pmichaud some parts that seem like they ought to be easy aren't.
21:42 pmichaud (Perl6Hash)  that's the part I don't like.  It got cargo-culted from the Str/Perl6Str implementation when it shouldn't have been.
21:43 pmurias [particle]: i would say pir is preferable to C
21:44 mib_1864dswq Trying .values doesn't work either, thought that is implemented in the Hash.pir file
21:44 pmichaud right, there's a class mapping problem there.
21:44 mib_1864dswq That is what I figured was going on
21:44 mib_1864dswq Thanks for the info - &supper
21:44 pmichaud I think what I'm saying is that what you're trying to do _should_ be easy, and you're probably doing it the right way, but rakudo is fundamentally flawed in its current implementation of Hash
21:45 pmichaud so that it's not working.
21:45 pmichaud I should probably see about fixing that.  But it may involve updating the protoobject mess as well.
21:45 [particle] luckily, the fundamentals are still pretty accessible
21:45 pmichaud yes, and getting easier all the time.
21:46 pmichaud the latest compiler tools update simplifies a bunch of stuff.
21:48 lisppaste3 joined #perl6
22:05 Eevee perl6: my @foo := [1,2,3]; say @foo;
22:05 exp_evalbot kp6: OUTPUT[1 2 3␤]
22:05 exp_evalbot ..pugs: OUTPUT[1 2 3␤]
22:05 exp_evalbot ..rakudo: OUTPUT[123␤]
22:06 sscaffidi_ joined #perl6
22:10 moritz_ perl6: my @foo = [1, 2, 3]; say |@foo;
22:10 exp_evalbot kp6: OUTPUT[1 2 3␤]
22:10 exp_evalbot ..pugs: OUTPUT[123␤]
22:10 exp_evalbot ..rakudo: OUTPUT[␤get_bool() not implemented in class 'Junction'␤current instr.: 'parrot;PCT::HLLCompiler;command_line' pc 1290 (src/PCT/HLLCompiler.pir:688)␤called from Sub 'parrot;Perl6::Compiler;main' pc 9647 (perl6.pir:187)␤]
22:10 moritz_ rakudo tries to parse that as a *Junction*?
22:11 Eevee er.  what's unary prefix pipe do?
22:12 moritz_ pugs: sub foo($a, $b){ say "$a|$b" }; my @c=<a b>; foo(@c)
22:12 exp_evalbot OUTPUT[*** No compatible multi variant found: "&foo"␤    at /tmp/FumAOE9mOZ line 1, column 46 - line 2, column 1␤]
22:12 moritz_ pugs: sub foo($a, $b){ say "$a|$b" }; my @c=<a b>; foo(|@c)
22:12 exp_evalbot OUTPUT[a|b␤]
22:13 moritz_ Eevee: that's the difference: it flattens an array into a capture (which is used for sub calls)
22:13 moritz_ in Perl 6 my_sub(@array) actually looks for a multi which expects an array
22:16 Eevee aha, thought that was *.  maybe it used to be, or maybe too much python
22:18 Limbic_Region joined #perl6
22:20 moritz_ * is the thing that you put into the signature IIRC
22:21 moritz_ pugs: sub foo(*@args){say @args}; foo(2, 3)
22:21 exp_evalbot OUTPUT[23␤]
22:21 moritz_ pugs: sub foo(@args){say @args}; foo(2, 3)
22:21 exp_evalbot OUTPUT[*** No compatible multi variant found: "&foo"␤    at /tmp/huZVYh6NNy line 1, column 28 - line 2, column 1␤]
22:21 moritz_ pugs: sub foo(|@args){say @args}; foo(2, 3)
22:21 exp_evalbot OUTPUT[*** No compatible multi variant found: "&foo"␤    at /tmp/COiDGWru0H line 1, column 29 - line 2, column 1␤]
22:21 moritz_ aye, what I said
22:22 Eevee pugs: sub foo (|@args){say @args}; my @bar = (1,2); foo(||@bar);
22:22 exp_evalbot OUTPUT[*** ␤    Unexpected "||@"␤    expecting ":", identifier or ")"␤    at /tmp/Bs9DkQYq7A line 1, column 51␤]
22:22 moritz_ off to bed now, good localtime() everybody
22:22 Eevee night
22:22 Eevee pugs: sub foo (|@args){say @args}; my @bar = (1,2); foo(|(|@bar));
22:22 exp_evalbot OUTPUT[*** No compatible multi variant found: "&foo"␤    at /tmp/U1G1W7VI7o line 1, column 47-60␤]
22:22 Eevee huh.  wonder what it expects |@args in the signature to be then
22:33 meppl good night
22:35 * Eevee unsure about the inconsistency; reads spec
23:40 mib_1864dswq I played around with Hash.pir a bit more and if I change the namespace to 'Hash', rather than 'Perl6Hash' things seem to work.
23:44 mib_1864dswq Adding kv to Hash.pir after that was trivial

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

Perl 6 | Reference Documentation | Rakudo