Camelia, the Perl 6 bug

IRC log for #masakism, 2013-05-31

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

All times shown according to UTC.

Time Nick Message
01:42 KvH joined #masakism
01:53 lizmat joined #masakism
01:53 lizmat good * from Austin, TX,  #perl6!
01:53 lizmat oops, ww
02:54 ggoebel joined #masakism
04:05 ggoebel joined #masakism
04:35 spider-mario joined #masakism
07:19 dmol joined #masakism
07:46 _ilbot joined #masakism
07:46 Topic for #masakism is now http://freespectrum.herokuap​p.com/workshop-map-links.svg -- https://gist.github.com/masak/5431185 -- logs at http://olive.undo.it/log?channel=masakism
07:56 snearch joined #masakism
08:20 japhb joined #masakism
10:04 japhb_ joined #masakism
10:44 ggoebel joined #masakism
12:22 vkrishn joined #masakism
16:16 dmol joined #masakism
17:26 Teratogen is Perl 6 turning into an academic language?
17:26 masak no.
17:27 Teratogen How no?
17:27 * masak suggests this is a topic for #perl6, not #masakism
17:34 ggoebel joined #masakism
17:37 Teratogen oh when we have masakism we will be talking about it =D
17:43 _ilbot joined #masakism
17:43 Topic for #masakism is now http://freespectrum.herokuap​p.com/workshop-map-links.svg -- https://gist.github.com/masak/5431185 -- logs at http://olive.undo.it/log?channel=masakism
17:46 Teratogen I have a lot of questions about perl 6 that I will ask during the next masakism!
17:49 masak feel free.
17:50 masak maybe make a list beforehand? :)
17:56 Teratogen is perl 6 a functional programming language, because those never make it into the mainstream
17:56 Teratogen !!!
17:57 Teratogen so I will have questions about functional programming, of course
18:00 Teratogen will we be learning about perl 5 too?
18:02 masak yes. see https://gist.github.com/masak/5431185 (a description of the thing we did on May 1)
18:02 masak in general, see /topic
18:03 Teratogen I am going to crash this party!
18:03 Teratogen =)
18:04 Teratogen I promise to be quiet and listen =(
18:04 Teratogen that will be no fun though =(
18:04 Teratogen I am pretty much a loose cannon =)
18:07 Teratogen for example, most C compilers are written in C
18:07 Teratogen can you write Perl 6 in Perl 6?
18:09 masak Teratogen: asking lots of questions and generally making (productive) noise wouldn't be to "crash this party", it would be the intended mode of interaction.
18:10 Teratogen ok =)
18:10 masak Teratogen: much or Rakudo Perl 6 is indeed implemented in Perl 6 already.
18:10 Teratogen you gotta leave something for Parrot!
18:10 masak another significant part is implemented in NQP (Not Quite Perl), a small subset of Perl 6.
18:11 masak well, yes, at some point Rakudo bottoms out in Parrot, of course.
18:11 masak (or the JVM, or...)
18:21 Teratogen why are the multi subroutines when an if statement inside the subroutine would do just as well?
18:24 Teratogen (I'm looking at code examples on wikipedia)
18:26 masak several reasons.
18:26 masak the most important being, perhaps, that not all the multis need be yours.
18:26 masak note that you can mix in your own multis with language-provided multis.
18:26 masak it's an open system.
18:27 Teratogen cool!
18:27 masak two other important, related reasons: scoping. a multi in a small scope can go out of scope.
18:28 masak and type narrowness. while it's *strictly* true that you can emulate it all with if statements, it's a whole lot of work, and the multi/signature syntax essentially becomes a declarative language which is very nice to work with.
18:28 masak see the Rock/Paper/Scissors example, for example.
18:28 masak I don't remember if it's on Wikipedia. it's in the book PDF.
19:18 Teratogen also, I like the simplicity of C's text preprocessor
19:19 Teratogen Perl 6's is a macro preprocessor too, but it's more complicated
19:32 GlitchMr Well, Perl 6 has textual macros.
19:32 GlitchMr However, these are prone to easily break, just like macros in C.
19:33 Teratogen it that a separate processing step?
19:33 Teratogen Perl 6 macro processing, that is
19:35 GlitchMr More like, compiler sees token and replaces it.
19:35 GlitchMr Macros have to be declared before their use.
19:36 GlitchMr It isn't separate processing step.
19:36 Teratogen ah
19:38 masak right. macros in Perl 6 are "parser plug-ins", whether they're textual or ASTic.
19:38 GlitchMr For example, textual macro.
19:38 GlitchMr r: macro addem($a, $b) { "$a + $b" }; say addem(1, 2) * 3;
19:38 camelia rakudo cd5ca7: OUTPUT«===SORRY!===␤too few positional arguments: 2 passed, 3 (or more) expected␤»
19:39 GlitchMr wait, what?
19:39 Teratogen that doesn't make sense
19:39 GlitchMr Uhmmm, why it failed.
19:39 GlitchMr Is it yet another Rakudo bug?
19:40 GlitchMr Anyway, see https://perl6advent.wordpress.​com/2012/12/23/day-23-macros/
19:41 Teratogen macro addem($a, $b) { "$a" }; say addem(1, 2) * 3;
19:41 Teratogen r: macro addem($a, $b) { "$a" }; say addem(1, 2) * 3;
19:41 camelia rakudo cd5ca7: OUTPUT«===SORRY!===␤too few positional arguments: 2 passed, 3 (or more) expected␤»
19:41 GlitchMr r: macro addem($a) { "$a" }; say addem(1) * 3;
19:41 camelia rakudo cd5ca7: OUTPUT«===SORRY!===␤too few positional arguments: 2 passed, 3 (or more) expected␤»
19:41 Teratogen r: macro addem($a) { "$a" }; say addem(1, 2) * 3;
19:41 camelia rakudo cd5ca7: OUTPUT«[31m===[0mSORRY![31m===[0m�Too many positional parameters passed; got 2 but expected 1�at /tmp/2fYvCAMcvH:1�------> �»
19:41 GlitchMr Strange...
19:42 Teratogen I don't get it
19:42 GlitchMr It seems that textual macros are broken.
19:42 GlitchMr r: macro f { '1 + 1' }; say f;
19:42 camelia rakudo cd5ca7: OUTPUT«===SORRY!===␤too few positional arguments: 2 passed, 3 (or more) expected␤»
19:42 Teratogen maybe the code for macros has not been visited in a while and bit rot has set in
19:42 GlitchMr I've copied that example from specification.
19:42 GlitchMr Perhaps.
19:43 GlitchMr I'm going to check proper macros.
19:43 masak Rakudo doesn't do textual macros.
19:43 masak Pugs does.
19:43 GlitchMr Oh, right
19:44 GlitchMr p: macro addem($a, $b) { "$a + $b" }; say addem(1, 2) * 3;
19:44 camelia pugs: OUTPUT«9␤»
19:44 GlitchMr p: macro addem($a, $b) { "($a + $b)" }; say addem(1, 2) * 3;
19:44 camelia pugs: OUTPUT«9␤»
19:44 GlitchMr Huh?
19:44 Teratogen oh interesting
19:44 GlitchMr Auto parens?
19:44 Teratogen why not?
19:44 Teratogen why doesn't rakudo do textual macros?
19:45 GlitchMr r: macro checkpoint { my $i = ++(state $n); quasi { say "CHECKPOINT $i" } }; checkpoint; for ^5 { checkpoint }; checkpoint
19:45 camelia rakudo cd5ca7: OUTPUT«CHECKPOINT 1␤CHECKPOINT 2␤CHECKPOINT 2␤CHECKPOINT 2␤CHECKPOINT 2␤CHECKPOINT 2␤CHECKPOINT 3␤»
19:45 GlitchMr Anyway, I think this is interesting example of syntactical macros.
19:45 GlitchMr Macros can modify variables in outer scope easily.
19:46 GlitchMr Or call stuff like "next".
19:46 GlitchMr Because they aren't functions.
19:46 GlitchMr s/functions/subroutines/
19:47 GlitchMr Or you could have LOG function.
19:47 GlitchMr Like, LOG "The answer is { time-consuming-computation() }";
19:48 GlitchMr By using macros, you can make code inside LOG not execute when logging is disabling.
19:48 GlitchMr And avoid time consuming computation.
19:49 Teratogen right
19:51 masak Teratogen: because nobody's implemented textual macros in Rakudo yet.
19:51 masak Teratogen: I have an ongoing grant to implement AST macros.
19:52 masak no-one is working on textual macros.
19:52 masak yet.
19:53 Teratogen ok
20:00 dmol joined #masakism
21:06 eyck joined #masakism
21:32 dmol joined #masakism
22:16 ggoebel joined #masakism
22:18 japhb joined #masakism
23:51 KvH_ joined #masakism

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