6macros: discussing the finer points of Perl 6 macros, Qtrees, and how to stay sane | irclog: irclog.perlgeek.de/6macros/today
Set by moderator on 26 May 2015.
00:17 vendethiel joined 02:50 vendethiel joined 06:05 vendethiel joined 08:25 Ven joined 08:51 Ven joined 09:28 vendethiel joined 10:02 vendethiel joined 10:29 vendethiel joined 10:55 vendethiel joined 11:21 vendethiel joined 13:02 vendethiel joined 13:11 Ven joined
Ven macros to TCO. 13:11
hi, #6macros!
seeing as perl6 can't get macros, I think a macro could rewrite functions to be tailrecursive. 13:14
question: how would applying it look?
how the macro itself should process shouldn't be that hard for self-recursive functions
github.com/puffnfresh/brushtail 13:30
that's a JS one
maybe this could be simpler with trampolining 13:33
13:53 vendethiel joined
masak would these two things be enough: (a) being able to arbitrarily change the AST/Qtree, (b) having some Qtree construct that corresponds to "call this other thing, replacing the current stack frame" ? 14:33
14:41 vendethiel joined
Ven masak: no, less than that is needed 14:46
masak: please check the linked repo
masak does so 14:47
oh, a CPS transform. got it. 14:48
I keep encountering these CPS transforms! I think a Qtree transformation library should have built-in support for them. 14:49
thanks for making me realize that.
Ven is glad about it 14:53
since I'm scared perl6 itself can't propose tco...
having it as a macro seems good
I have no idea how it'd look, tho?
masak me either. 14:54
Ven decorator macro, a-la python? (scala has it with annotations, iirc)
block?
tco { xxx }
`use`?
masak oh, I'm more thinking along the lines of an API. no special syntax.
Ven use tco; :P
well
you need to say where you want that to happen
because you're breaking a lot of introspection features of perl6
masak yes, of course.
it'll happen inside a macro.
so the macro might be called `tco`
`tco sub foo() { ... }`, mebbe 14:55
masak suddenly wonders if `macro trait_mod:<is>` should work 14:56
then we could even `sub foo() is tco { ... }`
Ven seems like the best solution 14:57
("decorator")
masak aye.
though people have been known to use the first form for that, too. making the decorator a sub that takes a routine at runtime. 14:58
it's a cute pattern.
Ven myeah. 15:01
no.
i don't like it, for some reason. 15:02
I need to figure out why, but I still have my essay to write, and there's only an hour left
masak nodnod
don't let me distract you :)
Ven that'll be enough 15:39
15:50 vendethiel joined 16:21 vendethiel joined
vendethiel o/ 16:40
okay so, issues with "modifiers" 18:03
it's like they don't compose well
18:57 Ven joined
masak could you be more specific/concrete? 19:22
Ven It reminds me of perl5's `try`/`catch` abusing prototypes, in some way, with `catch` just being `id`. I don't know why 19:24
but.
"tco cleaned optimized sub foo" reads really poorly
vendethiel okay, I'm off to do something now 19:30
masak I think I see what you mean. 19:48
20:43 vendethiel joined 22:09 vendethiel joined 23:42 vendethiel joined