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