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:31 vendethiel joined 09:06 vendethiel joined
masak vendethiel: let me know if there's anything I can do to help with any object literal implementation. 11:31
I did some marginal thinking on it. I think you'll want Q::Object::Literal = Array[Q::Property], with Q::Property being abstract and having 3-or-so subtypes with different structure 11:32
14:12 FROGGS_ joined
masak attempts to implement unquotes in 007 14:33
15:03 vendethiel joined
vendethiel just got home 15:03
masak o/ 16:19
I'm getting unsure about {{{identifier: id}}}. maybe I should go with {{{id: identifier}} instead? 16:50
that's more in line with type annotation syntax anyway.
in fact, maybe we should simply have {{{id: Q::Identifier}}}, and then sweep all the differences between Q types and syntactic categories under the carpet. 16:51
still unsure -- except if we do decide to go with Q::Identifier, it should definitely be the type last 16:52
{{{identifier: id}}} makes a limited amount of sense, if you pretend it's an object property or something.
vendethiel yeah 16:59
that'd make sense... I guess
masak yeah. 17:25
the "Unquotes in other places" practically bags for that interpretation, to the point of asking for three things which are currently grammatical categories to also be Q types.
funnily, 007 still doesn't have subtyping, so we'd have to special-case the relationship between Q::Infix and (say) Q::Infix::Eq 17:27
vendethiel "bags for"? 17:30
oh, beg
also 17:39
it seems the files are a bit "bloated" themselves
my first reaction was "where is the grammar"
17:46 Ven joined 17:55 Ven joined
masak yes, begs* for -- sorry ;) 18:10
18:11 Ven joined
masak hm, are you saying there are things in Parser.pm that should not be in there? that's possible, I guess. it's easy to get blind for possible improvements like that. 18:11
Ven errr, my wifi is really bad
masak Parser.pm has ~40 lines of exceptions (used for parsing) and ~70 lines of precedence (used for parsing) before the grammar begins.
Ven >400lines files are usually a bad sign for me 18:12
masak I'm very doubtful in general to limits of that kind.
Ven I'm very doubtful in general of missing limits..:)
masak but yeah, the parser could be split up into (exceptions, precedence, grammar, actions, and parser) 18:13
I'll give it a try -- thanks for your input
Ven so, the object literal woudl be a term?
er, how to pass -I to prove... 18:14
prove -e 'perl6 -Ilib/' I guess... 18:15
masak I usually just export PERL6LIB=lib 18:17
but your way works too
yes, an object literal would be a term
Ven I should edit t/features/expr then? 18:21
masak syntax-elements.t, p'haps 18:24
Ven that's where this one is, then
masak the categories in the tests are a little bit arbitrary... :)
Ven test AST in /expr.t, and the parsing in syntax-elements? uh 18:25
masak put it anywhere you like -- objects.t would be fine, too 18:26
the test suite recently went through a major-ish refactor, and it hasn't found its optimal shape yet 18:27
pushed split-up of Parser.pm
Ven hadn't starting touching it yet, so yay
huh, "grammar Syntax" is enough? 18:29
the rest of it is inferred?
masak nope.
stomping a little bit on the "global" namespace, I guess.
probably should call it _007::Parser::Syntax, just like the module path. 18:30
hold on, let me fix that.
Ven holds on 18:36
*g* 18:37
masak pushed.
vendethiel saw it :) 18:38
Ven ty
masak looks from Ven to vendethiel and back 18:39
vendethiel ven is laptop, but laptop's wifi is terrible...
masak Ven: got it ;) 18:40
Ven "Permission to masak/007.git denied to vendethiel." what the heck are you doing, git pull
masak ...
Ven do you want the "pair" `EXPR => EXPR` to be its own rule? 18:45
masak yes, I'm pretty sure we want that. 18:51
a proto rule, even
Ven heh?
masak cf statement for an example
or term
Ven '{a=b,c=d}' ~~ /'{' ~ '}' [$<name>=<[a..z]>+ '=' $<value>=<[a..z]>+]* % ','/; 18:52
say $<name>>>.Str Z=> $<value>>>.Str
masak ':', not '='
Ven I love Perl 6.
masak do note that properties can be specified in four different ways 18:53
key: value
"key as string": value
keyvalue
keyfn() { ... }
vendethiel I was going to go 'EXPR': 'EXPR' route 18:54
but yeah
what's the 3rd one?
masak it's sugar for `keyvalue: keyvalue` 18:55
Ć  la ES6
vendethiel ah!
okok
that'd be <identifier<?
*
masak aye 18:57
Ven can I just use `rule` instead of \\h* a lot? :P
you don't seem to like rule
masak \\h* is almost certainly wrong anyway, since newlines are fine, too 18:58
I confess to reaching for rule very late
if you manage to make rule work for you, go for it
Ven you mean in the project, or in general?
masak both ;)
Ven ok. well, let's try & see 18:59
masak goes back to quasi unquotes
Ven hah, but moving it into a proto token means I can't go with the cool Z=> route :P
masak that wouldn't fly anyway, in the long run
Ven *g* 19:00
masak what you really want to produce is a sequence of Q::Property
Ven mmh 19:01
I don't know my way around here very well, sorry :
:)
masak np 19:02
Ven heh, $<a=b> is not the same as $<a>=<b>?
masak it's fun to have you try things out :)
I don't know
I don't use either syntax very much
Ven s05 says it is
masak I usually just pull things out of $/
see Actions.pm for loads of examples 19:03
Ven I was thinking of <EXPR> ':' <EXPR>
maybe we'll want ES6-style [foo] => for computed names... 19:04
Ven doesn't like unquoted names
masak I don't mind them. I vastly prefer them to computed names, which the issue explicitly mentions as not making the cut. 19:06
Ven why is Q::... stuff using self.bless?
instead of submethod BUILD(:%elements) { } 19:07
masak to allow the .new method to take positional arguments
Ven oke 19:08
aw, there's no Val::Object yet :P 19:09
masak nope; that one's all yours :) 19:10
Ven pastes Ā» for the tenth time
masak vim? Ctrl+K > > 19:11
Ven ctrl-k is a move command for me :) 19:16
^HJKL is
keys are too far away, and I have caps lock bound to ctrl (and esc) 19:17
masak Ctrl+K is awesome. you should bind it to *something*
vendethiel it's bound to something :P 19:18
masak scrolls down from Syntax expecting to find Actions, only to hit end-of-file :) 19:19
vendethiel so, I need to remap something to ctrl-k, is that true? 19:20
masak digraphs. don't care what key you map it to 19:22
masak has an unquote parsing now, and failing at runtime 19:23
vendethiel heh; I can't get it to work. 19:25
sigh.
Ctrl-u is no good? okay. 19:26
19:26 Ven joined
vendethiel ok, C-Y works... 19:26
masak so... let's see. eval'ing a Q::Quasi should clone the whole underlying AST, then traverse the copy and replace all the unquotes with the Qtree they resolve to... 19:31
Ven I'm not sure why you space ($/) when defining a method
but not the others?
masak there's a reason 19:32
Ven oh yeha
I remember it now
the :foo that parses as one term
masak aye 19:33
Ven fair enough
how do you get that ast thing, though? 19:35
masak see Actions.pm for plenty of working examples? 19:36
vendethiel you mean Q?
I edited some bits already, guess I have some other stuff to check out 19:37
masak hm, maybe I misunderstood your question. 19:38
"that ast thing" is indeed Q
Ven uh, I'm stupid. I didn't paste the bit... I meant the sexpr thing... -_-
oh, it's a Test thing
masak yes 19:41
quick-and-dirty way to specify Qtrees in the tests 19:42
if Perl 6 had better slangs, I'd do it as a slang
dessert and TV episode with kathyz & 19:43
vendethiel have fun, kathyz
Ven WOOOHOOO 19:51
parsing empty object works /o/
heh, but "(object)" makes it wrong... wut 19:54
masak \\o/ 20:07
vendethiel thing is 20:08
I can't get "(property (str "a") (int 5))" to parse it seems
er, rather, ({"a": "b"}) 20:13
oh 20:14
it's because "<foo=x:y>" doesn't work
nope, I can't get it to parse "inner" stuff 20:21
20:22 Ven joined
Ven heh, even ({}) won't parse here..??? wtf 20:27
ooh o 20:28
perl6 -e 'use _007; _007.parser.parse('\\''my a = 1; ({"a": 1})'\\'', runtime => _007.runtime).perl.say' 20:35
that works here
but I can't seem to manage to write a test for it.
vendethiel -_- this internet connection is severely pissing me off 20:36
aaah, but it's Test's parse that's failing... 20:38
20:40 Ven joined
Ven why am I so dumb 20:43
sigh :(
ok 1 - {} 20:44
ok 2 - {"a": 1}
ok 3 - {a}
1..3
masak \\o/ 20:46
masak is back, and coding his unquote stuff 20:48
vendethiel I'm gonna go to sleep 20:49
trying to push what I got for now
bits and pieces
if my goddamned internet wants me to, at least
masak got a URL for me to look at and review?
or can I guess based on user name and repo name? :P
vendethiel I forked your repo and created a branch objliteral
but I can't push 20:50
masak oki
vendethiel okay, it went through the fifth time.
20:50 Ven joined
vendethiel well, at least I'm getting fiber in the week 20:51
opened a PR to make it easier
masak great
was gonna suggest that :)
squee, a PR! 20:52
vendethiel *g* 20:54
havn't had one of those in many, many moons myself. 2 years maybe?
masak ok 3 - very basic unquote 20:58
\\o/
masak does the necessary refactor before committing
vendethiel amazing.good night, on that note :-) 20:59
my head hurts, it's not looking good for tomorrow
masak oki
I will have a look at your PR :) 21:00
vendethiel: lookin' good. 21:28
vendethiel: the rest of the code base uses `.ast`, not `.made` 21:29
note going to reject a PR solely based on that, but I might change it later just to be consistent.
also, hadn't struck me that one might actually get away with just one Q::Property type. but now that I think about it, that should be fine. 21:30
the $.key attribute will sometimes be a Q::Literal::Str and sometimes a Q::Identifier, that's all 21:31