|
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 20 June 2015. |
|||
|
01:32
vendethiel joined
06:22
vendethiel joined
06:57
Ven joined
07:04
vendethiel joined
|
|||
| Ven | \\o masak | 07:53 | |
| masak | o/ | ||
| Ven | masak: maybe you'll have more free $brane today :) | 07:54 | |
| masak | seems like it. | ||
| I'm doing some other stuff now in the morning, but I have your gist open in a tab :) | 07:55 | ||
| will get to it | |||
| Ven | alright, good | 07:56 | |
.oO( I hope you close your tabs faster than I do, because mines have been piling up... ) |
|||
| masak | I have that too | ||
| the ones on the far right tend to be quite active | |||
| Ven | ...I guess I'm to blame for that as well *g* | ||
| masak | partly, though maybe less than you think :P | 07:57 | |
| Ven | good. | ||
| The Comonad.Reader » Fast Circular Substitution, TYPE-DRIVEN DEVELOPMENT OF CONCURRENT COMMUNICATING SYSTEMS, Totality vs Partiality, Pluggable type position, Resource-dependent Algebraic Effects | 07:58 | ||
| i have around 15 like that open | |||
| masak | haha | ||
|
08:07
vendethiel joined
09:45
Ven joined
10:00
Ven joined
10:25
vendethiel joined
12:07
vendethiel joined
12:43
vendethiel joined
13:27
vendethiel joined
13:56
vendethiel joined
14:21
Ven joined
14:22
vendethiel joined
16:15
Ven joined
|
|||
| Ven | masak: feeling more like macros now? :P | 17:05 | |
| masak | mood knocked weirdly sideways by $kid vomiting repeatedly for the past 90 minutes. | 18:59 | |
| I'll have a look, though. | |||
| vendethiel | uh, whoops | 19:02 | |
| hope it doesn't look worse than slightly bad food :) | |||
| masak | it doesn't, thankfully. | 19:03 | |
| but there was a lot of crying involved (on his part), both before and during. | |||
| vendethiel | rightfully | ||
| masak | extra ')' on gist.github.com/vendethiel/53080d9...e1-6pl-L35 ? | 19:04 | |
| vendethiel | fixed | ||
| masak | I can already see that I like what I'm reading | 19:05 | |
| you seem undecided between `QAst` and `QAST`. the actual spelling is just `Q` :) | |||
| (hence "Qtree") | |||
| vendethiel | fixed | ||
| masak | nice | 19:06 | |
| I'm looking at the way you handle unquotes in the quasi block, and I'm thinking "my, it'd be nice if they could actually do all that" | |||
| I wonder what it'd take for them to do that. | |||
| I wonder if typechecking ought to play a role in it. | 19:07 | ||
| vendethiel | I somewhat wanted to ".subst" from blackcoffee for that gist | ||
| masak | like, $param would have to be statically typed as Q::Var | ||
| vendethiel | mmmmmmmmmhh. seems scary | 19:08 | |
| you can't parse the quasi without the unquote. | 19:09 | ||
| masak | that's what I mean. it feels like there has to be some restraint. | 19:12 | |
| like, it's a parse error if what {{{ $param }}} gets is not a Q::Var | |||
| we actually don't have to statically know that... we have to know it at splice time. | 19:13 | ||
| no, wait. we have to statically know that for the reason you said. we have to parse the quasi. | |||
| vendethiel | ...but we can't | 19:15 | |
| masak | I'm thinking I should focus on that question: "how can we make quasis that powerful?" | ||
| we can't? | |||
| vendethiel | we can't parse the quasi | ||
| masak | if we can't, then the parser must throw an error and abort the compile. | ||
| vendethiel | my $q = quasi { sub infix:<+>($a, $b) is tighter(&infix:<,>) {} }; return quasi { {{{ $q }}}; say 3 + 4 / 5 } | 19:16 | |
| masak ponders | 19:19 | ||
| I don't think the infix:<+> is supposed to be visible outside of its quasi without some kind of COMPILING:: shenanigans | |||
| vendethiel | ..which solved my issue, opening yours (COMPILING) in the process :) | 19:20 | |
| masak | aye | ||
| masak asks TimToady | 19:21 | ||
| vendethiel | well, it's simple, really | 19:22 | |
| removing the ability to generate subs from macro would hinder its usefulness a lot :( | |||
| masak | I think it might work. | 19:25 | |
| or at least, suddenly I don't see the big problem. things seem to happen in the order they should. | 19:26 | ||
| vendethiel | do you see my gist theoritically working? | 19:27 | |
| re* | |||
| masak | yes, I dub it the most concrete/fleshed-out macro gist ever. | 19:33 | |
| I could see lots of small details needing re-work, but apart from that it seems like a reasonable thing to expect New Macros to be able to do. | |||
| (and a good example at that) | 19:34 | ||
| vendethiel | tons and tons and tons of detais | 19:38 | |
| details* | |||
| it's terrible code | |||
| masak | ;) | 19:57 | |
| let's aim to make it real, though. | |||
| maybe I can even convince you at some point to help prototype things in 007... :D | 19:58 | ||
| vendethiel | oh, i don't think i'm anywhere near good enough to pull that feat off | 20:01 | |
| masak | it surprises me that you say that | 20:07 | |
| you just implemented delimited continuations in hypothetical future Perl 6 macros | |||
| vendethiel | that's easy | 20:08 | |
| masak | no, it bloody isn't | 20:09 | |
| vendethiel | of course it is. you just have to swap the inside of shift() with the inside of reset() | ||
| masak | parsers and runtimes are easy. you just have to turn the source text into an intermediate form, then execute the intermediate form. | 20:12 | |
| seriously, I think more people would be compiler writers if they realized (a) exactly what compilers are, and (b) that there's not that much to it | 20:13 | ||
| I know _why realized this at some point, with Potion | |||
| vendethiel | oh, parsers and runtimes are "easy" | ||
| i'm writing one in haskell currently, and I have another project with the parser in 6 and the VM in rust | 20:14 | ||
| masak | and 007 is a rather easy example of parsers and runtimes | ||
| vendethiel | i never implemented macros! | 20:16 | |
| masak | as a point of reference, I found ops-as-routines tougher to get right in 007 than macros... | 20:32 | |
| vendethiel | ops-as-routines? | 20:33 | |
| masak | define an infix:<!>, and suddenly there is one in the parser's table of operators | 20:35 | |
| vendethiel | ooh | ||
| doesn't seem too hard, though? | 20:36 | ||
| I already have an array with a list of OPs | |||
| if I lex "operator infix §§", I just { 'operator' $<pos>=\\w+ $<op>=.+$ { @operators.push($<op>.Str) } } | 20:37 | ||
| no? | |||
| i only parse infixes tho... | 20:38 | ||
| masak | except the definition is a `sub infix:<!>(l, r) { ... }`, so the installation has to happen as part of sub parsing | 20:47 | |
| and then when a `!` is encountered in infix position, there has to be a lexical lookup for `infix:<!>`, in order to bind to the right definition. | 20:48 | ||
| each detail isn't all that tricky, but it's a lot of details. | |||
| vendethiel | I see | 21:00 | |
| oh yeah it means you need lexical scope at the parsing level. | 21:01 | ||
| masak | it does. | 21:04 | |
| but so does BEGIN | |||
| vendethiel | true | 21:18 | |
| alright | 21:19 | ||
| i'll think about this more still | |||
| but for now, 'night! | |||
| masak | 'night | ||
|
23:38
vendethiel joined
|
|||