»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'perl6: say 3;' or rakudo:, niecza:, std:, or /msg p6eval perl6: ... | irclog: irc.perl6.org/ | UTF-8 is our friend!
Set by sorear on 4 February 2011.
dalek ast: 5a4c6b7 | (Tobias Leich)++ | S05-mass/rx.t:
RT #115298, test for $( $_ )
00:00
FROGGS gnight
00:01 FROGGS left 00:23 swarles left 00:29 atrodo left 00:40 Pleiades` left 00:45 Pleiades` joined 00:47 am0c joined 00:48 Swarley_ joined 00:53 Pleiades` left 00:57 Pleiades` joined 01:00 Chillance left 01:01 Swarley_ is now known as swarles 01:05 Targen joined 01:08 rindolf left 01:09 benabik left, hypolin joined 01:14 anuby joined 01:19 benabik joined
diakopter :7 01:33
01:43 MikeFair__ left 01:49 MikeFair_ joined 02:16 swarles left 02:45 hash_table joined 02:48 ph1ur3 left 02:49 MikeFair_ left 02:51 hash_table left 02:54 MikeFair_ joined 03:01 hlin_ joined 03:04 hlin_ left 03:11 skids joined 03:14 balders_dod joined 03:31 bluescreen__ joined 03:35 bluescreen100 left 03:37 MikeFair_ left, MikeFair joined 03:41 araujo left 03:57 orafu left, orafu joined 04:06 fgomez left, fgomez joined 04:18 preflex left, preflex_ joined, preflex_ is now known as preflex 04:20 aindilis left 04:21 aindilis joined 05:13 telex left 05:16 telex joined 05:25 telex left 05:38 telex joined 05:43 alec left 05:50 alec__ joined 05:51 alec__ is now known as alec
moritz \o 05:54
sorear o/ moritz 05:59
05:59 SamuraiJack joined 06:02 balders_1od joined 06:03 balders_dod left 06:08 dayangkun joined 06:18 balders_1od left 06:26 erkan joined, erkan left, erkan joined 06:51 kaleem joined 06:55 daniel-s left 06:56 daniel-s joined 07:02 alec__ joined 07:03 alec left 07:14 wk_ joined 07:18 wk left 07:19 alec__ is now known as alec 07:35 Swarley_ joined, araujo joined
Swarley_ How would i express this, ( source-character+ ) but not ( source-character* line-terminator source-character* ) 07:36
I'm sure I could figure out a way, but I thought that checking for a special perl 6 magic method would be easier
TimToady we usually use \N+ for that 07:38
negation of \n
or do you mean something else by 'line-terminator'? 07:39
Swarley_ token TkLineTerminator { \x0D? \x0A }
Directly from an IPA draft of a language specification.
TimToady \n is supposed to match any of the common line terminators in Perl 6 07:40
r: say "foo\r\n" ~~ /\N+/
p6eval rakudo d97ad4: OUTPUT«「foo」␤␤»
sorear \n also matches some weird line terminators that I have never seen in the wild
TimToady well, like PARAGRAPH SEPARATOR and such 07:41
sorear if you have a need to include \u2028 as part of your logical lines, \N* is not for you.
Swarley_ Well, is there a way to do some actual and logic and just negate the second expression?
TimToady there is a specced way that is probably not implemented, but you can always put an assertion of your own 07:42
sorear I'd do [ <!TkLineTerminator> . ]*
TimToady or possibly even <-TkLineTermator>* 07:43
Swarley_ Ah.
TimToady only spelled rigth
sorear what you wrote first is CYK-think and is less than optimal with the perl 6 grammar engine 07:44
although it can be written
A !~~ /B/ I think
Swarley_ r: say "hello world\r\n" ~~ /<-\x0D? \x0A>/
p6eval rakudo d97ad4: OUTPUT«===SORRY!===␤Unrecognized regex metacharacter < (must be quoted to match literally)␤at /tmp/1zhLtaFy1M:1␤------> say "hello world\r\n" ~~ /<-⏏\x0D? \x0A>/␤Unrecognized regex metacharacter - (must be quoted to match literally)␤at…
Swarley_ er 07:45
sorear r: my token nl { \x0D? \x0A }; say "hello world\r\n" ~~ /<-nl>/
p6eval rakudo d97ad4: OUTPUT«No such method 'nl' for invocant of type 'Cursor'␤ in regex at /tmp/2tOd5wM1uV:1␤ in method ACCEPTS at src/gen/CORE.setting:10733␤ in block at /tmp/2tOd5wM1uV:1␤␤»
sorear you can't just put random stuff between <- and > 07:46
Swarley_ Ah. Well, there is no immediate negation then?
sorear it has to be a rule name (or something else that can match the "assertion" production)
Swarley_: you CAN do token line { [.*] !~~ /<nl>/ } 07:47
Swarley_: if you want your rules to take quadratic time, that is.
TimToady I don't think the inner regex takes //
Swarley_ er no, i'd prefer that they didn't
sorear <-nl>* will take linear time and I strongly recommend that you use it instead 07:48
Swarley_ Yes, I'll use that
sorear this is not CYK
jnthn morning 07:51
TimToady o/
jnthn sips coffee and prepares for the day's teaching :) 07:55
moritz o/ 07:59
nwc10 ensuring a proper bootstrap?
jnthn Something like :) 08:00
08:00 Swarley_ left 08:10 FROGGS joined
FROGGS morning 08:12
is there a tool that let you calculate NQP_REVISION ? 08:13
moritz git describe 08:16
FROGGS cool 08:18
moritz t/spec/S32-exceptions/misc.rakudo (Wstat: 0 Tests: 513 Failed: 1) Failed test: 492
FROGGS moritz: thanks, so I dont have to count be myself :o)
hmmm, this github.com/perl6/roast/commit/b832...e5eb1ff478 08:19
I'm already running the spectests 08:20
moritz I don't like the approach of X::Constructor::Positional
with .name, I mean 08:21
it should store the type object directly
and only .^name it for the message
that way less information is lost
08:22 SamuraiJack left
FROGGS # Exception message: Could not locate compile-time value for symbol Foo 08:28
moritz: I'm trying to fix this, k? # not that be both spend time on it 08:31
moritz FROGGS: +1 08:32
08:33 fhelmberger joined
FROGGS rn: say "foobar" ~~ m/$( $_ )/ 08:34
p6eval rakudo d97ad4: OUTPUT«「foobar」␤␤»
..niecza v24-18-gaf64300: OUTPUT«#<match from(0) to(6) text(foobar) pos([].list) named({}.hash)>␤»
FROGGS rn: say "foobar" ~~ m/f $( $_ )/
p6eval niecza v24-18-gaf64300: OUTPUT«False␤»
..rakudo d97ad4: OUTPUT«#<failed match>␤»
FROGGS good 08:35
rn: say "foobar" ~~ m/f $( $_.substr(1, Inf) )/
p6eval niecza v24-18-gaf64300: OUTPUT«#<match from(0) to(1) text(f) pos([].list) named({}.hash)>␤»
..rakudo d97ad4: OUTPUT«␀␀␀[␀␀␀3␀␀␀1␀␀␀m␀␀␀=␀␀␀=␀␀␀=␀␀␀␀␀␀[␀␀␀0␀␀␀m␀␀␀S␀␀␀O␀␀␀R␀␀␀R␀␀␀Y␀␀␀!␀␀␀␀␀␀[␀␀␀3␀␀␀1␀␀␀m␀␀␀=␀␀␀=␀␀␀=␀␀␀␀␀␀[␀␀␀0␀␀␀m␀␀␀␤␀␀␀U␀␀␀n␀␀␀r␀␀␀e␀␀␀c␀␀␀o␀␀␀g␀␀␀n␀␀␀i␀␀␀z
FROGGS what the
rn: say "foobar" ~~ m/f { $_.substr(1, Inf) }/ 08:36
p6eval rakudo d97ad4: OUTPUT«「f」␤␤»
..niecza v24-18-gaf64300: OUTPUT«#<match from(0) to(1) text(f) pos([].list) named({}.hash)>␤»
moritz FROGGS: known(-ish) problems with UTF-32 and error messages from qregex
FROGGS moritz: looks good in my shell, is it a problem in p6eval? 08:37
moritz FROGGS: no, your shell just ignores the extra zero bytes 08:38
FROGGS good shell ;o)
a bit ignorant though
moritz p6eval replaces them with ␀
08:43 groky left 08:53 hoelzro|away is now known as hoelzro 08:54 sqirrel joined
timotimo FROGGS: thanks for fixing my mistakes :) 08:54
i thought i had tested the change, though. strange. 08:55
08:55 groky joined 09:00 kresike joined
kresike hello all you happy perl6 people 09:01
09:05 awwaiid left
dalek kudo/nom: 6b0cea6 | (Tobias Leich)++ | src/core/ (2 files):
pass type object to exception X::Constructor::Positional
09:15
moritz FROGGS++
09:17 rindolf joined
dalek ast: 2018e14 | (Tobias Leich)++ | S32-exceptions/misc.t:
X::Constructor::Positional's attribute is the type object
09:17
Harzilein rindolf: interesting username... are you the java mikmod author? 09:22
masak g'morn'n, #perl6
rindolf Harzilein: yes, I am.
FROGGS morning masak
Harzilein rindolf: :D 09:23
rindolf Harzilein: www.shlomifish.org/ - that's my home page.
FROGGS
.oO( do I need coffee when doing. mor<tab> morn<tab><tab> morni<tab> ? )
Harzilein rindolf: i tried to make a sample extractor based on your code a while ago. haven't worked on it in a while though. 09:24
rindolf Harzilein: ah, OK.
Harzilein: the Java port ended up in some non-idiomatic Java.
And it also used to be much slower than the C code.
Su-Shee good morning everyone. 09:27
09:28 rindolf left 09:29 rindolf joined
FROGGS morning Su-Shee 09:29
masak morning, Su-Shee 09:31
09:32 alec__ joined 09:34 alec left 09:41 alec__ is now known as alec 09:46 Patterner left 09:48 Psyche^ joined, Psyche^ is now known as Patterner 09:53 rindolf left, rindolf joined 10:00 dakkar joined 10:01 rindolf left, rindolf joined 10:08 anuby left 10:09 hypolin left 10:12 SmokeMachine joined 10:14 Tene joined, Tene left, Tene joined 10:16 djanatyn joined 10:19 xalbo joined 10:43 kaleem left 10:47 nuba left 10:48 nuba joined 11:06 Su-Shee_ joined 11:08 Su-Shee left, Su-Shee_ is now known as Su-Shee 11:14 am0c left 11:19 dayangkun left 11:25 Targen left 11:27 awwaiid joined 11:28 jlaire left 11:41 jlaire joined 12:05 am0c joined
masak wow, I really like the "can-cannot-must" format at the top of this page: www.tldrlegal.com/license/gnu-gener...v2-(gpl-2) 12:26
feels like that's a good format not just for exaplaining licenses, but to describe interfaces/software contracts as well. 12:27
FROGGS indeed
feels like most of API documentation only covers 2/3 12:28
moritz that's the beauty of design by contract 12:31
it makes it rather easy to formalize most of the pre- and postconditions of APIs
masak I dunno, I can see the promise of it, but I haven't really seen it work well in practice yet. 12:34
not saying it doesn't -- for all I know, it does -- but I haven't seen it.
moritz I've had some positive experience with it with the Eiffel standard libraries 12:37
(oh, and I also think that one must support DBC to a level comparable to that of Eiffel for it to really make sense) 12:38
12:42 alec left
jnthn ugh, that $(...) regex fix looks wrong 12:45
moritz (which in turn requires static typing, so nothing that Perl 6 will be able to do easily)
jnthn I'm pretty sure in STD it falls out of the $ metachar rule
r: /$(a+)/
p6eval rakudo 6b0cea: OUTPUT«===SORRY!===␤Non-declarative sigil is missing its name␤at /tmp/kmPXuAQl0x:1␤------> /$⏏(a+)/␤ expecting any of:␤ statement list␤ prefix or term␤ prefix or meta-prefix␤»
jnthn r: / $( a+ ) / 12:46
p6eval rakudo 6b0cea: ( no output )
jnthn std: / $( a+ ) /
FROGGS jnthn: I'm working on it
p6eval std 7deb9d7: OUTPUT«===SORRY!===␤Bogus term at /tmp/TyK9fOqN9Y line 1:␤------> / $( a+ ⏏) /␤Undeclared routine:␤ 'a' used at line 1␤Parse failed␤FAILED 00:00 44m␤»
FROGGS (right now)
jnthn FROGGS: OK. Please see how STD does it.
we should be staying as close to STD as reasonably possible.
Apart from in the places STD is unreasonable :)
FROGGS jnthn: ya, makes sense 12:47
moritz masak: I also like the tldrlegal thing, but I can't help but notice that the most important difference between GPL v2 and v3 (patent stuff) doesn't show up in the summary
masak hm, weird. 12:51
maybe the most important difference is hard to summarize ;)
moritz or maybe it's simply an omission 12:53
masak by definition, yes ;) 12:56
jnthn
.oO( not so optimized for mission after all... )
12:57
13:09 bluescreen__ left 13:14 dayangkun joined 13:26 Rix left 13:27 Rix joined
masak rn: class Greeter { has $.target; method greet { say "Hello $.target" } }; my $method = Greeter.can('greet')[0]; say $method.^name 13:38
p6eval niecza v24-18-gaf64300: OUTPUT«Bool␤»
..rakudo 6b0cea: OUTPUT«Method␤»
masak r: class Greeter { has $.target; method greet { say "Hello $.target" } }; my $method = Greeter.can('greet')[0]; say $method( Greeter.new(:target<World>) )
p6eval rakudo 6b0cea: OUTPUT«Hello World␤True␤»
masak r: class Greeter { has $.target; method greet { say "Hello $.target" } }; my $method = Greeter.can('greet')[0]; $method( Greeter.new(:target<World>) )
p6eval rakudo 6b0cea: OUTPUT«Hello World␤»
moritz "I think it is very interesting, but I don't have time to be interested in everything that's interesting" 13:39
masak ;)
I'm pondering which model I dislike the least, (1) a method can be unbound or bound, you can bind methods, and you can call bound methods, or (2) a method is a sub with one more parameter. 13:40
both Python and Ruby have variants of (1), I believe. 13:41
JavaScript has (2), except that the parameter is not a positional parameter.
Perl 5 and Perl 6 have (2).
moritz in javascript, the supplication of the invocant is somewhat magical, no? 13:42
masak in JavaScript, every Function object has .apply and .call methods, with which you can supply the invocant manually. 13:43
but usually, what you do is hide this with the obj.meth sugar.
er, obj.meth()
.apply and .call are only really necessary when you want to do library-internal "call the method on an unexpected object" magic. 13:44
13:47 skids left 13:56 Swarley_ joined 14:00 bluescreen10 joined, Swarley_ left 14:01 hash_table joined 14:07 hash_table left 14:10 PacoAir joined 14:12 atrodo joined 14:15 PacoAir left, PacoAir joined
[Coke] I find myself using .apply/.call when construct jquery plugins. 14:31
(where 14:32
oops
masak essentially, because .apply does 'this' assignment and applies the function, .apply + anon function = .bind 14:34
or, I should say function() { .apply } = .bind 14:35
14:36 vividsnow joined, SmokeMachine left 14:39 SmokeMachine joined 14:44 cog joined 14:46 nyuszika7h left 14:48 nyuszika7h_ joined 14:49 nyuszika7h_ is now known as nyuszika7h 14:52 cog left 14:53 alec joined 14:57 cog joined
cog r: < a b >.WHAT 14:57
p6eval rakudo 6b0cea: ( no output )
PerlJam cog: need a "say" in there. 14:58
cog ho, I am so used to the shell that outputs the last expression result when nothing is explicitly printed 14:59
r: say < a b >.WHAT
p6eval rakudo 6b0cea: OUTPUT«Parcel()␤» 15:00
cog I wonder why this composer does not return a list.
moritz why should it?
cog well, why should not it? 15:01
moritz you can push to a list, for example. What would be the sense in allowing < a b >.push: 42 ?
doc.perl6.org/type/Parcel 15:03
doc.perl6.org/type/List
a Parcel is close to what other languages call a Tupel
cog I did not realise how parcels are now everywhere in Perl 6 15:04
15:07 stopbit joined 15:10 skids joined 15:15 cog left 15:18 cog joined, kaare_ joined 15:22 cog left 15:25 daniel-s left 15:26 daniel-s joined 15:28 hash_table joined 15:30 SunilJoshi joined
jnthn decommute & 15:38
15:40 vividsnow left
masak moritz: "tuple". 15:41
cog: I see parcels as having to be there because in Perl 6, lists can either flatten or have fun with sublists and multidimensionality. as long as it is a parcel though, it's still in a superposition between these two states. 15:42
15:43 mtk joined 15:44 benabik left
[Coke] masak... Great. I finally thought I was beginning to understand lists, and now this. :P 15:44
masak :P 15:45
moritz masak: but not all parcels flatten, a Parcel-in-an-Item does not 15:46
masak the introduction of Parcels in S02 in fact very much supports this view. "not yet committed to flattening"
[Coke] O_o;
moritz [Coke]: don't let masak confuse you
masak moritz: I thought that's what I said.
moritz: it doesn't know yet whether it should flatten.
[Coke] moritz: you're not helping. :)
moritz masak: oh, you're right 15:47
masak is right and the world is scary
moritz masak: but the same is true for Lists and Arrays too
15:47 arlinius joined
masak fair enough. 15:47
moritz masak: so we don't really need Parcels for the not-yet-committed-to-whether-we-flatten-or-not stuff
masak oh! S02 also points out that the things in 'rhyme(1,2,3,:mice<blind>)' is syntactically a Parcel. 15:48
(but the compiler collapses it down to a Capture) 15:49
rn: my $args = \(1,2,3,:mice<blind>); say $args.^name
p6eval rakudo 6b0cea, niecza v24-18-gaf64300: OUTPUT«Capture␤»
15:59 fgomez left 16:01 dayangkun left 16:02 dayangkun joined 16:04 fhelmberger left 16:08 Pleiades` left
kresike bye folks 16:11
16:11 kresike left 16:13 Pleiades` joined 16:28 vividsnow joined 16:29 FROGGS left, FROGGS[mobile] joined 16:31 Targen joined 16:33 fgomez joined 16:39 kaleem joined 16:41 hoelzro is now known as hoelzro|away, kivutar joined
japhb masak, re: tldrlegal, I like the reverse search feature (though the UI needs a bit of tweaking), and the "click anywhere in background of front page to get a tour" feature. I don't like the opening to this: www.tldrlegal.com/license/artistic-...rtistic%29 16:46
16:50 FROGGS joined 16:51 Swarley_ joined 17:02 Pleiades` left 17:08 Pleiades` joined 17:15 kaleem left
timotimo what's weird about ti? :\ 17:23
17:28 SunilJoshi left 17:29 Pleiades` left 17:34 Pleiades` joined 17:36 vividsnow left 17:40 Chillance joined 17:52 zby_home joined 17:55 SamuraiJack joined 18:01 vividsnow joined 18:05 dakkar left 18:08 MayDaniel joined 18:09 am0c left 18:16 vividsnow left
[Coke] . o O (It's so quiet) 18:19
dalek rl6-roast-data: e386aae | coke++ | / (4 files):
today (automated commit)
18:20 arlinius left
[Coke] sorear, colomon : S05-substitution/subst.niecza aborted 136 test(s) 18:20
timotimo [Coke]: maybe you have an error that doesn't have enough information that i could improve? :P 18:21
or i could really try to tackle the optimisation of the junction operators for constants+variables? 18:22
[Coke] r: cool 18:23
p6eval rakudo 6b0cea: OUTPUT«===SORRY!===␤Undeclared routine:␤ cool used at line 1␤␤»
[Coke] r: cool $it
p6eval rakudo 6b0cea: OUTPUT«===SORRY!===␤Variable '$it' is not declared␤at /tmp/HmvZBgIBG8:1␤------> cool $it⏏<EOL>␤ expecting any of:␤ postfix␤»
[Coke] r: my cool $it
p6eval rakudo 6b0cea: OUTPUT«===SORRY!===␤Malformed my␤at /tmp/NY49iPNMRw:1␤------> my ⏏cool $it␤ expecting any of:␤ scoped declarator␤»
[Coke] timotimo: I have a recent RT that masak opened for me that could use some love. 18:24
other than that, I don't have any guidance for you atm.
r: given say take uc 18:27
p6eval rakudo 6b0cea: OUTPUT«===SORRY!===␤Missing block␤at /tmp/DH7UIbc212:1␤------> given say take uc⏏<EOL>␤ expecting any of:␤ argument list␤ postfix␤ infix or meta-infix␤ infix stopper␤ parameterized block␤»…
timotimo improving those doesn't seem trivial enough for me :P 18:29
[Coke] timotimo: eh, I'm just playing. "my cool $it" seems like the most likely to be improved by getting "Cool" suggested. 18:30
r: my Barf $it
p6eval rakudo 6b0cea: OUTPUT«===SORRY!===␤Malformed my␤at /tmp/Zs8LQOzGNv:1␤------> my ⏏Barf $it␤ expecting any of:␤ scoped declarator␤»
[Coke] r: my enum $it
p6eval rakudo 6b0cea: OUTPUT«===SORRY!===␤Malformed my␤at /tmp/RS7ABPuOiv:1␤------> my enum $it⏏<EOL>␤ expecting any of:␤ scoped declarator␤»
18:34 SmokeMachine left 18:45 jlaire left, japhb_ left 18:46 kivutar left 18:47 fgomez left 18:49 cog joined 18:50 SamuraiJack left, jlaire joined
timotimo right, that should definitely happen. 18:53
18:57 xinming left
timotimo i wonder how i can handle that, though. from afar it looks like it's already happening in the parsing stage, before any action has been called, so i may have to plug in a closure before the "malformed my" gets emitted that checks if the type is typo'd 18:58
18:59 SmokeMachine joined 19:01 snearch joined 19:03 xinming joined 19:04 Swarley_ left 19:07 benabik joined
timotimo strangely, i can't seem to find the place where malformed my is thrown 19:08
oh, it seems i can get a traceback for it, though 19:09
r: my Foo $a; class Foo { }; 19:11
p6eval rakudo 6b0cea: OUTPUT«===SORRY!===␤Malformed my␤at /tmp/2Ol0MwAf_Y:1␤------> my ⏏Foo $a; class Foo { };␤ expecting any of:␤ scoped declarator␤»
timotimo ah, so at that point, the type name must already be known. good to know.
19:16 japhb_ joined
timotimo tests the first patch 19:17
mathw Hello! 19:18
timotimo std: my Foo $a; class Foo { };
p6eval std 7deb9d7: OUTPUT«===SORRY!===␤In my declaration, typename 'Foo' must be predeclared (or marked as declarative with :: prefix) at /tmp/ehex2PkHnA line 1:␤------> my Foo⏏ $a; class Foo { };␤Malformed my at /tmp/ehex2PkHnA line 1:␤------> my [3…
timotimo i wonder if it would be okay to parse the future of the document to look for post-declared classes and suggest them?
TimToady sure, all is fair in the quest for good error messages, once you know it's gonna blow up anyway 19:20
timotimo the first idea that comes to mind is pretend we succeeded and use the mystery mechanism that's already in place
TimToady might work 19:22
timotimo first i'll have to get this typo_longname token to work properly, though
TimToady or go ahead and introduce a poisoned symbol, then recall <scoped>
by the end of the unit we can tell whether they typo'd or meant to postdeclare the unpostdeclarable 19:23
as long as we don't accidentally accept the program, we're golden 19:24
errand & 19:25
skids What do we do if a user has put some IO work in a BEGIN block or whatnot?
TimToady no compiler can fix or even detect all the erroneous code in the world 19:26
that's why we have the category "erroneous" in the first place 19:27
skids Ah so "don't do that". Sounds fine.
timotimo are BEGIN phasers run before the parse has finished?
TimToady they are run the moment the BEGIN's code is done parsing 19:28
obviously they cannot refer to anything postdeclared
timotimo oh, ok
TimToady likewise macro calls 19:29
skids I guess now that pragmas and such are scoped to the unit we don't have to worry about use statements so much. 19:30
masak mathw! \o/ 19:33
19:33 Chillance left 19:34 Chillance joined 19:36 MikeFair__ joined
timotimo to be honest, i'm not quite sure how to work this :| 19:42
i'm trying to maoh, maybe there's whitespace i should be matching!
19:42 MikeFair left
timotimo great! that fixed it and now suggestions are emitted if possible 19:46
[Coke] maoh? 19:55
19:55 bluescreen100 joined
timotimo i think i was in the middle of typing "i'm trying to match longname", and then got the idea thet led me to the road towards victory! :) 19:55
[Coke] oh! 19:57
19:57 ifim joined
masak mid-word insight. :) 19:58
19:58 bluescreen10 left
timotimo huh, this is strange. a call on nqp::join("\n ", @.suggestions) in X::Undeclared.message fails with "elements() not implemented in class 'Array'", but the same code works no-problemo a few lines above it in my token typo_longname - probably because the one is actually nqp and the other one is perl6 code in the setting 19:58
i wonder if other parts that sahre the undeclared exception and the suggest_* methods from World suffer from the same problem (and i also wonder how it should be fixed) 19:59
moritz @.suggestions looks very much like Perl 6 to me, not nqp
timotimo r: class C is cool { };
p6eval rakudo 6b0cea: OUTPUT«===SORRY!===␤'C' cannot inherit from 'cool' because it is unknown.␤Did you mean one of these?␤ 'Cool'␤ 'Bool'␤␤at /tmp/y9zneb_waZ:1␤------> ␤»
moritz if that's the case, just use its .join method
timotimo OK.
ah, great! 20:02
20:05 sqirrel left
timotimo spectests 20:09
20:14 SmokeMachine left 20:27 spider-mario joined 20:28 benabik left 20:30 benabik joined
timotimo huh, whenever there are no suggestions, i seem to be getting "null pmc access in invoke()" when i do "if nqp::elems(@suggestions) > 0 { ... }" but i've tried to make sure @suggestions gets initialised to [] if nothing gets added to it 20:31
r: class C is uideatrniudtraneudtrainedtriuane {}; 20:32
p6eval rakudo 6b0cea: OUTPUT«===SORRY!===␤'C' cannot inherit from 'uideatrniudtraneudtrainedtriuane' because it is unknown.␤at /tmp/yE6hidtEWJ:1␤------> ␤»
20:32 benabik left, benabik joined
timotimo but +@l seems to work. not sure why i didn't have that before. 20:33
no, that doesn't actually help. now i'm confused :| 20:36
moritz is @suggestions a nqp or a Perl 6 array?
timotimo i created it inside nqp code, in a method of World, using my @suggestions; (and later: my @suggestions := [];) 20:37
maybe i have to use nqp::elems in the grammar token that creates suggestions and wrap it into a perl6 list before throwing the Undeclared exception? 20:40
20:41 FROGGS[mobile] left
moritz now I'm confused 20:42
timotimo as am i
moritz at the point where you're writing nqp::elems(@suggestions), what is @suggestions?
is it an Array (Perl 6)?
or is it a ResizablePMCArray (nqp/parrot)?
timotimo i think it's a ResizablePMCArray 20:43
well, pretty sure, i saw an error about that class when i tried .elems()
moritz and are you sure that the "null pmc access in invoke()" actually comes from the nqp::elems call? 20:44
and not from something inside the if block, for example?
timotimo somewhat sure, but let me try something else real quick
i may not even need the if statement
GlitchMr masak: just wondering, when the "Tell knights from knaves based on what they say." task blog post will appear.
I'm wondering what others have done (I already know my entries are bad) 20:45
masak thank you for your interest. 20:46
I'll start doing the reviewing in the weekend.
we'll see how far I get. :)
timotimo masak: i'm also interested! decided not to pester you ;)
masak heh. 20:47
GlitchMr: why do you say your entries are bad? didn't you say in one of the weekly updates that the p6cc problems were easy? :P
GlitchMr I did?
masak anyhoo, I'm happy there's general interest. 20:48
GlitchMr Whatever.
masak "By the way, if you don’t know about Perl 6 Coding Contest, check it out. The challenges are rather easy if you had any programming language experience"
I read that and thought "...wut?" ;) 20:49
GlitchMr They appeared to me to be easier than 2011 challenges.
Or perhaps they are just more interesting.
timotimo hm, are you aware of the "amb" operator? the one where you give a bunch of options and you get the right one out if there's a right answer? 20:50
masak I believe they were a bit easier than the 2011 challenges.
timotimo is that easily doable in perl6?
masak timotimo: yes, I'm aware of it.
timotimo: you should check out nothingmuch's implementation on CPAN.
(and his blog posts about it)
timotimo: no, there's no easy/nice way that I know of.
timotimo: closest we've got is TimToady++ simulating amb through the backtracking of grammars ;) 20:51
GlitchMr rosettacode.org/wiki/Amb
masak GlitchMr++
moritz I think that's on rosettac... what GlitchMr said
masak "At some point we'll wrap this up in nice syntax to let people write in a sublanguage of Perl 6 that looks more like a logic language." 20:52
promises, promises. ;)
when is Perl 6 gonna be released already!? </troll> 20:53
20:53 rindolf left
timotimo :) 20:55
20:55 bluescreen__ joined
timotimo "all tests successful", I enjoy reading that 20:56
[Coke] hopes masak is checking for extensions of the grammar! 20:57
(for t1)
[Coke] does wish he had spent another hour cleaning up his t1 solution, but thinks it's "ok"
timotimo huh, why does this already work?! 20:59
that's pretty cool.
20:59 bluescreen100 left
timotimo r: sub foo(cool $a) { }; 20:59
p6eval rakudo 6b0cea: OUTPUT«===SORRY!===␤Invalid typename 'cool' in parameter declaration. Did you mean 'Cool', 'Bool'?␤at /tmp/MbYJ1YhVWm:1␤------> sub foo(cool⏏ $a) { };␤»
GlitchMr For some reason I bet that some code submitted to masak's contest will have code like if (...) { ... } and masak will complain about parens.
timotimo oh, i already implemented this some time ago? or maybe someone else did.
20:59 rindolf joined
GlitchMr timotimo: You did 20:59
glitchmr.github.com/helpful-error-messages.html 21:00
moritz timotimo: I guess there's some special case about expecting a typename rather than a callable as the first thing in a parameter name
GlitchMr I even wrote a blog post about that feature
timotimo GlitchMr: :)
GlitchMr r: sub a($CopyPasta) { $copyPasta }
p6eval rakudo 6b0cea: OUTPUT«===SORRY!===␤Variable '$copyPasta' is not declared␤at /tmp/SY5Tr0VYZO:1␤------> sub a($CopyPasta) { $copyPasta⏏ }␤ expecting any of:␤ postfix␤»
timotimo that's how you know that you're making an impact on the world
GlitchMr r: sub a($CopyPastam) { my $CopyPasta = $CopyPastam; $copyPasta } 21:01
timotimo ah, that doesn't work yet?
p6eval rakudo 6b0cea: OUTPUT«===SORRY!===␤Variable '$copyPasta' is not declared. Did you mean '$CopyPasta'?␤at /tmp/J1qsScxR9U:1␤------> my $CopyPasta = $CopyPastam; $copyPasta⏏ }␤ expecting any of:␤ postfix␤»
GlitchMr timotimo: However, I would like the sub a($CopyPasta) { $copyPasta } to work.
For some reason, your code doesn't see function arguments.
timotimo yup, ditto
maybe because they're incomplete at that time?
21:02 nnunley joined
timotimo r: sub foo(--> Strnig) { "a" } 21:05
p6eval rakudo 6b0cea: OUTPUT«===SORRY!===␤Missing block␤at /tmp/eT5GuJA09q:1␤------> sub foo(--> ⏏Strnig) { "a" }␤ expecting any of:␤ statement list␤ prefix or term␤ prefix or meta-prefix␤ new name to be defined␤»…
timotimo that still needs to be fixed, too. i'll do that first
jnthn is home :)
evening o/
nwc10 yay!
moritz \o jnthn 21:06
jnthn hi moritz :)
timotimo: fwiw, I think the undeclared type thing you're looking at may be best handled through the MYSTERY mechanism.
21:07 hash_table left
timotimo jnthn: excuse me, which one exactly? 21:09
jnthn I only implemented it, not remembered where it went :P 21:10
timotimo i meant to ask, which undeclared type thing was i looking at?
jnthn ah, yeah, search for %*MYSTERY
timotimo i've seen MYSTERY, i've enhanced it with suggestion code, too ;)
jnthn the "my Foo $x" one, I thought?
timotimo ah, yeah i could certainly do that
especially since it doesn't die instantly
jnthn Yeah, for those things we can afford to just be sorry rather than panic :) 21:11
jnthn wonders why masak is so hysterical in rakudobugs these days :/ 21:13
masak I AM!?!?!
jnthn "omgz it's 2013 and X broke!" 21:14
"state variables are seriously broken 'cus a weird edge case doesn't work!"
masak yes, let's rename that one.
timotimo jnthn: what 'ctx' parameter should i pass? :\
jnthn lemme remember what ctx is :) 21:15
timotimo :D
sometimes 'termish', sometimes 'var'
jnthn yeah 21:16
masak jnthn: it's now "[BUG] 'state' with anonymous scalars works more like 'my' in Rakudo"
jnthn: thank you for your feedback. I'll try to be less alarmist next time something regresses in Rakudo. 21:17
jnthn masak: I suspect it may be a one line fix or so
timotimo is it only a use/declare distinction or something? to find out if the thing was post-declared?
jnthn timotimo: I don't actually see it being used.
timotimo that's right.
jnthn Yeah, it looks unused to me. OK, next qestion...I copied it from STD, so what does STD use it for :) 21:18
masak: Typically they mean "we're missing a test"
timotimo: oh... 21:19
timotimo: It's used in an error message we didn't implement yet.
see infix:lambda in STD
timotimo: The only think it cares about is whether it's ( or not :)
Anyway, put the rule name in :) 21:20
(scoped or so)
timotimo OK
jnthn *thing
timotimo well, this time it's in a sub-rule, i made a token typo_typename
jnthn timotimo: Is there a reason to do that and not the way STD does it, ooc? 21:21
Looking at STD though, it doesn't use mystery for it.
But it does call sorry
timotimo er, dunno 21:22
hm, throwing a X::Undeclared is worse than a sorry, right? 21:23
jnthn std: my OMGBBQ $x;
p6eval std 7deb9d7: OUTPUT«===SORRY!===␤In my declaration, typename 'OMGBBQ' must be predeclared (or marked as declarative with :: prefix) at /tmp/P_V9hlirtc line 1:␤------> my OMGBBQ⏏ $x;␤Malformed my at /tmp/P_V9hlirtc line 1:␤------> my ⏏O…
jnthn timotimo: I'd rather not use $*W.throw directly, use .typed_sorry or so.
timotimo right, sorry spits out an error, but continues parsing, isn't that right?
jnthn Yes, but it's still fatal.
That is, we keep parsing.
timotimo i could surely do that. first i'll test if my use of the mystery mechanism was correct 21:24
jnthn But we don't consider the program OK.
If we panic we report the sorrows up to that point
And if not we panic with the sorrows :)
japhb_ There's something very poetic about those last two statements, jnthn 21:25
21:25 skids left
PerlJam japhb_: it reminded me of Metallica's "Harvester of Sorrow" 21:26
jnthn japhb_: github.com/rakudo/rakudo/blob/nom/...ar.pm#L727 :)
21:26 swarles joined
swarles LoL􏿽xB1 ? 21:27
what is that feature?
japhb_ Oooh, Metallica. I may have to listen to Map of Metal today
swarles I would hope it's not "laughing out loud"
jnthn List of List
japhb_ swarles, List of Lists
swarles ah. So like, [[1,2,3],[1,2,3],[1,2,3]]?
japhb_ $*SORRY_LIMIT ... # when sorrow turns to panic 21:28
very nice
swarles And dare I ask what a shaped array is?
japhb_ swarles, when you know the size of every dimension
swarles Oh.
japhb_ Er, to a first approximation
swarles Is that just an optimization thing?
Like, a tuple in a way. Just with variable size? 21:29
Err, not variable
Variable in the sense of the prefix to that word changes
japhb_ "multi-dimensional"?
PerlJam swarles: my int @foo[42]; # shaped to suit the universe 21:30
swarles ah
That makes sense.
timotimo jnthn: the mystery mechanism doesn't seem to have worked, at least not the way i tried it
jnthn timotimo: Yeah, now I see that STD already handles it with sorry, I think we stick with an approach like that. :)
PerlJam timotimo: maybe you need to call in Shaggy and Scooby?
japhb_ swarles, search for 'shaped' in the specs. :-) 21:31
timotimo :)
swarles Yeah, I found the spec page. I'm pretty sure I understand it now
japhb_ swarles, I recommend cloning the specs repo and using 'git grep' for great justice. 21:32
swarles Impressive, rakudo seems a lot closer to complete implementation than the last time i checked if my memory served (Probably doesn't)
Oh right, that's what I was doing
swarles goes back to setting up gentoo in vmware 21:33
japhb_ <mr_burns>Excellent ...</mr_burns>
swarles I lost track of time goofing off while stage-3 was extracting
-O2 -pipe -fomit-frame-pointer -march=native ... am I missing anything? 21:35
masak japhb_: you're not supposed to use tags with style information. :P 21:37
21:37 snearch left
masak ponders the semantic way of doing that 21:38
timotimo i'm having trouble using typed_sorry :| 21:39
[Coke] <i data-voice="Mr. Burns">Excellent &hellip;</i> 21:40
timotimo i get a null pmc access in invoke() again when i use it. i'll revert to $*W.throw for the time being
[Coke]: the i tag isn't better, try <emph>
[Coke] timotimo: I will yield to practicality on that one, being able to use a one char tag. 21:42
masak [Coke]++ # semantic
swarles waits for portage to update 21:44
21:45 benabik_ joined, benabik left, benabik_ is now known as benabik
timotimo makes a clean build and spectests again 21:46
21:47 benabik left 21:49 kivutar joined 22:00 fgomez joined
jnthn Hm, why does Rakudo spectest take so long these days... 22:11
cog r: my ($abe, $ba, $abc); $abd
p6eval rakudo 6b0cea: OUTPUT«===SORRY!===␤elements() not implemented in class 'Array'␤»
jnthn wtf 22:12
cog :)
jnthn r: $abd
p6eval rakudo 6b0cea: OUTPUT«===SORRY!===␤Variable '$abd' is not declared␤at /tmp/z9dcbwFIBG:1␤------> $abd⏏<EOL>␤ expecting any of:␤ postfix␤»
jnthn r: my $abc; $abd
p6eval rakudo 6b0cea: OUTPUT«===SORRY!===␤Variable '$abd' is not declared. Did you mean '$abc'?␤at /tmp/f4G3CuM6e1:1␤------> my $abc; $abd⏏<EOL>␤ expecting any of:␤ postfix␤»
masak submits rakudobug
jnthn r: my $abc; my $abe; $abd
p6eval rakudo 6b0cea: OUTPUT«===SORRY!===␤elements() not implemented in class 'Array'␤»
jnthn *sigh*
cog problem is with many approximate candidates with the levenstein distance
nice code btw. :) 22:13
masak cog++
22:13 cog is now known as cognominal
timotimo jnthn: my suggestion code breaking? 22:14
jnthn The rule is simple. If you're writing Perl 6 code and refer to something with an @, NEVER use nqp:: stuff on it!
timotimo since i'm at it right now anyway, ...
jnthn timotimo: I think so.
timotimo works locally, so when my branch gets pushed to the next time, i'll send the pull-request
jnthn OK
timotimo spectesting at this precise moment 22:15
r: Whaetver.new(); # fixed this locally, too 22:16
p6eval rakudo 6b0cea: OUTPUT«===SORRY!===␤Undeclared name:␤ Whaetver used at line 1␤␤»
timotimo (fixed == added suggestions)
jnthn We only ever invoke the levenstein to generate errors, yes?
timotimo yes, that's right
jnthn OK
timotimo sigh, test failure 22:17
jnthn I need to figure out where the performance regression has come from...
spectest taking 30-40 seconds longer is a problem.
22:17 MayDaniel left
timotimo got rid of the last failure. 22:19
22:23 zby_home left
timotimo the pull request is up in case someone wants to review it 22:23
22:24 kivutar left
jnthn timotimo: oh, weird 22:25
github.com/timo/rakudo/commit/9a88...3e10ad637a
We have:
$/.CURSOR.sorry("In \"$*SCOPE\" declaration, typename $t must be predeclared
...
That should be catching the error you've added handling for
timotimo yes, i wasn't sure why i didn't see that particular error at all 22:26
jnthn I'd rather that was figured out before merging this
timotimo ah, because it's missing the <.ws> at the beginning i bet
i'll try that
jnthn OK, we don't need both. 22:27
And your suggest-y handling is nicer :)
timotimo do you prefer mine? :)
jnthn Kinda
The suggestions are good
22:27 raiph joined
jnthn But I don't like it using $*W.throw 22:27
timotimo should i add a <?before [A..Z]> for mine, too?
jnthn Yes, it's a good heuristic.
timotimo can you see how to properly throw a sorry using not $*W.throw? 22:28
jnthn $/.CURSOR.typed_sorry should be possible instead of $*W.throw
timotimo i tried self.typed_sorry, but that didn't work at all
right, i'll try that
jnthn sorry doesn't throw immediately
It tries to parse a bit further
Which can help us find other errors and tell the user about them together.
timotimo yes, adding the <.ws> indeed makes that sorry happen 22:30
jnthn OK :)
timotimo should i add a <!>, too?
jnthn 275278 doesn't have the performance regression
ifim gklew
jnthn timotimo: yes, plesae. Please try and keep us close to STD. 22:31
timotimo: Being 100% matching with STD isn't a goal, but we should try and get the same parse that it does.
timotimo wow, that was unhelpful 22:35
immediately after the suggestion, it falls back into the "malformed my" error
i wonder if it would continue a lot, though?
22:36 kaare_ left
jnthn std: my OMG $x; 22:36
p6eval std 7deb9d7: OUTPUT«===SORRY!===␤In my declaration, typename 'OMG' must be predeclared (or marked as declarative with :: prefix) at /tmp/j1PRILbzCm line 1:␤------> my OMG⏏ $x;␤Malformed my at /tmp/j1PRILbzCm line 1:␤------> my ⏏OMG $x;…
timotimo the new commit is there
jnthn timotimo: That's what STD does.
timotimo that's what rakudo does, now, too 22:37
timotimo runs spectests just to be extra sure
jnthn Thanks :)
timotimo sure, no worries (or sorrows or panics) 22:38
did you check what test exactly takes longer? has S32-io/IO-Socket-Inet always been this slow? 22:42
jnthn timotimo: My current hypothesis is that it's not the tests but a change in Rakudo
(making all tests run a bit slower and thus the total time longer) 22:43
timotimo mhm
jnthn I'm curerntly trying to figure out if the repr compose stuff I changed is something to do with it.
If it is, then I'm gonna be rather surprised.
22:44 bluescreen__ left
jnthn Will have the numbers on that soon 22:44
[Coke] wonders if he should think about trying to capture test run times in the daily roast run. 22:45
[Coke] imagines that's less than helpful, as both tests and impls are changing.
[Coke] heads home
jnthn Hm, doesn't seem it was that 22:46
22:49 stopbit left
timotimo jnthn: the spectest succeeded without errors. i'll push new spectests after the pull request has been merged 22:50
jnthn [ '-->' <.ws> <typename> || '-->' <.ws> <typo_typename> ]? 22:58
I'm wondering if that shouldn't be
[ '-->' <.ws> [ <typename> || <typo_typename> ] ]?
timotimo i can easily change that. shouldn't make a difference
jnthn I guess it's equivalent...
timotimo if you want, i'll change it, test it quickly and commit again 22:59
jnthn Don't worry about it, I think it'll be OK
timotimo OK :)
jnthn I mean, feel free to do it but it won't stop me merging this unless I find anything else wrong...
dalek kudo/nom: 014f8ca | (Timo Paulssen)++ | src/core/Exception.pm:
use @.suggestions.join instead of nqp::join.
23:00
kudo/nom: 9a889fd | (Timo Paulssen)++ | src/Perl6/Grammar.pm:
add a token typo_typename and use it in "my" declarations.
kudo/nom: 0ceef80 | (Timo Paulssen)++ | src/Perl6/Grammar.pm:
throw the sorry anyway, since we did match a longname.
kudo/nom: b97fb88 | (Timo Paulssen)++ | src/Perl6/Grammar.pm:
suggest names for --> Unknown, too.
kudo/nom: 25d87ef | (Timo Paulssen)++ | src/ (2 files):
suggest Types, too for Undeclared::Symbols.
kudo/nom: 0ae1e8d | (Timo Paulssen)++ | src/Perl6/Grammar.pm:
throw a sorry instead of an exception, remove old error.
kudo/nom: 1553b11 | jonathan++ | src/ (2 files):
Merge pull request #100 from timo/typename_suggestions

Typename suggestions: in signatures, declarations, return types, ...
timotimo heh, spammmmm :)
thank you
here's the corresponding spectests
jnthn thanks for working on this :)
dalek ast: 73618a5 | (Timo Paulssen)++ | S32-exceptions/misc.t:
"my cool $a" -> X::Undeclared + suggestions
23:01
ast: cc878f5 | (Timo Paulssen)++ | S32-exceptions/misc.t:
check for Type suggestions in Undeclared::Symbols.
ast: b059711 | (Timo Paulssen)++ | S32-exceptions/misc.t:
undeclared types in my are now Come::Group.
timotimo hm, it would be nice if someone put more LHF into LHF.markdown, or give it a general work-over. the lines are from 2011-06 through 2011-07 23:02
(although i don't very much care for the contents of that file)
jnthn OK, b49cbe0 lacks the performance regression also 23:05
23:06 kshannon joined
timotimo huh, only commits from me remain :| 23:07
or the nqp version bump perhaps
jnthn oh, I've done all the tests against nqp master 23:08
timotimo huh, strange.
jnthn I'm wondering if somehow my system was highly loaded when I did the first test with some unkown process
timotimo can i specifically refer to things from the setting? like a fully qualified name? 23:11
23:11 cognominal left
jnthn CORE:: 23:12
Or SETTING::
Depending on how you define setting
timotimo ah, indeed.
i probably mean CORE, i think.
jnthn It's starting to look like my extra-long spectest run was bogus. :( 23:13
Well, :) in the sense we don't have a big performance regression though...
There's only two of your commits and neither of them looks like it could possibly be to blame. 23:14
timotimo those are the best kind of problems ;)
so, i'm trying to get the optimiser to improve junctions where all values are known at compile time and i'm trying to identify if the | or ~ that's in use at that point is the one from CORE. i suppose find_lexical("CORE") was a foolish idea - what do i do instead? 23:15
jnthn "~"? Did you mean "&"? 23:17
timotimo er, yes
jnthn phew :)
timotimo or sometimes ^
23:17 cognominal joined
timotimo the qast that rakudo spits out when i write just CORE::infix<|>(1, 2, 3) is somewhat unhelpful somehow :| 23:18
jnthn yes, I was just trying to figure out what we compile those forms too... :) 23:19
timotimo :D
glad to see i'm not the only one who's confused
apparently it creates a new PseudoStash and looks it up in there? that's strange to me.
jnthn ah, yeah 23:20
Yeah, it makes sense. But it's not so helpful in the optimizer.
Though you can potentially do it. 23:21
23:21 LordVorp left
jnthn find the PseudoPackage symbol 23:21
oh wait
That won't work at all :)
timotimo it's good i didn't even try yet! :)
masak .oO( "Find the PseudoPackage symbol". boringest family game of 2012 ) 23:22
timotimo masak: for long car rides? :)
masak "are we pseudo-there yet?"
jnthn masak: tbh, pin that tail on the cons cell wasn't much more interesting... 23:23
masak :D
timotimo :D
masak though even that was better than "replace the return trip with a continuation". 23:24
jnthn timotimo: oh, I know
timotimo: The CORE setting context has a magical lexical called "!CORE_MARKER" installed in it.
timotimo ooooh 23:25
jnthn timotimo: So if you find the QAST::Block with that in, then you can look at the &infix:<&> inside of that block.
timotimo great!
jnthn timotimo: Or you can write an "is_core_symbole"
Which tries to find it, then checks the block it finds it in also has that marker.
timotimo if i may, i'll enhance find_lexical with a :$must-be-core? 23:26
jnthn timotimo: I think that may be more confusing :) 23:27
timotimo hm, ok
jnthn Just 'cus you *can* re-use code more doesn't always make it a good idea :)
masak +1 23:29
you want to braid code paths and responsibilities together, most of the time. 23:30
of course, responsibilities keep changing with the design, so doing this right requires having perfect knowledge of the future.
jnthn braids are awesome
masak "dude, you had me at 'braids'" 23:31
jnthn :P
timotimo found the core! :)
jnthn yay :)
masak .oO( zombie jnthn goes "braaaaaaaids" )
jnthn :P
masak 'night, #perl6 23:32
japhb_ He doesn't eat your brains, he ties them in corn rows?
o/ masak
jnthn OK, my performance regression test results were bogus
phew
timotimo phews, too 23:33
swarles swehp
23:36 Targen left 23:37 rindolf left
timotimo mhhh tree-splicing 23:39
don't quite know how to handle this properly in the code 23:40
23:40 spider-mario left 23:41 fhelmberger joined
timotimo i wonder if throwing an exception is a good idea? :| 23:41
using exceptions for control flow is ... o_O 23:42
23:42 fhelmberger left
jnthn Well, the reason I said make it a is_core_symbol is so you can use it to check if it is one 23:42
timotimo i could put a closure into a dynamically scoped variable that does what's necessary at the right level. that sounds like a crazy hack
oh, i wasn't being clear at all 23:43
jnthn So you can write like if ...the qast looks right... && is_core_symbol('&infix:<|>') or so
timotimo the thing is, i need to look two nodes down the tree for a &infix<|> for instance
jnthn What are you trying to transform?
You can use indexing to look at children. 23:44
timotimo i can't look at parents, though, which would be more helpful
jnthn What are you trying to transform?
if $x == 1 | 2 style things? 23:45
timotimo yes
something like Op(if){ Op(chain ==){ Op(infix:<|>) { 1, 2, 3 }, 5 } } into Op(if){ Op(infix<||>) { ... } }
jnthn OK
timotimo looking two nodes deep for each Op i encounter seems like a big waste of time
jnthn You need to be really careful because if you just do the naive thing, you evaluate the $x twice. 23:46
timotimo ah, that's a good point.
jnthn OK, but you know what only if and unless with a chain immediately below are interesting.
timotimo hm, nothing else?
jnthn And you can use a hash to check the name of the chain is something interesting.
Well, it's better to start small. 23:47
timotimo suret
eeeeenh, my typing has been better :|
jnthn In fact, I guess any chaining thing is probably interesting.
I'd do it by looking down, though. 23:48
timotimo OK
jnthn Rather than trying to keep context around
Trouble with keeping a dynamic around is you gotta reset it somewhere.
And exceptions will be more costly too.
timotimo OK
jnthn nqp::istype($node, QAST::Op) is pretty cheap
So it's almsot certainly the cheapest way. 23:49
And safest.
Inlining just goes of "is it a call op"
*off
The thing that will make it tricky is that for
if $x == 1|2 { }
You can't just duplicate the node that looks up $x
Sicne it may be 23:50
if foo() == 1|2 { }
And you'd do the side-effects of foo twice.
timotimo yes
is that so very tricky?
jnthn So you'll need to evaluate it and bind it into a temporary (a QAST::Var with local scope)
timotimo that's what i figured
jnthn It's not tricky to deal with.
The main problem with working on the optimizer is knowing what you can get away with, tbh :)
It's easy to be faster and wronger ;) 23:51
timotimo hehe, yes indeed
jnthn I think this is a pretty safe transformation overall.
timotimo is there something like nqp::startswith?
jnthn No
timotimo (i've also checked the timings some time ago, it would also be very worthwhile)
so i'll do substr(...) == 0?
jnthn For which bit?
timotimo that the op name starts with "chain" 23:52
jnthn Oh
No, it doesn't start with
.op eq 'chain'
timotimo oh, that easy?
jnthn Yeah
.name is where the name of the chained thing is stored.
timotimo good to know
jnthn oh... 23:54
Hm.
no, you're fine
There is the slight issue that your optimization may be "beaten"
no, it won't be.
Ignore me :)
$a == $b *can* be inlined
*but* not for the Junction variant 23:55
timotimo pardon?
jnthn So provided you put your stuff after that load of inlining code you're good.
see visit_op
(which is where in Optimizer you'd need to add code)
Of note, around 140
timotimo ah, the chain will be changed into a non-chain? 23:56
jnthn Kinda
It is detecting if it's simple enough to potentially do an inlining optimization.
my int $a = 42; if $a == 42 { } 23:57
In that case it will inline the ==
timotimo inlined in what way? the chain gets turned into a call, yes?
jnthn No, it actually eliminates the call completely.
timotimo oh, ok
jnthn Simple enough subs have their QAST saved with them 23:58
If we detect a call to something like that, we just shove the QAST directly in place of the call.
timotimo mhm, ok
jnthn We also resolve some multiple dispatches statically
Anyway, in the junction case that does not happen. 23:59
You *may* find that the inline code is eating your lunch though...
timotimo a chain op can have as many children as it wants, right?
jnthn No
Two
But it processes other children that are chains specially
In QAST::Compiler
timotimo ah, and the second one may be a chain op again, if we have something like 1 == 1 == 1?