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.
03:02 ilbot3 joined 18:54 Ven`` joined 19:16 Ven joined
Ven``` duh. 19:17
masak: would you be available to re-read my advent post before it goes live? 19:22
20:24 Ven`` joined
masak Ven``: sure! 20:49
(though I can't re-read it without first having read it a first time) :P 20:50
Ven`` I read it once for you :-). 20:53
masak: gist.github.com/vendethiel/ca0ea82...48bc6d16bb 20:54
masak reads 20:55
Ven`` ty!
masak s/and experiments/and experiment/ 20:56
s/shed away/shy away/
er, "shy away from", I think
there's been some massive copy-paste activity before the `name()` macro actually shows up 20:57
roughly, the post up until then has been duplicated a few times 20:58
s/an usable language/a usable language/
...looks good. I'll be happy to review it again after the above has been fixed 20:59
two worthwhile things to know about the last/best example, infix:<ff> 21:00
(a) it's not merged *yet* (I'm planning to look at it tonight)
(b) with the implementation as outlined, it doesn't have the proper clone-with-surrounding-sub semantics (which jnthn called me on right away when I described the code to him) 21:01
oh, you might have actually meant "shed away" above. perhaps in that case it's better to say "It does, however, shed some parts of it." -- or maybe s/shed/omit/ 21:03
Ven`` I did mean shed away
oh, wow, that copypaste 21:04
probably a vim thing
masak was thinking vim 21:05
<n> i
Ven`` copy pasting under vim without :paste, never again :P
masak o.O
Ven`` well, I used instead: "here's a milestone 007 should reach in time for christmas (currently sitting in a branch)" 21:06
It's totally hopeful, and isn't going to happen, but fits well :P
masak I'm not comfortable with making projections, even short-term ones :/ 21:07
they don't age well
Ven`` Well, that's a projection I know we aren't going to make :P
I just want to spirit of it.
masak it's more the thing where a blog post publicly promises something on the project's behalf... 21:08
:/
Ven`` Ok, fair enough :-)
masak thanks for understanding :)
I do hope to overdeliver, but... privately
Ven`` "here's a milestone 007 should reach some time after christmas" 21:09
masak *sigh* :)
Ven`` how about that one? \\o/
masak well, it *is* the next milestone I hope we reach, but
Ven`` Settled for "ere's a milestone 007 wants to reach that's currently sitting in a branch"
here*
masak +1
by the way, you can experience it yourself, because everything's pushed to that branch 21:10
if you run the tests, you'll get an error in t/examples/ff.t
Variable 'v' is not declared
Ven`` (updated gist)
masak briefly, because macro *arguments* don't get wrapped in a Q::Expr::BlockAdapter right now 21:11
and so they have the wrong lexical context
ISTR I already solved that in Rakudo once, ages ago
Ven``: did you see github.com/masak/007/issues/273 ? any thoughts? 21:14
Ven`` I think my next tuits will go towards regex captures
masak nice
inching closer to `is parsed` :) 21:15
Ven`` currently mentally debating whether I wnat an extra arg or some dynamic scoping :).
masak oh, you mean in implementation code... 21:16
Ven``: para after Fizzbuzz now begins "hat?" 21:18
you've turned your editor up one notch too high... :P 21:19
s/One of the most important <(feature)>/features/ 21:20
the "an usable language" typo still prevails 21:21
the indentation in the `macro statement:<whoa>` example seems off 21:22
might want to link to 007 somewhere 21:23
Ven`` Fixed that one already :P 21:25
masak Ven``: if you have some time to discuss a tradeoff I just ran into...
so, I need to provide the macro arguments with lexical context as I pass them in 21:26
Ven`` for sure :-)
masak typically these are Q::Expr, so currently I need to wrap them in Q::Expr::BlockAdapter
(#273 suggests using Q::Context instead, which would be nicer and slightly more transparent) 21:27
but
either way, the problem is now
that something like `macro name(expr)` and the expectations associated with that one fail to work 21:28
because everything that comes in will now be a Q::Expr::BlockAdapter or equiv
this feels like a bummer 21:31
Ven`` oh, ouch.
shouldn't all arguments be in the same context, though?
mh. maybe stupid but:
is a context for a macro the same as the self for an object?
masak ok, getting concrete so we're on the same page: 21:32
`if v == "B" ff v == "B" {`
the infix:<ff> is the macro call
Ven`` nods 21:33
masak `v == "B"` and `v == "B"` are the two operands; they're both subtypes of Q::Expr
the *context* I'm talking about is the surrounding loop body, which holds the currently iterating value `v` 21:34
i.e. that loop block's current frame
Ven`` nods 21:35
masak right now the branch doesn't pass the tests, because 007 doesn't find that `v`, *because* it's looking in the quasi's context
so I just need to fix that
and I can
but the price will be that name.007 breaks
and possibly more things that expect direct access to the type of the macro arg 21:36
Ven`` right
my point was
masak I think all arguments will be in the same context, yes 21:37
Ven`` can't we get that as the macro's """invocant"""
masak even considering pile-on effects like macro calls in macro calls
Ven`` "reverse COMPILING::"
masak ah
yes, possibly 21:38
but
macros and quasis are orthogonal
this is somehing we need to fix in the quasi
Ven`` yup.
masak is it reasonable to apply that fix to all unquotes, without knowing whether the thing is a macro parameter?
Ven`` we have several options
the first of which is "fake that the quasi's OUTER:: is our calling scope" 21:39
which isn't going to please you
since it totally breaks hygiene =P
2) we can create a fake OUTER:: with only the macro arguments 21:40
3) we can probe the quasi and try to find argumet names that havnt been changed
4) we can provide some sort of auto-unwrapping proxy
masak yep, this is totally going to be the pillow I sleep on tonight 21:41
thanks for laying out the options, though. it helps. 21:42
Ven`` goes to publish his post
I totally forgot to push the button. oops
masak :)
Ven`` I'm happy to have gotten a post in this year 21:43
masak Ven++
Ven`` wishes he could've gone to some perl meeting that didn't conflict with school
masak 5) provide Q nodes with some kind of property that allows them to transparently dislocate its frame 21:48
their*
Ven`` also an issue 21:50
but quite a burden
and means creating Q nodes from userland quite the ride... 21:51
21:52 Ven`` joined
masak well, it'd simply mean they don't set that property 22:03
or, I'm not sure if it means that 22:04
22:10 sergot joined