|
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. |
|||
|
02:48
ilbot3 joined
10:26
andreoss joined
|
|||
| andreoss | masak: for user-defined ops, neither Q::Infix or Q::Prefix are used. am i correct? | 10:37 | |
|
11:15
vendethiel joined
|
|||
| masak | andreoss: | 13:44 | |
| $ perl6 bin/007 -e='sub infix:<%>(l, r) {}; say(quasi @ Q::Infix { % })' | |||
| Q::Infix { lhs: None, rhs: None | |||
| } | |||
| perl6 bin/007 -e='sub infix:<%>(l, r) {}; say(quasi @ Q::Expr { 1 % 2 })' | 13:45 | ||
| Q::Infix { | |||
| lhs: Q::Literal::Int 1, | |||
| rhs: Q::Literal::Int 2 | |||
| } | |||
| infixes are represented in the Qtree as Q::Infix, prefixes as Q::Prefix, etc | 13:46 | ||
| the built-in ops have their own subclasses of these. I'm not sure that design will survive, but I hope so | |||
| andreoss | i see | 13:54 | |
| also why there's no $.ident property for Q::Infix there? | |||
| vendethiel | mmh | 14:26 | |
| masak | andreoss: that's a good question | 14:35 | |
| andreoss: I have a refactor stashed away that's stalled on the answer to that question | |||
| the proximal reason, though, is that it's hidden by `attribute-order` | |||
| presumably it shouldn't be | 14:36 | ||
| let me try to switch it on :) | |||
|
15:40
vendethiel joined
16:10
FROGGS joined
|
|||
| andreoss | masak: regarding traits, is there an example of making one? | 16:29 | |
| masak | nope -- suggestions welcome | 16:31 | |
| in the absence of any other ideas, we might simply copy Perl 6's trait model | 16:32 | ||
| andreoss | you've mentioned `is wrapped` as i see it's NYI and i can guess it meand to be a kind of Python's decorators | ||
| masak | yeah, something like that | ||
| I was just groping for an example | 16:34 | ||
|
18:01
Ven joined
19:22
Ven joined
20:57
FROGGS joined
|
|||
| masak | andreoss: just pushed a commit where $.ident is exposed in operator Q types :) | 21:55 | |
| ...I think I need serious help thinking about quasis in quasis. | 22:13 | ||
| vendethiel | maybe if you got an aspirin for me.. | 22:33 | |
| masak | *pat pat* | 22:34 | |
| `quasi { quasi { {{{foo}}} } }` will expand {{{foo}}} in the *outer* quasi. and there's no mechanism for expanding something in the inner quasi. | 22:53 | ||
| which means the inner quasi is just an expensive type of ordinary block. | |||
| vendethiel | {{{ {{{ x }}} }}} | ||
| masak | still doesn't even reach the inner quasi, that's the problem | 22:57 | |
| cf, um, "foo {$x} \\"{$y}\\" bar" | |||
| vendethiel | well | 23:09 | |
| {{{ }}}should be in the inner | |||
| in the double-quasi | |||
| masak | ok | 23:18 | |
| we can make it work like that, of course | |||
| at least in 007 :) | |||
| we could also implement the crazy from S06: `quasi < quasi [ <<<foo>>> [[[bar]]] ] >` -- enabling explicit control over which quasi an unquote belongs to | 23:19 | ||