Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2010-12-19

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:03 Tene takadonet1: you tried to use a placeholder in a sub with a signature.
00:03 Tene rakudo: sub foo($n) { say $^a }; foo(5);
00:03 p6eval rakudo a95c1d: OUTPUT«===SORRY!===␤Placeholder variable cannot override existing signature at line 22, near "; foo(5);"␤»
00:03 Tene see?
00:03 takadonet1 ... some wha
00:03 takadonet1 what*
00:04 Tene takadonet1: placeholders are an *alternative* to using a signature.
00:06 takadonet1 well i need a signature in this case
00:06 takadonet1 well i think so
00:06 Tene Then put the placeholder you're trying to use in the signature instead.
00:06 Tene Perhaps we could see the code?
00:07 nymacro joined #perl6
00:07 takadonet1 Currently it's over two module and about to leave .....
00:07 takadonet1 trying to golf it down as we speak
00:08 Tene takadonet1: quick explanation of placeholders: the following two functions are equivalent: sub foo($a, $b) { say $a + $b }; sub bar { say $^a + $^b };
00:08 Tene also: sub foo(:$a, :$b) { $a+$b }; sub bar { $:a + $:b }
00:09 takadonet1 ic
00:09 Tene so instead of listing a formal signature, you annotate at least the first usage of that variable with a twigil, and all so-marked placeholder variables are aggregated, sorted alphabetically, and used to construct an implicit signature.
00:10 Tene This is incompatible with an explicitly-listed signature, as the combination would be non-obvious.
00:10 Tene So you're using $^foo or $:foo somewhere in your code, where you don't actually mean to be.
00:10 Tene So, search for those twigils
00:11 takadonet1 Tene: thanks for the help
00:11 takadonet1 sucks that I gtg :(
00:11 Tene takadonet1: np glad to help
00:21 drbean_ is now known as drbean
00:41 ardeshir joined #perl6
01:03 obsd123 left #perl6
01:03 Trashlord left #perl6
01:09 jedai_ joined #perl6
01:11 jedai left #perl6
01:13 morphbot joined #perl6
01:13 morphbot left #perl6
01:21 lopnor is now known as lopaway
01:24 nym joined #perl6
01:27 nymacro left #perl6
01:37 shi left #perl6
01:53 obsd123 joined #perl6
02:10 drbean left #perl6
02:11 drbean joined #perl6
02:32 ponbiki left #perl6
02:41 lopaway is now known as lopnor
02:43 molaf__ joined #perl6
02:46 ponbiki joined #perl6
02:46 molaf_ left #perl6
02:49 felliott joined #perl6
03:00 f00li5h joined #perl6
03:05 whiteknight left #perl6
03:06 lopnor is now known as lopaway
03:07 lopaway is now known as lopnor
03:19 lopnor is now known as lopaway
03:32 felliott left #perl6
03:35 Bonham left #perl6
03:36 lamstyle left #perl6
03:42 adu joined #perl6
03:43 lamstyle joined #perl6
03:45 lamstyle left #perl6
03:47 adu left #perl6
03:49 lopaway is now known as lopnor
03:52 adu joined #perl6
03:53 lamstyle joined #perl6
03:53 jferrero left #perl6
03:54 adu left #perl6
03:58 lopnor is now known as lopaway
04:04 lamstyle left #perl6
04:06 risou joined #perl6
04:10 Chillance left #perl6
04:10 cognominal joined #perl6
04:11 ardeshir left #perl6
04:14 lamstyle joined #perl6
04:15 adu joined #perl6
04:20 Caffeine joined #perl6
04:22 plobsing joined #perl6
04:26 adu left #perl6
04:29 adu joined #perl6
04:33 uasi joined #perl6
04:40 uasi rakudo: class A::B {}; my $x = "A::B".new; say "alive"; $x.WHAT;
04:40 p6eval rakudo a95c1d: OUTPUT«Null PMC access in get_repr()␤  in main program body at line 22:/tmp/FvJxQWrYBc␤»
04:40 uasi class A {}; my $x = "A".new; $x.WHAT; say "alive";
04:40 uasi rakudo: class A {}; my $x = "A".new; $x.WHAT; say "alive";
04:40 p6eval rakudo a95c1d: OUTPUT«alive␤»
04:43 Tene .u ∿
04:43 phenny U+223F SINE WAVE (∿)
04:44 TimToady rakudo: "A".new.WHAT.say
04:44 p6eval rakudo a95c1d: OUTPUT«Null PMC access in get_repr()␤  in main program body at line 22:/tmp/fJmPPOils1␤»
04:45 masonkramer_ joined #perl6
04:45 masonkramer left #perl6
04:45 masonkramer_ is now known as masonkramer
04:46 TimToady rakudo: "Int".new.WHAT.say
04:46 p6eval rakudo a95c1d: OUTPUT«Int()␤»
04:46 TimToady that's just so wrong
04:47 uasi 'nested_or_non-our-scoped_class'.new causes Null PMC access
04:48 TimToady it should create a Str
04:48 uasi er, _or_nonexistent
04:48 * uasi nods
04:49 TimToady say "Int".WHAT
04:49 orafu left #perl6
04:49 TimToady rakudo: say "Int".WHAT
04:49 p6eval rakudo a95c1d: OUTPUT«Str()␤»
04:49 TimToady rakudo: say "Int".WHAT.new.WHAT
04:49 p6eval rakudo a95c1d: OUTPUT«Str()␤»
04:49 TimToady :)
04:49 uasi oh
04:51 TimToady say "Int".bless(*).WHAT
04:51 TimToady rakudo: say "Int".bless(*).WHAT
04:51 p6eval rakudo a95c1d: OUTPUT«Int()␤»
04:51 TimToady wrong
04:53 orafu joined #perl6
04:58 TimToady niecza: say "Int".bless(*).WHAT
04:58 p6eval niecza 406e042: OUTPUT«Unhandled exception: Unable to resolve method bless in class Str␤  at  line 1 (MAIN mainline @ 2)␤  at  line 992 (SAFE G1322ANONC @ 1)␤  at  line 992 (SAFE module-SAFE @ 29)␤  at  line 992 (SAFE mainline @ 1)␤  at  line 0 (boot-MAIN @ 1)␤  at  line 0 (ExitRunloop @ 0)␤"mono"
04:58 p6eval ..unexpe…
04:58 fith Should "SomeChars".new.WHAT = Str?
04:59 fith rakudo: "Blah".new.WHAT.say
04:59 p6eval rakudo a95c1d: OUTPUT«Null PMC access in get_repr()␤  in main program body at line 22:/tmp/xkZYycZ9pr␤»
04:59 fith rakudo: "Int".new.WHAT.say
04:59 p6eval rakudo a95c1d: OUTPUT«Int()␤»
04:59 fith rakudo: "Str".new.WHAT.say
04:59 TimToady yes, .bless is supposed to only pay attention to the "WHAT" of its invocant
04:59 p6eval rakudo a95c1d: OUTPUT«Str()␤»
04:59 uasi TimToady: we've discussed 'Foo'.new thing a few days ago, and pmichaud said the problem can be worked around http://irclog.perlgeek.de/perl6/2010-12-14#i_3086639
04:59 fith Ah okay, so what's between the ""'s shouldn't matter
04:59 TimToady sure, it can be worked around
05:01 TimToady new and bless are only supposed to pay attention to the type; it's like asking what the "charge" of a particle is without paying attention to its other attributes
05:01 fith OHH, okay, I see what you mean now.
05:02 TimToady undefined type objects are just charge carriers that don't happen to have actual data
05:03 plobsing left #perl6
05:03 uasi phenny: tell masak 'A::B'.new *is* the bug. see http://irclog.perlgeek.de/perl6/2010-12-19#i_3103401
05:03 phenny uasi: I'll pass that on when masak is around.
05:05 TimToady seems the fundamental problem is actually in .bless
05:06 TimToady anyway, this is probably parrot's p5ish semantics showing through
05:07 TimToady (p5 confused class names with strings all the time)
05:08 TimToady ::() is the only thing that knows how to turn a string into a class (without using eval, that is)
05:19 obsd123 left #perl6
05:39 ch3ck left #perl6
05:50 satyavvd joined #perl6
05:53 satyavvd_ joined #perl6
05:54 satyavvd left #perl6
05:54 satyavvd_ is now known as satyavvd
06:13 Helios left #perl6
06:13 Helios joined #perl6
06:15 satyavvd left #perl6
06:15 Helios left #perl6
06:19 Helios joined #perl6
06:24 redicaps left #perl6
06:57 obsd123 joined #perl6
06:57 adu left #perl6
07:12 adu joined #perl6
07:32 satyavvd joined #perl6
07:37 flussence_ joined #perl6
07:39 flussence left #perl6
07:40 kfo joined #perl6
07:43 kfo_ left #perl6
07:48 ponbiki left #perl6
07:48 ponbiki joined #perl6
07:55 satyavvd_ joined #perl6
07:55 ponbiki left #perl6
07:57 satyavvd_ left #perl6
07:59 satyavvd left #perl6
08:00 ponbiki joined #perl6
08:16 envi joined #perl6
08:19 glow joined #perl6
08:19 Trashlord joined #perl6
08:24 obsd123 left #perl6
08:27 jhuni left #perl6
08:28 adu left #perl6
08:28 ponbiki left #perl6
08:35 ponbiki joined #perl6
08:43 ponbiki left #perl6
08:52 ponbiki joined #perl6
09:00 PacoLinux left #perl6
09:00 ponbiki left #perl6
09:01 justatheory left #perl6
09:37 PacoLinux joined #perl6
09:44 _kaare joined #perl6
09:49 moritz_ good morning
09:54 moritz_ cotto: which perl are you running?
09:56 cotto moritz_, whatever's default on feather
09:57 cotto looks like 5.10.1
09:58 zby_home joined #perl6
09:59 moritz_ cotto: the default perl in $PATH is one in /usr/local/
10:00 moritz_ so it won't pick up packages installed via apt
10:00 * moritz_ installs a new Bot::BasicBot with cpanm
10:09 redicaps joined #perl6
10:10 redicaps left #perl6
10:12 araujo left #perl6
10:31 rgrau joined #perl6
11:28 envi left #perl6
11:32 envi joined #perl6
11:33 risou left #perl6
11:34 dju joined #perl6
11:37 dju left #perl6
11:38 dju joined #perl6
11:38 dju left #perl6
11:38 dju joined #perl6
11:43 risou joined #perl6
11:45 am0c joined #perl6
11:48 am0c_ joined #perl6
11:52 am0c left #perl6
11:52 MayDaniel joined #perl6
11:54 am0c_ left #perl6
12:15 MayDaniel left #perl6
12:27 neroxx joined #perl6
12:40 uasi rakudo: {}.hash
12:40 p6eval rakudo a95c1d: OUTPUT«Method 'hash' not found for invocant of class ''␤  in main program body at line 22:/tmp/MtYgzAJC02␤»
12:40 Trashlord what :|
12:40 uasi rakudo: (a => 1).hash.hash
12:40 p6eval rakudo a95c1d: OUTPUT«Method 'hash' not found for invocant of class ''␤  in main program body at line 22:/tmp/9k7cyOL80J␤»
12:40 uasi rakudo: (a => 1).hash
12:40 p6eval rakudo a95c1d:  ( no output )
12:41 uasi rakudo: (a => 1).hash.WHAT.say
12:41 p6eval rakudo a95c1d: OUTPUT«Hash()␤»
12:41 moritz_ rakudo: say (a => 1).hash.PARROT
12:41 p6eval rakudo a95c1d: OUTPUT«␤»
12:41 moritz_ ugh.
12:41 uasi :/
12:41 nero2x joined #perl6
12:43 nero__ joined #perl6
12:46 neroxx left #perl6
12:46 nero2x left #perl6
12:47 whiteknight joined #perl6
12:51 wamba joined #perl6
12:55 jeeger joined #perl6
12:56 jeeger Greetings! Any tips on a perl6 book? I've finally caved in and installed rakudo^^
12:56 tadzik try The Perl 6 Book :)
12:56 tadzik http://perl6.org/documentation/
12:56 moritz_ http://github.com/perl6/book/downloads
12:57 jeeger tadzik: That's too easy^^
12:57 tadzik :)
12:57 cognominal left #perl6
12:58 jeeger Hm, pity that there is no epub version.
12:59 moritz_ jeeger: you could make one
13:00 moritz_ if I understood correctly, epub is mostly xhtml + meta data
13:00 moritz_ there's already a HTML or xhtml make target
13:01 jeeger Hm, I'll try that
13:03 ardeshir joined #perl6
13:07 araujo joined #perl6
13:12 felliott joined #perl6
13:22 jeeger Hm, the epub version looks okay, but converting to lrf killed all structure and highlighting. I'll have a look at the epub version on my reader...
13:22 uasi Adding a hash() method in src/core/Hash.pm solves the {}.hash problem: https://gist.github.com/747323
13:26 moritz_ uasi: can you please send a pull request?
13:27 uasi moritz_: sure
13:29 ardeshir rakudo: say " "x 9-$_,"#"x$_*2-1 for 0..9,2 xx 3;
13:29 p6eval rakudo a95c1d: OUTPUT«         ␤        #␤       ###␤      #####␤     #######␤    #########␤   ###########␤  #############␤ ###############␤#################␤       ###␤       ###␤       ###␤»
13:29 * uasi sent
13:31 cognominal joined #perl6
13:32 moritz_ http://moritz.faui2k3.org/tmp/using-perl-6.zip my very naive attempt of epub conversion
13:35 ardeshir my Int $day = 23;  $day = "Monday"; say $day;
13:37 ardeshir Ah..type check fails.....nice
13:39 ardeshir is my Any $x ==  my $x
13:39 jeeger Hm, Perl6 is working towards being a lisp, but it's still a perl. Yay!
13:39 moritz_ jeeger: it tries to be lisp, but with proper syntax and good names :-)
13:39 tadzik :)
13:40 ardeshir rakudo: my Any $day = 23; $day = "sunday"; say $day;
13:40 p6eval rakudo a95c1d: OUTPUT«sunday␤»
13:41 tadzik ardeshir: you can ommit Any
13:41 tadzik rakudo: my $a = 5; $a = "b"; $a.WHAT.say
13:41 p6eval rakudo a95c1d: OUTPUT«Str()␤»
13:42 ardeshir tadzik: so it is the same as  my $x
13:42 ardeshir i see
13:43 ardeshir p6 is sexy
13:43 tadzik ardeshir: have you used Perl 5?
13:43 ardeshir yes
13:45 ardeshir but i have not read much of the p6 docs yet, will be doing that before adding any more noise here  ;)
13:45 jeeger moritz_: I converted it  to epub with calibre ebook-convert, and it looks pretty nice on my reader.
13:46 moritz_ jeeger: I tried it via the calibre GUI (from the html file), and it mangled the code sections
13:46 moritz_ ie removed whitespaces
13:47 jeeger moritz_: Hm, I've yet to see a code section.
13:47 moritz_ jeeger: scroll down :-)
13:47 jeeger moritz_: Yep, mangled.
13:47 jeeger hmmm
13:49 jeeger moritz_: Hm, the html target doesn't output html. That could be the problem.
13:49 jeeger ah, forget it. Less filtered the tags
13:49 moritz_ it's HTML, but without header (iirc)
13:51 jeeger Hm, reading code on an ereader is not really a good idea
13:56 ardeshir from within p6's REPL (./perl6  !argc) can one load a script?
14:02 Trashlord left #perl6
14:03 Trashlord joined #perl6
14:07 moritz_ eval slurp 'filename.pl'
14:08 ardeshir slurpit... thnx moritz_
14:09 jeeger Aaaaaand we're back on the road to awful, terrible, innuendorific puns.
14:10 moritz_ jeeger: that was harmless. Just wait until jnthn has something to say again :-)
14:11 shi joined #perl6
14:11 felliott left #perl6
14:31 am0c joined #perl6
14:34 Trashlord left #perl6
14:37 timbunce joined #perl6
14:40 timbunce left #perl6
14:46 jeeger left #perl6
14:52 uasi_ joined #perl6
14:53 MayDaniel joined #perl6
14:54 uasi left #perl6
15:06 felliott joined #perl6
15:16 shi left #perl6
15:32 risou left #perl6
15:32 risou joined #perl6
15:38 Intensity left #perl6
15:39 Patterner left #perl6
15:39 rgrau left #perl6
15:40 Psyche^ joined #perl6
15:40 Psyche^ is now known as Patterner
15:43 PerlJam left #perl6
15:43 PerlJam joined #perl6
15:44 nym left #perl6
15:46 Chillance joined #perl6
15:48 skangas joined #perl6
15:52 nero__ left #perl6
16:04 am0c left #perl6
16:15 rhr left #perl6
16:18 jeeger joined #perl6
16:21 rhr joined #perl6
16:30 dalek rakudo: a82071b | uasi++ | src/core/Hash.pm:
16:30 dalek rakudo: Implement Hash.hash
16:30 dalek rakudo:
16:30 dalek rakudo: Signed-off-by: Moritz Lenz <moritz@faui2k3.org>
16:30 dalek rakudo: review: https://github.com/rakudo/rakudo/commit/a82071b1a1
16:35 shortcircuit This channel went on a pun spree, and I missed it? :(
16:39 MayDaniel left #perl6
16:45 plobsing joined #perl6
16:45 masonkramer left #perl6
16:45 masonkramer joined #perl6
16:47 moritz_ wasn't really much punning
16:51 tobij is now known as churchill
17:00 sftp left #perl6
17:01 sftp joined #perl6
17:23 masak joined #perl6
17:23 masak y0, zebras.
17:23 phenny masak: 05:03Z <uasi> tell masak 'A::B'.new *is* the bug. see http://irclog.perlgeek.de/perl6/2010-12-19#i_3103401
17:23 masak well, yes and no.
17:24 masak I'm already aware that Str.new shouldn't behave like it does in Rakudo.
17:24 felliott left #perl6
17:24 masak so... on second thought, maybe this Null PMC access wasn't really worth reporting.
17:24 masak (because it'll be fixed once the Str.new security hole is plugged)
17:24 tadzik hey masak
17:24 wamba left #perl6
17:24 masak hi! \o/
17:31 MayDaniel joined #perl6
17:34 justatheory joined #perl6
17:37 cschimm1 joined #perl6
17:44 uasi_ masak: I mean, RT #80958 is missing the point
17:47 masak yes. thinking of merging it with the ticket that isn't :)
17:47 Trashlord joined #perl6
17:47 Util left #perl6
17:47 Util joined #perl6
17:50 masak uasi_: http://rt.perl.org/rt3/Ticket/Display.html?id=73144
17:50 MayDaniel left #perl6
17:50 * masak merges
17:51 uasi_ masak++
17:57 envi left #perl6
18:06 ch3ck joined #perl6
18:07 uasi_ masak: it would be enough just to close #80958, since doing .WHAT doesn't matter
18:08 masak true. I could have done that, too.
18:09 dalek rakudo: 96d7e0d | KodiB++ | src/core/Temporal.pm:
18:09 dalek rakudo: [Temporal] Made the seconds part of Instant.Str use a leading 0 like DateTime.Str.
18:09 dalek rakudo:
18:09 dalek rakudo: Thanks to
18:09 dalek rakudo: http://perl6advent.wordpress.com/2010/12/16/day-16-time-in-perl6/#comment-559
18:09 dalek rakudo: for the observation.
18:09 dalek rakudo: review: https://github.com/rakudo/rakudo/commit/96d7e0d1e5
18:15 uasi_ thinking how I can fix that
18:15 * uasi_ needs parrot-fu
18:26 takadonet1 hey all
18:26 tadzik hey
18:27 moritz_ a parrot walks into a bar and says "Null PMC access in Beer"
18:28 takadonet1 ...
18:28 tadzik the bartender says: I'm shaked, not mixed
18:30 tadzik or: .WHAT?
18:36 Axius joined #perl6
18:42 abhi_ joined #perl6
18:42 abhi_ hi
18:42 abhi_ anyone there
18:42 colomon o/
18:43 moritz_ oh hai
18:43 abhi_ o/ colomon
18:43 takadonet1 abhi_: yo
18:43 * moritz_ just wondered why booting my laptopt didn't work with the self-built kernel
18:43 moritz_ turned out I forgot ext4 support, and guess what the root file system is... :-)
18:44 takadonet1 hehe
18:44 colomon whoops!
18:44 abhi_ newbie to iRC
18:45 moritz_ now building a new kernel, and wishing for more cores
18:45 moritz_ abhi_: welcome
18:45 abhi_ thanks moritz
18:46 abhi_ sorry for your laptop thing
18:46 moritz_ no problem, just own stupidity :-)
18:46 risou left #perl6
18:47 abhi_ you all guys are working on perl 6
18:47 tadzik some on, some in
18:47 masak some merely interested.
18:48 moritz_ some are learning it, some are using it
18:48 masak some are lurkers with very persistent sessions ÖP
18:48 masak :P
18:49 shi joined #perl6
18:49 abhi_ and some r masters!!!!!!!!
18:49 abhi_ i have used perl 5 in ma college days
18:50 MayDaniel joined #perl6
18:50 flussence_ is now known as flussence
18:50 abhi_ how perl 6 is different from perl 5
18:50 abhi_ ??
18:51 masak rakudo: say "like this! :)"
18:51 p6eval rakudo 96d7e0: OUTPUT«like this! :)␤»
18:51 masak rakudo: class A { method foo { say "We have classes built-in" } }; A.new.foo
18:51 p6eval rakudo 96d7e0: OUTPUT«We have classes built-in␤»
18:51 flussence .oO( I wouldn't doubt a few people here have actually mastered R )
18:51 moritz_ abhi_: we tried to correct all those errors that perl 5 made
18:52 masak rakudo: say 01234
18:52 p6eval rakudo 96d7e0: OUTPUT«1234␤»
18:52 * masak submits rakudobug
18:52 moritz_ std: 01234
18:52 p6eval std 625303c: OUTPUT«Potential difficulties:␤  Leading 0 does not indicate octal in Perl 6; please use 0o1234 if you mean that at /tmp/qREqji4lGW line 1:␤------> [32m01234[33m⏏[31m<EOL>[0m␤ok 00:01 118m␤»
18:52 flussence rakudo: say 0o1234
18:52 masak right.
18:52 p6eval rakudo 96d7e0: OUTPUT«668␤»
18:52 flussence rakudo: say '0o1234'.Int # works too
18:52 moritz_ masak: it should warn, but the outcome is OK
18:52 p6eval rakudo 96d7e0: OUTPUT«668␤»
18:52 masak moritz_: nod.
18:53 flussence (is Str.Int just parsing the Str using normal grammar?)
18:53 moritz_ flussence: not yet
18:53 masak moritz_: another place where turning off a particular warning with a pragma would be potentially useful.
18:53 abhi_ oh that really cool
18:54 abhi_ let me start playing with perl
18:54 moritz_ abhi_: have you found http://perl6.org/ already?
18:55 abhi_ yes moritz
18:55 moritz_ great
18:57 abhi_ hey moritz those documentation books are enough for exploring or any other useful blogs
18:59 colomon http://planetsix.perlfoundation.org/
19:02 abhi_ thanks colomon
19:02 betterworld left #perl6
19:02 MayDaniel left #perl6
19:03 betterworld joined #perl6
19:04 masak abhi_: http://perl6advent.wordpress.com/
19:05 colomon masak: planetsix is carrying perl6advent too.  :)
19:05 masak yes, but only this year's posts :)
19:07 colomon oh, fair enough.
19:07 abhi_ thanks to all that was a great help!!
19:07 masak o/\o
19:09 lue ohai world o/
19:12 masak lue: hi. nice blog post.
19:13 molaf__ left #perl6
19:13 lue thank you. It'll be interesting to look at my pod parser code and laugh in embarrasment today :)
19:14 masak I find I laugh in embarrassment over my old code, but less and less.
19:14 lamstyle left #perl6
19:14 masak seems I'm converging on something asymtotically. maybe due to discipline.
19:17 lue I'm going to hunt down what 'actions' are and how to use them, in case I might find them useful.
19:17 masak mind if I give you the quick tour?
19:18 moritz_ lue: did you read the grammar chapter in the book?
19:18 abhi_ i will be back soon with more queries
19:18 abhi_ bye for today
19:18 masak abhi_: we await you with open arms.
19:18 colomon o/
19:19 abhi_ thanks o/
19:20 masak \o
19:20 lue You mean *The Book* ? I honestly have never looked at it, I probably should.
19:20 masak lue:
19:20 masak rakudo: grammar G { regex TOP { ^ abc $ } }; say ?G.parse("abc")
19:20 p6eval rakudo 96d7e0: OUTPUT«Bool::True␤»
19:20 masak rakudo: grammar G { regex TOP { ^ abc $ } }; class G::Actions { method TOP($/) { say "TOP matched" } }; say ?G.parse("abc", :actions(G::Actions.new))
19:20 p6eval rakudo 96d7e0: OUTPUT«TOP matched␤Bool::True␤»
19:20 Patterner left #perl6
19:21 kfg joined #perl6
19:21 abhi_ left #perl6
19:21 masak that should tell you how to plug in an actions object.
19:21 masak that's half of the secret of action classes. the other half is the built-in function &make.
19:21 kfg left #perl6
19:22 masak with which you can adorn the tree of Match objects produced by the grammar.
19:22 masak every Match object has an .ast attribute, and calling &make sets it.
19:23 masak rakudo: grammar G { regex TOP { ^ abc $ } }; class G::Actions { method TOP($/) { make "Life, the Universe, and Everything" } }; G.parse("abc", :actions(G::Actions.new)); say $/.ast
19:23 p6eval rakudo 96d7e0: OUTPUT«Life, the Universe, and Everything␤»
19:23 masak lue: any questions?
19:23 lamstyle joined #perl6
19:27 lue Why would you want to use actions? I see "accessing the results in an easier fashion" as the answer, but I'm not sure.
19:28 moritz_ that's exactly it
19:28 tadzik also, it scales well
19:28 hercynium joined #perl6
19:28 tadzik as the last year advent calendar entry says :)
19:29 masak usually, what you want to do when you get the tree of matches from the grammar parse, is to traverse that tree. actions are an easy way to do that *while parsing*, with much of the traversal boilerplate hidden.
19:29 tadzik actions are one of the most terrifying things before, and the most amazing once you learn them
19:29 tadzik s/once/after/
19:30 masak actions are the natural next stepping stone after one learns grammars.
19:31 arnsholt Actions are bloody brilliant
19:31 arnsholt =)
19:31 lue [looking at book] Seems like actions are natural for such things as Pod parsers. I think I will most likely use them, after reading up on them.
19:33 colomon actions++
19:33 masak lue: sounds excellent. ask as soon as you have more questions -- so far they've been great.
19:33 arnsholt lue: Actions are a natural thing for parsers =)
19:34 lue It would explain why I thought &parse was a bloody difficult thing to use. colomon++ for his advent post (day 18), for without it I would have only known of actions as a file in rakudo :)
19:35 colomon Glad it was useful to you.  :)
19:35 colomon for sure grammars + actions are fantastic.
19:36 masak I think pmichaud mentioned that he invented actions (in Perl 6).
19:36 colomon really?  I just assumed it was part of the original grammar scheme.
19:36 masak no, I think not.
19:36 masak one nice thing is that one can have several action classes for the same grammar.
19:37 masak depending on the desired backend, for example.
19:37 colomon I've been wondering how well that will work in practice.
19:37 masak time will tell.
19:37 colomon I've noticed that I've tweaked the ABC grammar to make it work better with the actions I am currently writing.
19:38 masak that sounds like a very sane thing to do.
19:38 colomon not clear that the tweaks would work properly for a completely different set of actions.
19:38 masak well, the actions are a sort of "client" to the grammar.
19:38 colomon I think it will be very interesting to see where best practices for them lands four or five years from now.
19:38 masak so making the grammar conform to what the action(s) desire is only natural.
19:39 masak of course, with many action classes, there might be competing constraints.
19:39 masak but there likely would have been anyway, due to waterbedding :P
19:43 lue rakudo: Grammar G { regex TOP { ^ <alpha>+ $ } }; class G::Actions { method TOP($/) { make "You said $/" } }; G.parse("hello", :actions(G::Actions.new)); say $/.ast;
19:43 p6eval rakudo 96d7e0: OUTPUT«===SORRY!===␤Confused at line 22, near "Grammar G "␤»
19:43 lue rakudo: grammar G { regex TOP { ^ <alpha>+ $ } }; class G::Actions { method TOP($/) { make "You said $/" } }; G.parse("hello", :actions(G::Actions.new)); say $/.ast;
19:43 masak small 'g' in 'grammar'
19:43 p6eval rakudo 96d7e0: OUTPUT«You said hello␤»
19:44 lue I thought so.
19:44 masak lue: very good. now answer me this: are actions top-down or bottom-up?
19:45 lue .oO(hm. I would guess, but that's not the point.) based on what I've seen so far, I would guess top-down.
19:45 flussence is there a way in rakudo to write a MAIN(Str ~~ any(@command-names)) so that the auto-generated help text lists the @command-names?
19:46 tadzik I'd go for writing my own USAGE
19:46 masak lue: they're bottom-up.
19:46 masak lue: smaller rules finish before the bigger rules do. TOP finishes last.
19:47 flussence oh wow, there's a USAGE sub? learning something new every day :)
19:47 tadzik :)
19:47 tadzik the “help text” is the default USAGE sub
19:48 lue I can tell there are some implications to that, but I don't see it. [TOP stomps on smaller rules' asts?]
19:49 tadzik lue: the smaller tokens are "make"'d first
19:49 tadzik time for me, see you zebras!
19:49 masak tadzik: \o :)
19:50 tadzik (and I plan to come back with one or 2 Rakudo patches, but shh!)
19:50 masak lue: in practice it means that in any given action method, you can see the .ast attributes of all descendent match objects.
19:50 lue o/ tadzik
19:50 masak ++tadzik
19:50 tadzik (if you want write them before)
19:50 tadzik o/
19:50 lue aaah.
19:52 masak &
19:52 colomon huh
19:52 colomon rakudo: my $a = 10; say $a[0]
19:53 p6eval rakudo 96d7e0: OUTPUT«10␤»
19:53 colomon I think I understand why it happens, but I'm not sure if it's a good idea or not...
19:54 lue rakudo: my $a = (1,2); say $a[1] # just checkin'
19:54 p6eval rakudo 96d7e0: OUTPUT«2␤»
19:56 molaf joined #perl6
20:00 Psyche^ joined #perl6
20:00 Tedd1 left #perl6
20:01 lue Is look at rakudo's Actions.pm (a good idea|insane) for learning about actions?
20:01 lue look*ing*
20:01 Psyche^ is now known as Patterner
20:02 moritz_ it's a bit big for that :-)
20:02 colomon lue: rakudo's Actions.pm is very complicated.
20:03 jhuni joined #perl6
20:03 lue So the answer is    any(Bool::False, Bool::True)    ? [if I remember the output format correctly]
20:05 PacoLinux left #perl6
20:05 Tedd1 joined #perl6
20:06 colomon rakudo: say ^1
20:06 p6eval rakudo 96d7e0: OUTPUT«0␤»
20:07 Axius left #perl6
20:09 Eevee left #perl6
20:12 glow left #perl6
20:18 Eevee joined #perl6
20:22 arnsholt rouen886
20:22 arnsholt Er, wrong window
20:40 thundergnat joined #perl6
20:41 thundergnat Good * #perl6
20:44 colomon \o
20:50 thundergnat When you have a sort modifier block, is it legal to have a secondary sort term in the modifier block? I vaguely remember seeing code like that somewhere but can't seem to find it anywhere.
20:50 thundergnat Or does that even make sense?
20:50 colomon I'm not sure.
20:50 thundergnat for instance, sort by word length with a secondary ASCII sort: my @sorted = @unsorted.sort: { $^a.chars, $^a };
20:51 colomon ah!
20:51 colomon I think that's legal in theory but NYI in Rakudo.
20:51 thundergnat I sort of works locally
20:51 thundergnat but it is buggy if it is legal
20:52 colomon sure, if you encode both things to a single thing that cmp works on it will probably work already.
20:52 flussence rakudo: <duck cake umbrella cardboard>.sort({ $^a.chars, $^a }).Str.say # now I'm curious
20:52 p6eval rakudo 96d7e0: OUTPUT«cake duck umbrella cardboard␤»
20:52 colomon I'm trying to remember what the name is of the official type.  Ordering, or something like that...
20:53 flussence rakudo: <duck cake umbrella cardboard>.sort(*.chars, *).Str.say # will this work?
20:53 p6eval rakudo 96d7e0: OUTPUT«Too many positional parameters passed; got 3 but expected between 1 and 2␤  in 'Parcel::sort' at line 1395:CORE.setting␤  in main program body at line 22:/tmp/eCzVnSjbDI␤»
20:53 flussence it'd be nice if that did...
20:53 colomon Ordering, indeed.
20:53 thundergnat it ""works" except it does a string comparison on the word lengths.
20:54 thundergnat so length 10 sorts before length 2
20:54 colomon still don't know where it's defined in the spec, alas.
20:54 thundergnat colomon: yeah, I couldn't find it either...
20:54 colomon it's definitely NYI in Rakudo.
20:54 colomon you can do this the other way, though...
20:55 thundergnat Sigh. That would (will) be so cool...
20:55 colomon rakudo: <duck cake umbrella cardboard>.sort({ $^a.chars <=> $^b.chars || $a leg $b }).Str.say
20:55 p6eval rakudo 96d7e0: OUTPUT«cake duck umbrella cardboard␤»
20:56 thundergnat Since sort is stable, could easily do  my @sorted = @unsorted.sort.sort: { $^a.chars };
20:59 colomon Hmmm... you may well be right about that, but I don't see stable in the spec, and I'm not sure I'd trust Rakudo actually have stable sorts yet.  And writing out the comparison the long way does work now.
21:00 colomon rakudo: <duck cake umbrella cardboard>.sort.sort(*.chars).Str.say
21:00 p6eval rakudo 96d7e0: OUTPUT«cake duck umbrella cardboard␤»
21:00 colomon well, that works.  thundergnat++
21:03 flussence grr... trying to write a MAIN sub so I can do "perl6 ./program commandname", but it's not working:
21:03 flussence multi sub MAIN(Str $command where { $_ ~~ @commands }) { }
21:04 moritz_ flussence: did you mean: $_ ~~ any @commands   ?
21:04 flussence probably :)
21:04 colomon moritz_++
21:05 flussence that's the one... I'd been trying a bunch of different things and that was what I gave up at
21:05 thundergnat colomon: according to the perl6 book https://github.com/perl6/book/blob/master/src/basics.pod, perl6 has stable sort, and I am willing to take that as authoritative.
21:07 * moritz_ is wililng to take the spec as authoritative
21:09 * colomon is willing to take TimToady as authoritative  ;)
21:09 timbunce joined #perl6
21:09 colomon some days, anyway.
21:09 thundergnat heh
21:09 flussence hmm, now it won't fall through to USAGE() when I feed it a non-matching string...
21:09 colomon rakudo: my ($s, $t) = 0.1, 0.2; say $s ~~ (0, 1) && $t ~~ (0, 1)
21:09 p6eval rakudo 96d7e0: OUTPUT«Bool::False␤»
21:09 colomon precedence?
21:10 colomon rakudo: my ($s, $t) = 0.1, 0.2; say ($s ~~ (0, 1)) && ($t ~~ (0, 1))
21:10 p6eval rakudo 96d7e0: OUTPUT«Bool::False␤»
21:10 masak er.
21:10 colomon yah, er
21:10 masak are you trying to treat parcels as ranges?
21:10 masak why not use ranges instead? :)
21:10 colomon doh!
21:10 colomon thought I was.
21:11 timbunce left #perl6
21:11 colomon :|
21:11 colomon well, that's an easy enough fix, maybe
21:12 colomon I wanted the ^..^ op, just spelled it entirely incorrectly.
21:14 colomon ah, that's the last piece I needed for p2
21:15 lamstyle left #perl6
21:15 masak left #perl6
21:15 sftp left #perl6
21:15 zby_home left #perl6
21:15 Helios left #perl6
21:15 Caffeine left #perl6
21:15 sukria left #perl6
21:15 HarryS left #perl6
21:15 diakopter left #perl6
21:15 jjore left #perl6
21:15 ruoso left #perl6
21:15 moritz_ left #perl6
21:15 rbuels left #perl6
21:15 takesako left #perl6
21:15 avuserow left #perl6
21:15 cxreg left #perl6
21:15 patch left #perl6
21:15 cibs left #perl6
21:15 c1sung left #perl6
21:15 eternaleye left #perl6
21:15 mdxi left #perl6
21:15 IRSeekBot left #perl6
21:15 charsbr_ left #perl6
21:15 sjohnson left #perl6
21:15 plobsing left #perl6
21:15 PerlJam left #perl6
21:15 orafu left #perl6
21:15 hudnix left #perl6
21:15 awwaiid left #perl6
21:15 spinclad left #perl6
21:15 Kovensky left #perl6
21:15 mux left #perl6
21:15 frooh_ left #perl6
21:15 rokoteko left #perl6
21:15 shortcircuit left #perl6
21:15 takadonet left #perl6
21:15 ashleydev left #perl6
21:15 Sarten-X left #perl6
21:15 yahooooo left #perl6
21:15 cls_bsd left #perl6
21:15 jasonmay left #perl6
21:15 mtve left #perl6
21:15 TiMBuS left #perl6
21:15 wolverian left #perl6
21:15 meteorja1 left #perl6
21:15 szabgab left #perl6
21:15 saaki left #perl6
21:15 Lorn left #perl6
21:15 Grrrr left #perl6
21:15 zostay left #perl6
21:15 pjcj left #perl6
21:15 broquaint left #perl6
21:15 PZt left #perl6
21:15 Maddingue left #perl6
21:15 jql left #perl6
21:15 jrockway left #perl6
21:15 Tedd1 left #perl6
21:15 wooden left #perl6
21:15 starcoder left #perl6
21:15 pothos left #perl6
21:15 zorgnax left #perl6
21:15 slavik1 left #perl6
21:15 cosimo left #perl6
21:15 robinsmidsrod left #perl6
21:15 stepnem left #perl6
21:15 horror21 left #perl6
21:15 ch3ck left #perl6
21:15 Trashlord left #perl6
21:15 lestrrat left #perl6
21:15 p6eval left #perl6
21:15 tylerni7 left #perl6
21:15 Juerd left #perl6
21:15 fith left #perl6
21:15 TimToady left #perl6
21:15 flatwhatson left #perl6
21:15 szbalint left #perl6
21:15 nperez left #perl6
21:15 nadim__ left #perl6
21:15 Raynes left #perl6
21:15 elb0w left #perl6
21:15 ingy left #perl6
21:15 chitragupt left #perl6
21:15 scp1 left #perl6
21:15 frodwith left #perl6
21:15 pnu left #perl6
21:15 JodaZ left #perl6
21:15 hcchien left #perl6
21:15 bartolin left #perl6
21:15 allbery_b left #perl6
21:16 lue I have a lot of stuff in my code that involves finding what's in the match object, and then one line to do something about it. Think that could be replace with actions? :)
21:17 colomon sounds likely.
21:17 * colomon reluctantly decides 2 R%% [+] is just too cutesy
21:18 * lue waits for the net.join('')    :)
21:18 arnsholt What's the %% operator?
21:18 flussence lue: wouldn't that be a net.cat? :P
21:19 lue not in Perl 6 land (unless there is a cat sub)
21:19 flussence S32:52...
21:19 lue .oO[ which S32? :) ]
21:20 flussence any()! (ok, containers)
21:20 Tedd1 joined #perl6
21:20 lamstyle joined #perl6
21:20 ch3ck joined #perl6
21:20 Trashlord joined #perl6
21:20 sftp joined #perl6
21:20 plobsing joined #perl6
21:20 PerlJam joined #perl6
21:20 zby_home joined #perl6
21:20 Helios joined #perl6
21:20 orafu joined #perl6
21:20 Caffeine joined #perl6
21:20 fith joined #perl6
21:20 hudnix joined #perl6
21:20 lestrrat joined #perl6
21:20 awwaiid joined #perl6
21:20 wooden joined #perl6
21:20 p6eval joined #perl6
21:20 saaki joined #perl6
21:20 starcoder joined #perl6
21:20 pothos joined #perl6
21:20 sukria joined #perl6
21:20 cibs joined #perl6
21:20 tylerni7 joined #perl6
21:20 elb0w joined #perl6
21:20 Lorn joined #perl6
21:20 Juerd joined #perl6
21:20 zorgnax joined #perl6
21:20 spinclad joined #perl6
21:20 slavik1 joined #perl6
21:20 Kovensky joined #perl6
21:20 cosimo joined #perl6
21:20 Grrrr joined #perl6
21:20 zostay joined #perl6
21:20 szbalint joined #perl6
21:20 HarryS joined #perl6
21:20 TimToady joined #perl6
21:20 mux joined #perl6
21:20 frooh_ joined #perl6
21:20 robinsmidsrod joined #perl6
21:20 nperez joined #perl6
21:20 shortcircuit joined #perl6
21:20 rokoteko joined #perl6
21:20 stepnem joined #perl6
21:20 takesako joined #perl6
21:20 nadim__ joined #perl6
21:20 Raynes joined #perl6
21:20 takadonet joined #perl6
21:20 charsbr_ joined #perl6
21:20 ashleydev joined #perl6
21:20 horror21 joined #perl6
21:20 ingy joined #perl6
21:20 flatwhatson joined #perl6
21:20 pjcj joined #perl6
21:20 chitragupt joined #perl6
21:20 diakopter joined #perl6
21:20 scp1 joined #perl6
21:20 Sarten-X joined #perl6
21:20 broquaint joined #perl6
21:20 jjore joined #perl6
21:20 PZt joined #perl6
21:20 ruoso joined #perl6
21:20 yahooooo joined #perl6
21:20 hcchien joined #perl6
21:20 cls_bsd joined #perl6
21:20 jasonmay joined #perl6
21:20 frodwith joined #perl6
21:20 mtve joined #perl6
21:20 pnu joined #perl6
21:20 JodaZ joined #perl6
21:20 bartolin joined #perl6
21:20 allbery_b joined #perl6
21:20 TiMBuS joined #perl6
21:20 Maddingue joined #perl6
21:20 wolverian joined #perl6
21:20 moritz_ joined #perl6
21:20 jql joined #perl6
21:20 jrockway joined #perl6
21:20 c1sung joined #perl6
21:20 rbuels joined #perl6
21:20 meteorja1 joined #perl6
21:20 eternaleye joined #perl6
21:20 patch joined #perl6
21:20 cxreg joined #perl6
21:20 avuserow joined #perl6
21:20 mdxi joined #perl6
21:20 sjohnson joined #perl6
21:20 IRSeekBot joined #perl6
21:20 szabgab joined #perl6
21:20 colomon lue: cat is the lazy string type
21:20 pothos_ joined #perl6
21:20 colomon but it's NYI, and mostly Not Yet Spec'd.
21:20 pothos left #perl6
21:21 lue [ ah! the netjoin hath occured! \o/ ]
21:22 arnsholt colomon: Re your statement above, it'd be "sum is divisible by two", no?
21:22 pothos_ is now known as pothos
21:22 colomon arnsholt: yes
21:25 soroush joined #perl6
21:41 soroush left #perl6
21:41 soroush joined #perl6
21:46 thundergnat left #perl6
21:50 * colomon is getting quite frustrated that his point in loop code isn't working.
21:57 jnthn o/ from Cologne
21:57 jnthn Not quite where I expected to be today but... :)
21:59 arnsholt At least they should have beer =)
21:59 jnthn They *do* have beer.
22:00 jnthn I enjoyed some, before having to come back and try and fix my travel plan up.
22:00 jnthn In theory, I may make it back to the UK tomorrow.
22:00 lue hi jnthn o/
22:00 jnthn o/ lue
22:00 lue .oO(must... avoid... puns... [they'd have people hoppin'!])
22:01 colomon left #perl6
22:01 flussence jnthn: getting the train? All the airports here are closed from what I read.
22:02 colomon joined #perl6
22:10 jnthn flussence: Not all :)
22:10 jnthn flussence: No, the train plan was EPIC FAIL. Long story.
22:10 jnthn flussence: Basically, the whole thing fell apart before I even got out of Sweden.
22:11 flussence ouch.
22:12 flussence I went on long-distance rail for the first time in years last month, wasn't as bad as I thought it'd be.
22:12 jnthn The incompetence and lack of any organization was disgusting. Seeing people fighting each other to get on the few replacement bus services there were was just sad (one guy looked pretty bad, lying in the freezing snow).
22:13 jnthn Thankfully, in Denmark they actually have a clue how to make stuff work and treat people.
22:13 aloha joined #perl6
22:14 jnthn But there was no way to really recover the trip overall. I missed the critical connection I needed to get, and with that missed, the whole lot was screwed.
22:14 jnthn I do a lot of long-distance rail and it usually is very pleasant and works just fine.
22:17 youwin_ joined #perl6
22:17 jnthn Ah well. At least I got some nice German beer out of it. :)
22:17 zby_home left #perl6
22:18 youwin_ left #perl6
22:19 flussence the only other time I went long-distance, it was because we'd got on the wrong train and didn't realise for a while :)
22:21 jnthn lol
22:22 jnthn I laugh but I'm sure I'll manage that one day too
22:22 jnthn Thankfully my "wrong train" incidents tend to have been confined to underground railways in cities, where on can't go that long a way without finding out "oops" :)
22:22 jnthn *one
22:23 jnthn The cool places have circular lines. Then even if you do get on the train going in the wrong direction, you still get there...eventually. :-)
22:23 youwin_ joined #perl6
22:24 hercynium left #perl6
22:25 arnsholt I once took the wrong last train for the night
22:25 arnsholt Thankfully it was summer =)
22:26 flussence .oO( I wouldn't want to be stranded in this weather, day or night... )
22:27 arnsholt Yeah. I could just walk back to the city and wait for the first train the next morning
22:28 jnthn arnsholt: d'oh.
22:28 jnthn arnsholt: Yes, doing that with the last train is...problematic.
22:29 * lue is wishing trains existed in USA, to share in this storytelling
22:32 ardeshir left #perl6
22:32 flussence they're only buses on rails here anyway, you're not missing a lot :P
22:33 flussence (in the UK anyway; mainland EU gets all the fun stuff...)
22:34 lue but still, the best we got here is government-sanctioned sexual harassment and pornography at the airport :/
22:34 arnsholt jnthn: Yeah. But it was during the summer holiday, so I got a good story out of it and no major problems =)
22:37 flussence lue: those aren't much better here. I'd rather take the boat these days...
22:38 lue .oO(What happens when a child goes through a full-body scanner?)
22:40 flussence cooks 'em faster.
22:41 flussence (oh c'mon google, why can't I look up my own IP address on gmaps?)
22:42 uasi_ left #perl6
22:45 jeeger It goes over it's head
22:46 lue time for me to go the way of the nom (nomdō ?). Bai! o/
22:51 jnthn nomdo :D
22:54 arnsholt Huh. The competition is teaching me all kinds of useful stuff
22:56 dju_ joined #perl6
22:56 sji joined #perl6
22:57 shi left #perl6
22:59 dju_ left #perl6
22:59 dju left #perl6
23:00 dju joined #perl6
23:01 dju left #perl6
23:02 Caffeine left #perl6
23:03 * jnthn takes some rest &
23:03 nymacro joined #perl6
23:13 felliott joined #perl6
23:19 Khisanth left #perl6
23:19 felliott left #perl6
23:21 dalek sprixel: 042032b | diakopter++ | / (20 files):
23:21 dalek sprixel: push of updated sprixel files
23:21 dalek sprixel: review: https://github.com/diakopter/sprixel/commit/042032b10b
23:25 MayDaniel joined #perl6
23:26 dalek sprixel: 79fcca0 | diakopter++ | sprixel/s (6 files):
23:26 dalek sprixel: add the antlr-generated lexer/parser/compiler
23:26 dalek sprixel: review: https://github.com/diakopter/sprixel/commit/79fcca062a
23:27 dju joined #perl6
23:27 dju left #perl6
23:27 dju joined #perl6
23:32 Khisanth joined #perl6
23:33 _kaare left #perl6
23:43 jeeger left #perl6
23:59 whiteknight left #perl6

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

Perl 6 | Reference Documentation | Rakudo