Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6-dev, 2016-11-11

| Channels | #perl6-dev index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:09 pyrimidine joined #perl6-dev
00:18 pyrimidine joined #perl6-dev
00:28 pyrimidine joined #perl6-dev
00:32 MasterDuke so my source file+line number code breaks a couple tests. however, they are all tests that expect particular text in warnings/failures/etc (i.e., no functionality seems to be broken, just file names/line numbers change from what was previously expected)
00:33 MasterDuke additionally, it kind of has the same effect as always setting RAKUDO_BACKTRACE_SETTING=1
00:34 MasterDuke this seems to be because the filenames being reported are no longer 'gen/moar/m-CORE.setting', which a bunch of code in Backtrace.pm and/or Exception.pm check against
00:37 MasterDuke so should i try and modify those checks to get the same effect?
00:38 pyrimidine joined #perl6-dev
00:48 pyrimidine joined #perl6-dev
00:57 pyrimidine joined #perl6-dev
01:03 pyrimidine joined #perl6-dev
01:27 pyrimidine joined #perl6-dev
01:33 pyrimidine joined #perl6-dev
01:46 pyrimidine joined #perl6-dev
01:56 pyrimidine joined #perl6-dev
04:14 pyrimidine joined #perl6-dev
04:24 pyrimidine joined #perl6-dev
04:27 MasterDuke nqp: if "a1b2" ~~ /(.)/ { say("matched: " ~ $/[0]) }
04:27 camelia nqp-moarvm: OUTPUT«matched: ␤»
04:41 pyrimidine joined #perl6-dev
04:41 MasterDuke ^^^ what am i doing wrong?
04:53 vendethiel joined #perl6-dev
05:03 pyrimidine joined #perl6-dev
05:13 pyrimidine joined #perl6-dev
05:21 raiph joined #perl6-dev
05:21 raiph nqp: if "a1b2" ~~ /(.)/ -> $/ { say("matched: " ~ $/[0]) } # MasterDuke
05:21 camelia nqp-moarvm: OUTPUT«matched: a␤»
05:22 * [Coke] and his bronchitis wave to everyone.
05:22 MasterDuke raiph: hot damn! many thanks, never would have figured that out
05:23 pyrimidine joined #perl6-dev
05:30 lizmat joined #perl6-dev
05:32 pyrimidine joined #perl6-dev
05:36 raiph [Coke]: that's not fun
05:37 [Coke] raiph - nope. i have drugs, though, so all is well
05:37 raiph [Coke]: heh
05:39 * raiph wonders if the drugs are enough to make the pun that's not a pun visible >.>
05:43 pyrimidine joined #perl6-dev
05:54 pyrimidine joined #perl6-dev
06:07 pyrimidine joined #perl6-dev
06:24 pyrimidine joined #perl6-dev
06:40 pyrimidine joined #perl6-dev
06:49 RabidGravy joined #perl6-dev
06:51 pyrimidine joined #perl6-dev
07:02 pyrimidine joined #perl6-dev
07:09 pyrimidine joined #perl6-dev
07:21 pyrimidine joined #perl6-dev
07:29 vendethiel- joined #perl6-dev
07:35 pyrimidine joined #perl6-dev
07:47 pyrimidine joined #perl6-dev
07:59 pyrimidine joined #perl6-dev
08:11 pyrimidine joined #perl6-dev
08:20 pyrimidine joined #perl6-dev
08:28 [TuxCM] joined #perl6-dev
08:30 pyrimidine joined #perl6-dev
08:40 pyrimidine joined #perl6-dev
08:42 AlexDaniel joined #perl6-dev
08:54 pyrimidine joined #perl6-dev
09:10 pyrimidine joined #perl6-dev
09:19 pyrimidine joined #perl6-dev
09:31 pyrimidine joined #perl6-dev
09:49 pyrimidine joined #perl6-dev
09:59 pyrimidine joined #perl6-dev
10:16 timotimo i think :16(*) should be short form for {:16($_)} rather than error out with "This call only converts base-16 strings to numbers; value * is of type Whatever, so cannot be converted"
10:18 pyrimidine joined #perl6-dev
10:23 lizmat Files=1153, Tests=53734, 211 wallclock secs (12.67 usr  3.80 sys + 1287.42 cusr 122.35 csys = 1426.24 CPU)
10:23 timotimo the thing is, that :16(*) is call &UNBASE, number, Whatever
10:24 timotimo i don't think we have anything that'll make a call curried
10:31 [TuxCM] This is Rakudo version 2016.10-254-gd989d96 built on MoarVM version 2016.10-44-g4c9fd00
10:31 [TuxCM] csv-ip5xs        3.081
10:31 [TuxCM] test            13.638
10:31 [TuxCM] test-t           6.328
10:31 [TuxCM] csv-parser      15.284
10:31 [TuxCM] :) :) :)
10:31 timotimo good, good
10:38 pyrimidine joined #perl6-dev
10:43 timotimo m: say (104, 105).chrs
10:43 camelia rakudo-moar d989d9: OUTPUT«hi␤»
10:43 timotimo m: say "104".chr
10:43 camelia rakudo-moar d989d9: OUTPUT«h␤»
10:43 timotimo m: say ("104", "105").chrs
10:44 camelia rakudo-moar d989d9: OUTPUT«Type check failed in converting element #0 to .chr; expected Int but got Str ("104")␤  in block <unit> at <tmp> line 1␤␤Actually thrown at:␤  in block <unit> at <tmp> line 1␤␤»
10:44 timotimo ^- this should work, right?
10:48 pyrimidine joined #perl6-dev
10:54 timotimo maybe not for all of Cool, but it should definitely try for Int()
11:10 lizmat well, that function is on the edge between numbers and strings
11:11 timotimo right. but here's where that came up:
11:11 lizmat and personally I frequently mix up .ord  and .chr
11:11 lizmat as to whether it indicates what they take or what they return
11:11 timotimo m: say <<68 69>>.>>.base(16).>>.chr.join
11:11 camelia rakudo-moar d989d9: OUTPUT«,-␤»
11:11 timotimo m: say <<68 69>>.>>.base(8).>>.chr.join
11:11 camelia rakudo-moar d989d9: OUTPUT«hi␤»
11:11 timotimo m: say <<68 69>>.>>.base(8).chrs.join
11:11 camelia rakudo-moar d989d9: OUTPUT«Type check failed in converting element #0 to .chr; expected Int but got Str ("104")␤  in block <unit> at <tmp> line 1␤␤Actually thrown at:␤  in block <unit> at <tmp> line 1␤␤»
11:18 TimToady .tell viki andthen needs to return Empty on failure so that it works correctly in list comprehensions
11:18 yoleaux2 9 Nov 2016 14:46Z <viki> TimToady: could you give a ruling on whether andthen/notandthen should return Empty or the first undefined value? It creates a conflict with orelse/with either way and with needs to be rewritten without andthen: https://irclog.perlgeek.de/perl6-dev/2016-11-09#i_13539174
11:18 yoleaux2 TimToady: I'll pass your message to viki.
11:19 TimToady .tell viki The intent is that with also work right in list comprehensions, so there's no problem implementing with in terms of andthen
11:19 yoleaux2 TimToady: I'll pass your message to viki.
11:20 * TimToady is more or less on vacation after Web Summit, but here I am anyway :)
11:51 dalek rakudo/nom: 839c762 | lizmat++ | src/core/Shaped (2 files):
11:51 dalek rakudo/nom: Fix my @a[3;3]; $_ = $++ for @a
11:51 dalek rakudo/nom:
11:51 dalek rakudo/nom: The iterators for shaped arrays weren't containerizing unassigned
11:51 dalek rakudo/nom: values, so we couldn't assign values through the iterator.
11:51 dalek rakudo/nom: review: https://github.com/rakudo/rakudo/commit/839c7620a6
11:51 lizmat no spectests for this case  :-(
11:51 lizmat m: my @a[3;3]; $_ = $++ for @a
11:51 camelia rakudo-moar d989d9: OUTPUT«Cannot assign to an immutable value␤  in block <unit> at <tmp> line 1␤␤»
11:54 MasterDuke lizmat: how important do think it is for the line number stuff i'm working on to exactly match the Perl 5 spec?
11:55 lizmat well, it would be nice  :-)
11:55 lizmat what part of the "perl 5 spec" is the problem ?
11:55 lizmat (as there is just an implementation :-)
11:55 MasterDuke the regex used in Perl 5 is     /^\# \s* line \s+ (\d+) \s* (?:\s("?)([^"]+)\g2)? \s* $/x
11:56 MasterDuke using almost that exact same regex caused my nqp compile to take longer than overnight
11:57 timotimo well, that's easy
11:57 timotimo isn't (?: ... ) an optional group?
11:57 viki Hm. I need to think more about it then. 'cause I see notandthen returns Empty IF the item *is* defined. And then we have orelse that returns the $current item if it is defined.... But maybe that's OK and the bug I was trying to solve can be solved by just evaluating the thunk before returning it.
11:57 yoleaux2 11:18Z <TimToady> viki: andthen needs to return Empty on failure so that it works correctly in list comprehensions
11:57 yoleaux2 11:19Z <TimToady> viki: The intent is that with also work right in list comprehensions, so there's no problem implementing with in terms of andthen
11:57 lizmat ^#line (\d+) (\S+)
11:57 lizmat would work for me...
11:58 timotimo so you'd end up with \s* and \s* directly after each other
11:58 timotimo sorry, the ? after the group is what makes it optional, duh
11:58 lizmat I think we can just force a single space between the number and the rest
11:58 MasterDuke lizmat: that's much easier, i can do that with a combination of nqp::indexs and such
11:58 lizmat yeah, indeed...
11:58 timotimo why can't you parse the stuff out in the grammar already?
12:00 MasterDuke well, i'm currenty working in s/v/m/Q/QASTCompilerMAST.nqp
12:00 MasterDuke in compile_all_the_stmts()
12:01 MasterDuke which is what calls HLL::Compiler.lineof
12:01 timotimo oh
12:01 MasterDuke and creates the annotation
12:02 MasterDuke and i hadn't looked at the nqp grammar and how i would get info to compile_all_the_stmts()
12:03 MasterDuke though, could i do something like you showed for rakudo?
12:05 timotimo i thought you were putting all the info into some data structure that you could just use in lineof
12:06 dalek rakudo/nom: 9a6ad43 | lizmat++ | src/core/Shaped (3 files):
12:06 dalek rakudo/nom: Make 123dimmed uninited elems assign a bit faster
12:06 dalek rakudo/nom:
12:06 dalek rakudo/nom: Not much, since you don't follow this path much anyway.
12:06 dalek rakudo/nom: review: https://github.com/rakudo/rakudo/commit/9a6ad43bcd
12:07 MasterDuke this is what i have now: https://gist.github.com/MasterDuke17/ed414755e6b0d1a5752cb93a337eb224
12:07 MasterDuke and it does work
12:10 timotimo oh, are you trying to parse the whole target string for line number annotations each time a node's line number is required?
12:11 timotimo i was expecting there'd be a list of line numbers that correspond to file beginnings and then you just linear- or binary-scan through that
12:12 timotimo consider how often that "annotate with line number if we have one" code gets called when compiling a file as big as the core setting
12:12 MasterDuke well, that's not happening at runtime, right? but yeah, when finding a line number for an annotation, i look backward from where we're figuring out the line number for that target string
12:13 MasterDuke it seemed to add a couple seconds to the core compile
12:14 timotimo oh, what you meant by "over night" was when you used to have the regex instead of that
12:14 MasterDuke sorry, yeah
12:16 MasterDuke hmm, but why didn't i try to do what you showed at the rakudo level?
12:18 MasterDuke i think i got distracted trying to figure out what was happening with lineno(), but i can see about doing it again at the nqp level
12:19 timotimo well, once you have the lineno, you can translate that
12:20 timotimo you'll end up needing a bit at the rakudo level and a bit at the MASTCompiler level, i think
12:20 timotimo and it'd probably be nice to give this feature to the JVM, too
12:23 MasterDuke what at the rakudo level? the impression i got from jnthn was that he wanted the annotations in rakudo to already have the correct info
12:24 jnthn Well, lineno is in HLL::Compiler iirc, which is shared between the backends
12:24 timotimo oh, i don't think annotations exist at the rakudo level
12:25 jnthn I suspect we can do the mapping in there also. May be we need to tweak its API (and thus the backend code) so it returns a filename also since that's no longer global to the compilation unit
12:26 jnthn But "the backends call something in HLL::Compiler that gives them a line/file to use in the backend-specific way" - much like we do with just line numbers today - would seem sensible.
12:28 MasterDuke jnthn: so move what i added to s/v/m/Q/QASTCompilerMAST.nqp to HLL::Compiler.lineno()?
12:29 MasterDuke and instead change s/v/m/Q/QASTCompilerMAST.nqp to get a filename+linenumber from lineno() (and same for JVM)?
12:30 dalek rakudo/nom: c541b3e | lizmat++ | src/core/List.pm:
12:30 dalek rakudo/nom: Simplify XX-Whatever role
12:30 dalek rakudo/nom: review: https://github.com/rakudo/rakudo/commit/c541b3ed38
12:32 jnthn MasterDuke: Sounds reasonabler :)
13:26 ggoebel joined #perl6-dev
14:00 pyrimidi_ joined #perl6-dev
14:14 lizmat afk&
15:24 raiph joined #perl6-dev
15:50 raiph joined #perl6-dev
15:54 raiph joined #perl6-dev
16:34 viki Do we mark JVM... um... "issues" that require NFC stuff in any special way? I've got the preprocessor #?if jvm marker with a comment that we need proper Str.codes on JVM; do I need anything else?
16:38 viki I'll just re-title the ticket I'm fixing and will leave it open as a JVM one
16:45 viki ZOFVM: Files=1202, Tests=130145, 147 wallclock secs (21.10 usr  3.54 sys + 2562.25 cusr 242.36 csys = 2829.25 CPU)
16:52 dalek rakudo/nom: d540fc8 | (Zoffix Znet)++ | src/core/Str.pm:
16:52 dalek rakudo/nom: Fail when Str.Int numerics with combining characters
16:52 dalek rakudo/nom:
16:52 dalek rakudo/nom: Fixes RT#128542: https://rt.perl.org/Public/Bug/Display.html?id=128542
16:52 dalek rakudo/nom: The proper-failing cases shown in the ticket fail() because in those conditions
16:52 synopsebot6 Link:  https://rt.perl.org/rt3//Public/Bug/Display.html?id=128542
16:52 dalek rakudo/nom: Str.Int passes the handling to Str.Numeric. In the case with the issue, Str.Int
16:52 dalek rakudo/nom: takes a shortcut by checking if all characters are of Numeric class and then
16:52 dalek rakudo/nom: parsing it with radix. The issue happens due to combining characters getting
16:52 dalek rakudo/nom: the properties of their base char, so they end up being considered Numeric, bu
16:52 dalek rakudo/nom: nqp::radix stopping its parse on them, so we end up with partial parse of the
16:52 dalek rakudo/nom: number instead of any fail()ures.
16:52 dalek rakudo/nom:
16:53 viki https://github.com/rakudo/rakudo/commit/d540fc85b7e94f9ed5aa3ab47d9d5488a26e6f77
16:54 dalek roast: 48d32a8 | (Zoffix Znet)++ | S32-str/numeric.t:
16:54 dalek roast: Test .Int on strings with numerics with combining characters fails()
16:54 dalek roast:
16:54 dalek roast: RT#128542: https://rt.perl.org/Public/Bug/Display.html?id=128542
16:54 dalek roast:
16:54 synopsebot6 Link:  https://rt.perl.org/rt3//Public/Bug/Display.html?id=128542
16:54 dalek roast: Fudged on JVM due to lack of proper Str.codes
16:54 dalek roast: review: https://github.com/perl6/roast/commit/48d32a83c2
16:58 FROGGS joined #perl6-dev
17:01 MasterDuke anyone know why (some?) actions in rakudo and nqp are called twice? when i added a token for the #line directives, the corresponding action method is called twice
17:06 perlpilot backtracking?
17:08 MasterDuke dunno. FWIW, this is the token: ^^ '#' \s* 'line' \s+ $<line>=(\d+) \s* $<filename>=(\S+) $$
17:17 viki tokens don't backtrack
17:28 arnsholt It'll still be called twice if there's something further up that backtracks
17:28 arnsholt And possibly if there's lookahead
17:33 FROGGS no
17:34 FROGGS actions are run after the rules/tokens have matched the entire text
17:34 FROGGS there is no action involved for lookaheads, and there also not for backtracking
17:36 [TuxCM] joined #perl6-dev
17:36 FROGGS m: grammar G { token TOP { <?foo> <foo> }; token foo { abc } }; class A { method TOP ($/) { say 'TOP' }; method foo ($/) { say 'foo' } }; say G.parse('abc', :actions(A))
17:36 camelia rakudo-moar d540fc: OUTPUT«foo␤foo␤TOP␤「abc」␤ foo => 「abc」␤»
17:36 FROGGS weird
17:37 FROGGS why the heck do we do that?
17:37 viki What's <?foo> ?
17:37 FROGGS a lookahead
17:38 FROGGS m: grammar G { token TOP { <?foo> .+ }; token foo { abc } }; class A { method foo ($/) { say 'damn' } }; say G.parse('abc', :actions(A))
17:38 camelia rakudo-moar d540fc: OUTPUT«damn␤「abc」␤»
17:38 FROGGS jnthn: is it correct that it prints 'damn' here? I was thinking that lookaheads are not supposed to result in action methods calls
17:39 viki FROGGS: and the actions are called as soon as the token is parsed, not when entire text gets parsed.
17:40 viki m: grammar { token TOP { <foo> \d+ }; token foo { a+ } }.parse("aaaa", :actions(class { method foo ($/) { say "foo" }})).say
17:40 camelia rakudo-moar d540fc: OUTPUT«foo␤Nil␤»
17:41 FROGGS but why?
17:41 viki Well, I guess for one, you don't have to keep all of that stuff around before you run it.
17:42 viki ... just to see whether you managed to parse the entire text
17:42 FROGGS on the other hand... we dont need to run the actions at all when the match failed
17:43 viki How would you figure out which action method to call when, when you're done parsing?
17:44 FROGGS well, you run the action methods of the parsed tokens in reverse order
17:44 viki What about all the dynamic variablesa?
17:44 * viki shrugs
17:44 FROGGS hmmmm
17:44 FROGGS point
17:45 arnsholt For one thing, later regexes can use information from previous AST objects to control what's matched
17:45 FROGGS though, maybe we can at least do not call actions for lookaheads... maybe that's a sane request?
17:45 FROGGS would like to have jnthn's or TimToady's opinion on that now
17:45 arnsholt Not if you lookahead over something that introspects previous AST objects =)
17:46 viki m: grammar G { token TOP { <.?foo> <foo> }; token foo { abc } }; class A { method TOP ($/) { say 'TOP' }; method foo ($/) { say 'foo' } }; say G.parse('abc', :actions(A))
17:46 arnsholt Initially I thought that would be a reasonable optimization, but on further reflection I'm pretty sure it isn't
17:46 camelia rakudo-moar d540fc: OUTPUT«foo␤Nil␤»
17:46 FROGGS you cannot access stuff from lookaheads anyway
17:47 arnsholt Sure, but *inside* the lookahead
17:47 FROGGS yes, and then?
17:47 viki What's <.?foo> ?
17:47 FROGGS same as <?foo>
17:47 viki Fpm
17:47 FROGGS the dot just means "do not capture"
17:47 viki *Don't seem to be
17:47 arnsholt Consider "token foo" that does shenanigans involving the AST of rules called from it. Then <?foo> needs to build the AST, in order for foo to work
17:47 viki The parse fails.
17:48 viki And if I tell it to parse "abcabc" succeeds
17:48 FROGGS m: grammar G { token TOP { <.?foo> <foo> }; token foo { abc } }; class A { method TOP ($/) { say 'TOP' }; method foo ($/) { say 'foo' } }; say G.parse('abcabc', :actions(A))
17:48 camelia rakudo-moar d540fc: OUTPUT«foo␤foo␤TOP␤「abcabc」␤ foo => 「abc」␤»
17:48 FROGGS m: grammar G { token TOP { <.)foo> <foo> }; token foo { abc } }; class A { method TOP ($/) { say 'TOP' }; method foo ($/) { say 'foo' } }; say G.parse('abcabc', :actions(A))
17:48 camelia rakudo-moar d540fc: OUTPUT«===SORRY!===␤Unrecognized regex metacharacter < (must be quoted to match literally)␤at <tmp>:1␤------> grammar G { token TOP { <.⏏)foo> <foo> }; token foo { abc } }; clas␤Unrecognized regex metacharacter . (must be quoted to match li…»
17:48 FROGGS m: grammar G { token TOP { <.^foo> <foo> }; token foo { abc } }; class A { method TOP ($/) { say 'TOP' }; method foo ($/) { say 'foo' } }; say G.parse('abcabc', :actions(A))
17:48 camelia rakudo-moar d540fc: OUTPUT«===SORRY!===␤Unrecognized regex metacharacter < (must be quoted to match literally)␤at <tmp>:1␤------> grammar G { token TOP { <.⏏^foo> <foo> }; token foo { abc } }; clas␤Unrecognized regex metacharacter . (must be quoted to match li…»
17:49 FROGGS I dunno
17:49 FROGGS arnsholt: that sounds horrible :P
17:50 arnsholt FROGGS: Clearly, it's *perverse*!
17:50 FROGGS *g*
17:50 arnsholt But it's possible, so we can't optimise out actions =)
17:51 dalek rakudo/nom: 6057295 | lizmat++ | src/core/List.pm:
17:51 dalek rakudo/nom: Streamline xx * a bit further
17:51 dalek rakudo/nom: review: https://github.com/rakudo/rakudo/commit/6057295ab7
18:06 jnthn FROGGS: Yes, it's correct that it calls action methods on things that are later "unused"
18:06 jnthn They're called bottom-up
18:07 pyrimidine joined #perl6-dev
18:18 masak I guess such things could be optimized away only to the extent the AST result could be shown never to be used.
18:19 masak which is quite hard, at a guess.
18:20 dalek rakudo/nom: dcfd4ed | lizmat++ | src/core/Shaped (3 files):
18:20 dalek rakudo/nom: Streamline 123dimmed AT-POS
18:20 dalek rakudo/nom:
18:20 dalek rakudo/nom: Also get back the performance loss of 839c7620a63970480 on 1dimmed
18:20 dalek rakudo/nom: iterator
18:20 dalek rakudo/nom: review: https://github.com/rakudo/rakudo/commit/dcfd4ed01c
18:31 raiph joined #perl6-dev
18:37 raiph joined #perl6-dev
18:46 pyrimidine joined #perl6-dev
18:46 cognominal joined #perl6-dev
18:51 FROGGS jnthn: and that's also true for things like lookaheads?
18:51 FROGGS jnthn: I mean, you cannot access what it has made anyway
18:53 FROGGS what if we alter the world in a lookahead?
18:53 FROGGS the stuff we make there wont make it into the ast
18:55 * FROGGS .oO( maybe this saves us an entire microsecond in stage parse! )
18:59 pyrimidine joined #perl6-dev
19:03 raiph joined #perl6-dev
19:06 raiph joined #perl6-dev
19:09 pyrimidine joined #perl6-dev
19:13 raiph joined #perl6-dev
19:15 raiph joined #perl6-dev
19:17 raiph joined #perl6-dev
19:18 TimToady one could conceivably have a lazy make that only triggers when forced to
19:27 timotimo did i actually end up pushing the ords fix ...
19:28 pyrimidine joined #perl6-dev
19:29 dalek rakudo/nom: 4ae3f23 | timotimo++ | src/core/Str.pm:
19:29 dalek rakudo/nom: let chrs also work with numbers that are in Str form
19:29 dalek rakudo/nom: review: https://github.com/rakudo/rakudo/commit/4ae3f238c5
19:29 timotimo woop, there it is.
19:29 timotimo seems like i wanted to add tests, but didn't, so i also didn't push the fix itself
19:32 dalek roast: aff9733 | timotimo++ | S29-conversions/ord_and_chr.t:
19:32 dalek roast: test chrs on list of numifiable strings
19:32 dalek roast: review: https://github.com/perl6/roast/commit/aff9733ba2
19:35 MasterDuke so it's expected that tokens with lookaheads will call their action twice, but why does mine even though there are no lookaheads?
19:38 pyrimidine joined #perl6-dev
19:39 FROGGS MasterDuke: is there a lookahead around that somewhere?
19:40 MasterDuke it's in the top level of HLL::Grammar
19:52 FROGGS MasterDuke: is it in branch or fork?
19:52 FROGGS I dont spot it in my nqp
19:54 seatek joined #perl6-dev
19:55 MasterDuke FROGGS: https://gist.github.com/MasterDuke17/c1d5414410f070cd04a4d78700dde223
19:55 lizmat m: say Hash ~~ Iterable; say QuantHash ~~ Iterable   # shouldn't these be both True ?
19:55 camelia rakudo-moar 4ae3f2: OUTPUT«True␤False␤»
19:56 MasterDuke all local work so far, haven't pushed anything anywhere yet
19:57 pyrimidine joined #perl6-dev
20:00 masak lizmat: Hash is Map, which does both Iterable and Associative. QuantHash on the other hand does Associative directly.
20:00 FROGGS MasterDuke: there is nothing in your gist that refers to the line_directive token in a grammar
20:00 FROGGS MasterDuke: how is it called at all?
20:00 masak lizmat: without looking deeply into it, my guess is that QuantHash ought to is Map, just like Hash.
20:01 masak ("ought to is" -- Perl 6 makes me grammar badly)
20:01 lizmat well, that's the thing: QuantHash is a role, just like Associative
20:01 masak just realized
20:01 lizmat at least in practice now, and in specs also
20:02 viki m: my @h = bag 1, 2, 3; dd @h
20:02 camelia rakudo-moar 4ae3f2: OUTPUT«Array @h = [(3=>1,1=>1,2=>1).Bag]␤»
20:02 MasterDuke FROGGS: dunno, how are any of the tokens in HLL::Grammar called?
20:02 viki use MONKEY; augment class Bag does Iterable {}; my @h = bag 1, 2, 3; dd @h
20:02 viki m: use MONKEY; augment class Bag does Iterable {}; my @h = bag 1, 2, 3; dd @h
20:02 camelia rakudo-moar 4ae3f2: OUTPUT«Array @h = [3 => 1, 1 => 1, 2 => 1]␤»
20:02 viki Hm, seems like the change would be quite big if we add it?
20:02 masak lizmat: I see Setty does QuantHash
20:02 masak Setty is also a role
20:02 masak are there arguments for or against Setty doing Iterative?
20:03 masak er, Iterable
20:03 masak m: say Set ~~ Iterable
20:03 camelia rakudo-moar 4ae3f2: OUTPUT«False␤»
20:03 lizmat the reason I ran into this, is that I wanted to make a fast ItemIterator
20:03 lizmat one that only ever produces 1 value, etc
20:03 lizmat and have Any.iterator refer to that
20:03 FROGGS MasterDuke: like this:
20:03 FROGGS nqp/src/HLL/Grammar.nqp:76:    token dec_number {
20:03 FROGGS nqp/src/NQP/Grammar.nqp:667:        [ <dec_number> | <integer> ]
20:04 FROGGS NQP::Grammar makes use of the stuff in HLL::Grammar
20:04 FROGGS MasterDuke: do you have a modified rakudo too by any chance?
20:05 lizmat masak: never mind, I think I got a way around it
20:05 MasterDuke nope, not (yet) for this
20:07 pyrimidine joined #perl6-dev
20:07 masak lizmat: it is an interesting question though. are Sets (supposed to be) Iterable?
20:08 lizmat fwiw, I thought they always were
20:08 lizmat now I realize that Set.values is actually implemented without an iterator method
20:09 lizmat actually, whatever Set.list does
20:10 lizmat which is .pairs.cache for some reason
20:11 lizmat m: for <a b c>.Bag { dd $_ }   # hmmmm
20:11 camelia rakudo-moar 4ae3f2: OUTPUT«:a(1)␤:c(1)␤:b(1)␤»
20:12 lizmat m: for <a b c>.Set { dd $_ }   # hmmmm
20:12 camelia rakudo-moar 4ae3f2: OUTPUT«:a␤:c␤:b␤»
20:13 viki m: for (:a, :b:, :c).Hash { dd $_ }
20:13 camelia rakudo-moar 4ae3f2: OUTPUT«===SORRY!=== Error while compiling <tmp>␤Confused␤at <tmp>:1␤------> for (:a, :b:⏏, :c).Hash { dd $_ }␤    expecting any of:␤        colon pair␤»
20:13 viki m: for (:a, :b, :c).Hash { dd $_ }
20:13 camelia rakudo-moar 4ae3f2: OUTPUT«:a␤:c␤:b␤»
20:14 FROGGS MasterDuke: I've applied your patch, added a nqp::say statement to the line_directive action method and run this example:
20:14 FROGGS $ perl6 -e '# line 45 foo.txt'
20:14 FROGGS I dont see anything printed...
20:15 lizmat FROGGS: shouldn't that be #line without space ?
20:15 pyrimidine joined #perl6-dev
20:15 FROGGS to me it looks like the line_directive token is not used
20:15 FROGGS lizmat: space is allowed
20:15 FROGGS same without whitespace fwiw
20:15 MasterDuke FROGGS: i saw a say in the action get printed twice when compiling rakudo
20:16 FROGGS I didnt
20:16 FROGGS MasterDuke: where is your say statement?
20:20 MasterDuke hmm, something is odd. now a say (printfh really) in the action doesn't print. i may actually have been on a modified rakudo (where i added a token/action with the same name)
20:21 MasterDuke but, it was definitly using the printfh in the nqp action method
20:23 viki So, we're cool with "FF".format-base(16) -> 255 ?
20:23 viki Oh waity
20:23 viki So, we're cool with "FF".parse-base(16) -> 255 ?
20:23 viki https://irclog.perlgeek.de/perl6/2016-11-11#i_13550787
20:23 viki That's not a good start when I confuse them already :P
20:24 lizmat yeah, that's really the issue with all of these :-(
20:27 pyrimidine joined #perl6-dev
20:28 lizmat m: role A { has $.a }; my $a = 42 but A(666); say $a.a   # huh?  How does 666 wind up in there ?
20:28 camelia rakudo-moar 4ae3f2: OUTPUT«666␤»
20:29 lizmat is this some DWIMmery?
20:29 viki m: role A { has $.a }; my $a = "x" but A(666); say $a.a
20:29 camelia rakudo-moar 4ae3f2: OUTPUT«666␤»
20:29 viki 0.o
20:30 geekosaur m: role A { has $.b; }; my $a = "x" but A(666); say $a.a
20:30 camelia rakudo-moar 4ae3f2: OUTPUT«No such method 'a' for invocant of type 'Str+{A}'␤  in block <unit> at <tmp> line 1␤␤»
20:30 geekosaur whoops
20:31 geekosaur anyway it;s conflating them
20:31 geekosaur m: role A { has $.b; }; my $a = "x" but A(666); say $a
20:31 camelia rakudo-moar 4ae3f2: OUTPUT«x␤»
20:31 lizmat https://github.com/rakudo/rakudo/blob/nom/src/core/Cursor.pm#L467   # is what me set on this
20:31 moritz yes, there's extra magic for initalizing roles with a single attribute
20:32 lizmat TIL  :-)
20:32 geekosaur but mine had a single attribute too
20:32 moritz but you did't access it
20:32 lizmat geekosaur: but you used the wrong accessor
20:32 FROGGS m: role A { has $.b; }; my $a = "x" but A(666); say $a.b
20:32 camelia rakudo-moar 4ae3f2: OUTPUT«666␤»
20:32 geekosaur the first one didn't have an accessor
20:33 geekosaur my corrected one also didn't have an accessor (I grabbed the wrong one from where viki was trying to figure out what happened the first time)
20:33 geekosaur oh, gm, sorry, guess it did
20:33 geekosaur misread it the first time :/
20:35 pyrimidine joined #perl6-dev
20:36 MasterDuke FROGGS: figured it out, changing the token and action name to comment:sym<line_directive> makes it work
20:37 MasterDuke you caught me in the middle of some renaming when i made the gist
20:38 MasterDuke makes it work = the printfh() in the action happens twice when compiling rakudo
20:39 viki m: say :16("0.FF")
20:39 camelia rakudo-moar 4ae3f2: OUTPUT«0.996094␤»
20:40 viki m: say :16(".FF")
20:40 camelia rakudo-moar 4ae3f2: OUTPUT«Cannot convert string to number: base-16 number must begin with valid digits or '.' in ':16<⏏.FF>' (indicated by ⏏)␤  in block <unit> at <tmp> line 1␤␤Actually thrown at:␤  in block <unit> at <tmp> line 1␤␤»
20:42 viki I'm failing to think of a clean way of doing .parse-base
20:42 viki Considering stuff like this works: :16("F.Fe10")
20:42 viki So the shortest thing is to use ":$radix\<$num>" under the hood and to somehow relay errors, which is gross :)
20:44 masak viki: well, what does ":$radix\<$num>" use?
20:45 FROGGS MasterDuke: I get this:
20:45 FROGGS Stage parse      : #line 1 src/core/core_prologue.pm
20:45 FROGGS Cannot find method 'add_comp_files_to_directives' on object of type Perl6::World
20:45 FROGGS at gen/moar/stage2/NQPHLL.nqp:1250  (/home/froggs/dev/nqp/install/share/nqp/lib/NQPHLL.moarvm:comment:sym<line_directive>)
20:45 FROGGS but, I need some sleep...
20:45 FROGGS gnight #perl6*
20:45 lizmat FROGGS: good night!
20:46 viki masak: grammar
20:46 MasterDuke .tell FROGGS sorry, another renaming thing, 'add_comp_files_to_directives' should be 'add_comp_lines_to_directives'
20:46 yoleaux2 MasterDuke: I'll pass your message to FROGGS.
20:47 pyrimidine joined #perl6-dev
20:47 viki Well, I see it dump "radix" when I target==parse it, but I don't see that token in grammr
20:47 MasterDuke ugh, no list/array sort in nqp?
20:48 MasterDuke viki: i think it's rad_num
20:48 viki Will take a look on Monday. Gotta finish work stuff and then it's a Warframe Weekend Marathon for me
20:48 viki \o
21:37 AlexDaniel joined #perl6-dev
21:52 dalek rakudo/nom: a43b0c1 | (Vladimir Marek)++ | Configure.pl:
21:52 dalek rakudo/nom: Solaris needs to use gnu make instead of /usr/bin/make
21:52 dalek rakudo/nom: review: https://github.com/rakudo/rakudo/commit/a43b0c1d65
21:52 dalek rakudo/nom: fc6d4f3 | lizmat++ | Configure.pl:
21:52 dalek rakudo/nom: Merge pull request #917 from vlmarek/nom
21:52 dalek rakudo/nom:
21:52 dalek rakudo/nom: Solaris needs to use gnu make instead of /usr/bin/make
21:52 dalek rakudo/nom: review: https://github.com/rakudo/rakudo/commit/fc6d4f37b5
21:55 pyrimidine joined #perl6-dev
22:05 pyrimidine joined #perl6-dev
22:15 pyrimidine joined #perl6-dev
22:29 pyrimidine joined #perl6-dev
22:35 pyrimidine joined #perl6-dev
22:44 pyrimidine joined #perl6-dev
22:45 perlpilot joined #perl6-dev
22:54 pyrimidine joined #perl6-dev
23:04 pyrimidine joined #perl6-dev
23:15 perlpilot joined #perl6-dev
23:17 perlpilot joined #perl6-dev
23:23 pyrimidine joined #perl6-dev
23:33 pyrimidine joined #perl6-dev
23:34 perlpilot joined #perl6-dev
23:43 pyrimidine joined #perl6-dev
23:52 pyrimidine joined #perl6-dev
23:59 pyrimidine joined #perl6-dev

| Channels | #perl6-dev index | Today | | Search | Google Search | Plain-Text | summary