|
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 28 July 2015. |
|||
|
04:50
vendethiel joined
05:51
vendethiel- joined
10:09
vendethiel joined
|
|||
| masak only now spotted ven's 28 jun reference to a paper in the backlog | 18:34 | ||
|
19:21
Ven joined
|
|||
| Guest69722 | o/ | 19:22 | |
| I just got to work a tiny bit on my perl-lisp, and I realized something that should've been obvious a long time ago... | 19:23 | ||
| Ven`` | much better. | ||
| So, I added a test for "a macro returning a macro" | 19:24 | ||
| and it finally dawned on me that, I believe, we got something wrong WRT "how perl6/007 is special in regards to scope" | |||
| People have said (me included) "it's weird that I can write `my $x; quasi { $x }` " | 19:25 | ||
| It took me to write macro expansion "by hand" to realize that, actually, lisp also had that. | |||
| It's just that, since we usually keep using semiquotation, we need to think about the scope level of whatever term we're looking at. But if you write something using nested lists, then the scope is much clearer. | 19:26 | ||
| what made me realize this is github.com/vendethiel/simplist/com...8ca5733475 | 19:27 | ||
| if I'm just generating macros using `list` and as many `quote`/`'` as needed, circumventing semiquotation completly, then what Perl 6/007 does actually makes a lot of sense. | |||
| (it's surprising Perl 6 "mixes" them, still) | |||
| masak: Also ā totally unrelated to the previous lines ā I'd like to get some time to discuss the case of "inside out macros". I mean, macros that change code around them, like `each` other several other | 19:29 | ||
| Also, <( )> | 19:31 | ||
| >>Also it reminds me a bit of Common Lisp's prog1. | 19:32 | ||
| >Yes, clearly reminiscent. I see prog1 is a macro, too. Main difference is here we manually pick out any subexpression, not just the first one. | |||
| I'm gonna say something that'll probably look insane, but it reminds me a bit of "call with current continuation" | 19:33 | ||
| masak | :) | 19:34 | |
| I'd be happy to discuss the case of inside-out macros | |||
| Ven`` | In Lisp, you could write a code walker that'd parse the tree, until it finds a call to <>. It uses that as a topic to prog1, evaluates the rest with that expression replaced in | ||
| hi masak :) | |||
| masak | I guess you saw my comment defending them (ish) | ||
| Ven`` | yup | ||
| masak | ok | ||
| also, I'm happy about my idea to put macros inside `inside` rather than the other way around | 19:35 | ||
| Ven`` | sorry? I'm a bit tired, and that flew totally past my head | ||
| masak | ah; I'll link you | ||
| github.com/masak/007/issues/158#is...-314329631 | 19:36 | ||
| Ven`` | I totally missed that somehow, but to give myself an excuse, I was still at PolyConf | 19:37 | |
| masak | :) | ||
| how was PolyConf? | |||
| Ven`` | It was pretty amazing. All the speakers were great! I was staff so I could talk with all the speakers right before/after talk :-) | 19:38 | |
| Also had the opportunity to do a very quick lightning talk on Perl 6 :P | |||
| masak | \\o/ | ||
| Ven`` | I need to find an online interpreter for CL... | ||
| Ideone isn't a very good one | |||
| masak | wish I could help | 19:39 | |
| anyway, super-happy to hear that Perl 6/007 quasiquotation makes more sense for you (or anyone) :) | 19:42 | ||
| Ven`` | \\o/ | 19:43 | |
.oO( you can understand just about anything by nesting macros enough times ) |
19:44 | ||
| urgh, of course, mutation is never quite that easy ._. | 19:46 | ||
| masak | I have a still-unsubmitted 007 issue that starts out complaining about macro-ish operators having their implementation out in Q.pm rather than Runtime/Builtins.pm... | 19:48 | |
| ...and then ends up asking which one should be primary, a 007 macro definition or its underlying Qnode | 19:49 | ||
| Ven`` | OK, basically my idea was: traverse the macro body, find <>. Remplace with a gensymmed symbol. prog1 on that gensymmed symbol | 19:50 | |
| But this needs defining a setf-expander for that gensym >_> | |||
| masak | I get the first thing you said; not the second :) | 19:51 | |
| Ven`` | ooor we could consider you're not allowed to write `my x = foo(<(a)>++)` | ||
| masak | ah, you're talking about lvalues? | ||
| Ven`` | yes | ||
| well, the issue right now is that if you write `(prog<> (incf (<> a)))` it gets translated to `(let ((GENSYM a)) (incf GENSYM) a)` | 19:52 | ||
| *boom* | |||
| masak | I think we could disallow that, because that's not what <( )> is for | ||
| Ven`` | nice. | ||
| masak | have you read about the plans for an "assignment protocol"? | 19:53 | |
| Ven`` | I've posted a good chunk of the comments there :P | ||
| wrt #158, I'm just too tired right now to comprehend I think | |||
| masak | 'k, no problem | ||
| oh right, you commented about setf in #214 | 19:54 | ||
| Ven`` | Yeah, I wrote a lenghty comparison | ||
| lengthy | |||
| masak | re-reading it now | 19:58 | |
| I guess my question is -- what do you think of the Location type as laid out in the original post of #214? | 20:02 | ||
| Ven`` | it's a bit... weird | 20:03 | |
| it's like adding methods to every single object in existence | 20:04 | ||
| masak | from my perspective, Location is mostly the compiler's way to hand over just enough power to the macro author to assign to a "slot" | ||
| not sure why it would be like adding methods to every single object in existence -- note that you still have to deliberately construct a Location through the `lvalue()` function | 20:07 | ||
| ...which can refuse, if it gets something that's not l-valuable | 20:08 | ||
| Ven`` | Ah! | 20:13 | |
| My bad, I read that incorrectly. | |||
| Ok, I think I'm done writing my <> | |||
| masak | hm, correction: `lvalue()` -- then things go through a {{{ }}} -- then out comes a Location | 20:14 | |
| Ven`` | masak: please tell me if that's legible. gist.github.com/vendethiel/c46fbc5...70eb1d8b3e | ||
| masak looks | |||
| Ven`` | (you probably want to skip to the end, to start with) | ||
| masak | ah, cute | 20:15 | |
| I understand the effect; now for the implementation | |||
| Ven`` | er, whoops | ||
| masak | yeah, more or less | 20:16 | |
| Ven`` | i messed up, I had that <> for naught | ||
| okay, updated | 20:18 | ||
| anyway, yeah. here: explicit <()> boundary | |||
| I didn't actually name it <()>, but why not | |||
| masak | and yes, I do see how it reminds you of call/cc | 20:19 | |
| Ven`` | masak: I find it a bit surprising that the lvalue shall be called inside the macro "level" (inside {{{) but the .modify is called in the actual quasi | ||
| I know it makes sense, it's just a bit surprising | |||
| ah! | |||
| so I'm not insane. great :P | |||
| masak | despite the fact that if someone asked me to cleanroom an implementation of call/cc, I couldn't do it | ||
| :) | |||
| Ven`` | fairly sure i couldn't either. to be honest, I reread articles on call/cc every year or so to remind myself the semantics | 20:20 | |
| I wouldn't remember them otherwise | |||
| masak | re the {{{lvalue(ast)}}}.modify decision: what I'm trying to make sure is that the assignment API basically isn't useful except through quasi unquoting | ||
| Ven`` | are you afraid of another `melt`, or..? | ||
| masak | yeah, something like that | 20:21 | |
| I don't want people to be able to mess with stuff outside of macros/quasis | |||
|
20:22
Ven joined
|
|||
| masak pretends there was tons of backlog | 20:22 | ||
| "...and that's why I've decided to go with textual macros instead" | 20:23 | ||
|
20:40
Ven_ joined
|
|||
| Ven_ | masak: Sorry. I'm just tethering internet from my phone and it's a bit flaky | 20:40 | |
| masak | :) | 20:41 | |
| going to bed soon here. nice discussin' with you this fine evening. | 20:42 | ||
| Ven_ | Aye! It'd been too long :p. | ||
|
22:02
Ven joined
|
|||