»ö« 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.
sjohnson o.O 00:08
sorear hello adriano86 00:18
00:21 awoodland left, stkowski left
sorear moritz_: __sri: TimToady: one very important thing to consider is that Perl 6 is a _programming language_ 00:33
by design, our only users are other programmers
which makes a lot of the normal friction points disappear
__sri sorear: that's very very wrong
programming languages need to be sold to decision makers 00:34
which are sadly not programmers most of the time
sorear when your implementations suck as badly as ours do, decision makers can be counted out. 00:37
00:47 ponbiki left 00:51 adriano86 left 00:59 kfo joined 01:01 icwiener left 01:04 Rotwang left 01:07 rdesfo joined 01:08 ymasory left, woosley joined 01:09 ymasory joined, edenc joined 01:10 ymasory left, ymasory joined 01:11 envi joined 01:28 HarryS left 01:33 am0c joined, jaldhar joined 01:40 impious left 01:45 HarryS joined 01:47 whiteknight left 02:00 tadzik left
rdesfo goodnight 02:02
:o wrong window
02:11 Juerd joined 02:13 de joined
de Hop 02:13
02:15 hugme joined, ChanServ sets mode: +v hugme
Juerd FYI: really weird Xen troubles 02:15
Just did an emergency migration to KVM... 02:16
02:16 de left, de joined 02:19 s1n left 02:20 s1n joined 02:27 de left 02:29 pnu joined 02:38 ymasory_ joined 02:44 am0c left 02:46 donri joined 02:49 Util joined 02:54 donri left, hugme left, rdesfo left, cosimo left, dju_ left, barika left, HarryS left, plobsing left, dsp_ left, PacoLinux left, amkrankruleuen left, noganex left, starcoder2 left, PZt left, ggoebel left, DarthGandalf left 02:57 orafu left, orafu joined, donri joined, hugme joined, rdesfo joined, cosimo joined, dju_ joined, wooden joined, aloha joined, barika joined, mathw joined, rokoteko joined, asimov.freenode.net sets mode: +v hugme 02:58 donri left, donri joined 02:59 ymasory left 03:00 HarryS joined, plobsing joined, dsp_ joined, PacoLinux joined, amkrankruleuen joined, noganex joined, starcoder2 joined, PZt joined, ggoebel joined, hatseflats joined, Bucciarati joined, renormalist joined, TiMBuS joined, drbean joined, _dev0_ joined, knewt2 joined, awwaiid joined, baest joined, Brandon_W_ATS joined, mdxi_ joined, apejens joined, DarthGandalf joined, ribasushi joined, IRSeekBot joined, kolibrie joined, charsbar_ joined, kcwu joined, robinsmidsrod joined 03:01 HarryS left, HarryS joined
sorear Juerd: "emergency migration"? 03:20
03:21 nymacro joined
Juerd Yes. 03:21
There is no working combination of the spare hardware at hand, a linux kernel and a Xen hypervisor 03:22
I've tried just about every permutation I could find.
03:22 pnu left
Juerd I couln't really get rid of Linux or the hardware 03:23
So Xen had to go
It all started with broken hardware :(
03:27 pnu joined 03:34 agentzh joined 04:31 mtk left 04:33 ymasory_ is now known as ymasory 04:39 mtk joined 04:40 envi left, envi joined
sorear The current realpath/modtime approach to niecza's module path is starting to bug me 05:01
*cache
Any good reason not to bundle a SHA implementation and use that instead?
05:05 rdesfo left 05:14 mberends joined
mberends hi sorear 05:16
sorear hello mberends 05:19
mberends SHA1 for module tracking is fine, although I think the algorithm and the digest size may be overkill for what is needed. There are faster algorithms such as CRC, Fletcher etc.
sorear niecza won't bootstrap today ... I wonder what broke
mberends also, although only tangentially related, I suggest following the general approach that Rakudo is also doing initially: github.com/rakudo/rakudo/blob/mast...oposal.pod 05:20
sorear I don't beleive that document has been updated since (before I heard of Perl6) 05:21
mberends yes, but I co-wrote it ;)
the intent has not changed. 05:22
it was just a path through the minefield of ambitious expectations 05:23
05:25 tadzik joined
mberends oh hai tadzik 05:25
tadzik oh hai 05:26
what happened to feather?
mberends tadzik: Juerd++ reported a hardware problem that affected the virtual machine hosting
tadzik yeah, just read the log 05:27
05:36 benabik left 05:41 dzg joined 05:45 nick_ joined 05:46 nick_ is now known as Guest16281 05:49 mberends left 05:57 Guest16281 left, dzg left 06:11 sftp left
sorear out. 06:29
06:33 pnu left 06:35 mberends joined, pnu joined 06:37 kaare_ joined 06:51 mberends left 07:07 cosimo left 07:21 mberends joined 07:25 noganex_ joined 07:28 dual left 07:29 noganex left, kjeldahlw joined 07:36 dual joined
jnthn Good afternoon :) 07:38
mberends good *, jnthn :) 07:50
jnthn o/ mberends 07:52
07:55 shi joined 08:07 jaldhar left, jaldhar joined 08:19 mj41 joined 08:20 tadzik left 08:29 nymacro left 08:31 fhelmberger joined 08:51 Mowah joined 08:52 ggoebel left 08:53 ggoebel joined, jaldhar left, jaldhar joined
moritz_ \o 09:06
hugme is still alive, that's a good sign :-)
hugme: hug everybody
hugme hugs everybody
09:07 jql left 09:13 am0c joined 09:19 woosley left 09:21 dakkar joined
woldrich hugme, 09:32
hugme, hugme
hugme woldrich:
moritz_ woldrich: it understands 'hug me'
woldrich hugme, hug me
hugme hugs woldrich
woldrich but, but, but 09:33
I wanted hugme to hug hugme!
moritz_ then say it
hugme: hug hugme
hugme hugs hugme
09:33 shi left
woldrich oh, I suck :) 09:33
hugme, source 09:34
moritz_ hugme: show hugme
hugme moritz_: the following people have power over 'hugme': P⁣erlJam, T⁣imToady, [⁣particle], c⁣olomon, j⁣nthn, m⁣asak, m⁣berends, m⁣oritz_, p⁣michaud. URL: github.com/moritz/hugme/
woldrich Heh. I thought she'd be written in perl6 :) 09:35
moritz_ woldrich: I would have written it in Perl 6 if its only feature were hugging 09:36
woldrich heh
moritz_ but the main feature is adding committers to various repositories
woldrich yeah, I see that
moritz_ and for that you need good library support
woldrich Is there some not-so-sucky bot written in actual perl6 that you know of? 09:37
moritz_ woldrich: TiMBuS has been working on an IRC bot, but I don't know what it does, and how good the code quality is (never really looked at it)
woldrich oh, Net::IRC for perl6 09:38
09:39 tzhs joined
TiMBuS oh 09:39
hello
Net::IRC works except with no threads you cant do much
async IO might help 09:42
for web requests, like a twitter bot or something. i could tie IO requests into the bots IO loop somehow
09:47 shi joined 09:58 timbunce joined 09:59 timbunce left 10:03 fhelmberger_ joined 10:04 fhelmberger left 10:17 fhelmberger_ left 10:19 fhelmberger joined 10:21 tadzik joined 10:22 dolmen joined 10:39 tzhs left, tzhs joined 11:00 birdwindupbird joined 11:09 woosley joined
tadzik o/ 11:14
11:17 bacek left 11:29 agentzh left 11:38 leprevost joined
tadzik mberends: why is there a Configure and Makefile.in in Web.pm? 11:44
11:45 jevin joined
mberends tadzik: the answer is in Web.pm/lib/Configure.pm: customize the PERL6LIB, PERL6BIN and RAKUDO_DIR variables in the Makefile. This pre-dates the creation on ufo. 11:57
s/on/of/
takadonet morning all 12:00
tadzik mberends: so it it obsolete now?
mberends tadzik: I think so, but test the change 12:05
tadzik mberends: difficult to test, for there is almost nothing that works anyway :) But I was using ufo for my development 12:06
12:16 fhelmberger left 12:17 mtk left 12:18 rdesfo1 joined 12:26 mtk joined 12:31 fhelmberger joined 12:40 birdwindupbird left 12:58 pmurias joined 13:00 mj41 left 13:03 mj41 joined 13:11 plobsing left 13:13 birdwindupbird joined 13:16 MayDaniel joined 13:30 MayDaniel left 13:33 birdwindupbird left 13:38 plainhao joined 13:46 quotemstr joined
quotemstr Perl 6 rules look awesome. 13:46
Is there anything that would have been changed in hindsight?
13:47 arlinius joined
moritz_ if we find something that should have been changed in hindsight, we still change it 13:47
so I guess the answer is "no" 13:48
quotemstr Heh, good point.
moritz_ though I do have a concern, but no good solution for it
for regexes, the current syntax is just fine
but for grammars it would be beneficial if one could omit the < > around rule calls, and be forced to quote literals at the same time 13:49
quotemstr I'm implementing a PEG-ish composable grammar system for Emacs, and it turns out my thinking went along the same lines as the design behind Perl 6 rules. I figured I might as well learn from experience.
moritz_ but we don't want to force people to use two regex syntaxes
quotemstr You already have a different syntax for tokens and other rules.
(The default backtracking is different.) 13:50
13:50 ymasory left
moritz_ well, I wouldn't go so far as to call it a different syntax 13:50
in fact it *looks* the same, which is what syntax is about :-) 13:51
and I think it's a good thing; it makes it very easy to test if backtracking is a problem in a certain rule 13:52
quotemstr When two things look the same and mean something different, we call that a "lie". :-)
moritz_ quotemstr: we call it "distinguished by context"
does javascript lie when it uses + both for addition and concatenation? 13:53
quotemstr Why don't tokens and rules backtrack by default though?
13:53 PerlJam joined
moritz_ because they are usually used in bigger parsers, where backtracking is nearly never needed 13:54
it just slows things down, and causes confusion
quotemstr: the standard grammar for Perl 6 has 807 tokens and rules, and only 27 regexes 13:55
quotemstr Oh, I'm not objecting. 13:56
jnthn didn't realize we had as many as 27...
moritz_ nor did I think you did
wait, my numbers are bogus
I did an ack -w regex|wc -l 13:57
and didn't realize that most regex parsing error messages matched that
jnthn ah :)
moritz_ $ ack '^\s*regex\b' STD.pm6|wc -l
6
quotemstr Also, do ::, ::>, and friends only work in the *lexical* scope of an alternation?
moritz_ that number sounds much more reasonable 13:58
quotemstr: I think it depends on the "friends"
jnthn moritz_: Yes, I much prefer that number :)
13:58 icwiener joined
quotemstr Well, let's just talk about ::. If we have ms/ something :: <blah> /, :: commits after matching something 13:58
moritz_ quotemstr: I only have an old definition of the regex control sequences in my head. In those, ::: definitively acted on the surroundings too
13:59 PerlJam left
quotemstr What about blah = a :: b, ms / < blah>, <blah2> / ... 13:59
13:59 PerlJam joined
moritz_ :: works in the current LTM construct 14:00
quotemstr Right. But is "current" bound lexically or dynamically?
moritz_ if you add foo:sym<bla> rules to it, the current LTM construct is larger than the lexical scope
so, not lexical
quotemstr Ah, okay. 14:01
moritz_ though LTM basically "inlines" until it finds things a DFA can't match 14:03
quotemstr Ah, so you do construct a DFA instead of just running an NFA directly.
moritz_ but as far as I understand, :: only works on the current alternative, not on the full DFA
quotemstr: that's the idea behind it, but some implementations still cheat 14:04
14:04 rdesfo1 left
quotemstr Right. So :: does nothing if we're not inside a LTM alternation (|), and ::> does nothing if we're not inside a prioritized choice (||) ? 14:04
It's be nice if Synopsis 5 called that out. 14:05
PerlJam "does nothing"?
moritz_ quotemstr: you can add that. Tell me your github account, and I'll give you a commit bit
14:06 jaldhar left
moritz_ quotemstr: and the good thing is that if we both understood that wrongly, somebody will revert your commit, and we know we were wrong :-) 14:06
quotemstr moritz_: dcolascione :-)
Good point.
moritz_ hugme: add dcolascione to perl6
hugme hugs dcolascione. Welcome to the perl6 github organization
TimToady it sounds about right to precaffienated /me
niecza does DFA, rakudo doesn't yet
moritz_ rakudo doesn't do real LTM yet either 14:07
it just does it for constant prefixes
TimToady and ::> is mostly a placeholder; I don't know if anyone implements it yet
quotemstr Now I just need to find that piece.
moritz_ repo is perl6/specs/
quotemstr moritz_: Honestly, I very seldom myself wanting longest-match behavior.
quotemstr edits.
moritz_ quotemstr: it's *very* handy when you want to write extensible grammars 14:08
quotemstr: without LTM, you have to find some rules about the order of parsing when adding new alternatives. Which gets ugly when you have two or more independent augmentions of the same grammar
quotemstr moritz_: Why's that? Wouldn't the other kind of alternation be more predictable? 14:09
14:09 jimmy1980 joined
TimToady a longest match anchored at the current position is very much more useful than a longest match out in the middle somewhere 14:09
quotemstr moritz_: If I'm extending a grammar, I can prefix one of its alternations with my own and be confident that it'll be tried first regardless of whatever else is in that alternation.
Likewise, if I add an entry to the end of the alternation list, I know that I won't preempt any valid syntax. 14:10
moritz_ quotemstr: unless a second grammar modification is applied, which does the same thing
TimToady the LTM rule scales better
moritz_ and those two modifications know nothing of each other
quotemstr moritz_: But in the presence of two grammar modifications, you don't know which modification adds the longer match and the result is still unpredictable, yes?
TimToady: Performance-wise? Temporal should be faster, yes?
TimToady dfa can be fast 14:11
quotemstr TimToady: You can only create a DFA when the LTM prefixes match regular languages.
moritz_ quotemstr: I don't find LTM to be unpredictable at all. The rules are pretty intuitive, and well defined
quotemstr In the general case, you just have to try all cases and pick the longest. 14:12
moritz_ well, LTM prefixes are defined in a way to allow DFA construction
quotemstr moritz_: What do you mean? I thought they could be general.
moritz_ quotemstr: perlcabal.org/syn/S05.html#Longest-...n_matching has a list of what terminates LTM prefixes 14:13
14:13 jonalv joined, jonalv left
moritz_ it's quite intuitive that a ++ is parsed as prefix:<++>, and not two chained prefix:<+>. That's what LTM gives you for free. 14:14
quotemstr Ahh.
moritz_ mind you, I haven't written a grammar engine, and only a small number of grammars, but the concept of LTM makes sense to me 14:15
TimToady a P6 grammar gives you the best of both DFA and NFA matching, and generally manages the transition from one to the other without the user having to worry much
moritz_ quotemstr: if you want some more reading, I've written two articles on perlgeek.de/en/article/ ("A Mutable Grammar for Perl 6" and "Longest-Token Matching"), mostly in an attempt to actually understand it myself 14:16
TimToady or looking at it another way, a P6 grammar will write JIT lexers for you as needed
quotemstr moritz_: I'll take a look --- thanks.
So let me get this straight --- a LTM is only longest-match with respect to (essentially) the regular prefixes of all the alternatives? 14:17
moritz_ quotemstr: feel free to ask if anything in these articles is unclear to you
quotemstr: yes
(and regular prefixes can be artifically excluded from the prefix with things like :: and {} ) 14:18
quotemstr reads.
PerlJam moritz_: you need to change your favicon to a zebra :)
moritz_ s:2nd/prefix/LTM/
TimToady the "token" part of it implies that each token is anchored to the end of the previous token/whitespace
14:18 arlinius left
moritz_ PerlJam: make me a zebra favicon, and I'll do it :-) 14:18
quotemstr TimToady: It seems obvious that longest-match is longest-match at that point, not globally.
quotemstr looks up how to create a link in POD. 14:19
moritz_ L<...>
quotemstr Right, but that's absolute according to man perlpod. What's the equivalent to <a href="#foo">bar</a>? 14:20
Ahh.
L<foo|"bar">
moritz_ or just L<#Section Name> 14:21
o wait, that might P6 Pod only
(and the specs are in p5 POD)
sorear niecza: say "foom" ~~ / [ .* ::> o ] / 14:23
p6eval niecza v3-80-g3cc93a7: OUTPUT«Unhandled exception: Unable to resolve method oplift in class Any␤ at /home/p6eval/niecza/src/RxOp.pm6 line 9 (RxOp C8_ANON @ 1)␤ at line 0 (KERNEL map @ 2)␤ at /home/p6eval/niecza/src/RxOp.pm6 line 9 (RxOp RxOp.oplift @ 3)␤ at /home/p6eval/niecza/src/RxOp.pm6
..line 9 (RxOp C8_…
sorear "looks like no"
the support code is there, though; getting that to work is probably LHF 14:24
quotemstr Changes made. 14:28
dalek ecs: 9c90489 | (Daniel Colascione)++ | S05-regex.pod:
add links to LTM acronym expansion
ecs: b6ea876 | (Daniel Colascione)++ | S05-regex.pod:
Explain effects of :: and ::> wrt dynamic/lexical scope and lack of enclosing alternations
quotemstr pushes.
moritz_ quotemstr++
14:29 benabik joined
PerlJam quotemstr++ indeed. I was slightly worried about the "does nothing" wording, but you've made sense of it perfectly :) 14:30
moritz_ I think that was the fastest spec patch ever, measured from first speaking up here in the channel (or in the mailing list)
people initially have the fear that when they touch the spec, TimToady++ will hit them with a hammer or something :-) 14:31
quotemstr That's what the VCS is for. It's not as if I chiseled it into stone. :-)
14:31 TiMBuS left
moritz_ aye. Still people are afraid. 14:32
PerlJam moritz_: or maybe they are just mostly unsure of themselves.
moritz_ well, it is now chiseled into the stone of the gith history
quotemstr "However, sometimes you would like an alternate scalar value to ride along with the match. The Match object itself describes a concrete parse tree, so this extra value is called an abstract object; it rides along as an attribute of the Match object."
Dammit, that was exactly the design I came up with for my own parser. 14:33
moritz_: Unless it's rebased.
moritz_ s/Dammit/Yay/
quotemstr moritz_: True.
moritz_ quotemstr: but that requires a push --force, which is frowned upon
14:33 kjeldahlw left
quotemstr Except I imagined having multiple abstract values, each identified by a tag. 14:33
moritz_: So it's chiseled into stone so long as nobody minds too much. :-) 14:34
moritz_ just like you *can* erase text chiseled into stone, by removing the whole layer :-)
quotemstr: having multiple abstract objects by tag is really isomorphic to having a hash of abstract objects 14:35
14:35 jimmy1980 left
quotemstr moritz_: Right, which is why it's not really a different idea. 14:35
As you said, isomorphic.
moritz_ I find that for many things a scalar as .ast is sufficient 14:36
for example my json parser just returns the parsed literal as .ast
quotemstr Can you do something like call/cc while matching a pattern so you can save intermediate matching state?
moritz_ I don't know call/cc, care to explain more? 14:37
TimToady yes, this is $¢ which represents the current cursor
quotemstr It's a Scheme concept --- continuations.
Essentially, my parser is implemented as a parsing machine (or fancy pushdown automaton, if you prefer) so that the state of the parser can be saved every so often. 14:38
TimToady cursors are immutable match states, so you can resume at any cursor
you backtrack merely by throwing away uninteresting cursors
quotemstr That way, when we've parsed an Emacs buffer and the user changes something, we can resume parsing from the last known good position instead of having to start from the top again.
Ahh.
moritz_ see also the 'moreinput' method in STD.pm6 14:39
14:39 plobsing joined
TimToady well, that's just making the input lazy-able 14:39
moritz_ but that sounds exactly like what quotemstr wants to achieve 14:40
TimToady but laziness is a similar concept
14:40 benabik left
TimToady you can't un-moreinput 14:40
14:40 jimmy1980 joined
jnthn
.oO( lessinput )
14:41
moritz_ :-)
TimToady likewise with a lazy list, you un-munch it only by keeping the ref to the head of the list
list cursors are also readonly (in the abstract) for that reason, though of course an implmentation may cheat for performance 14:42
moritz_ anyway, time to call it a week. I'll commute, and leave the discussion to those who actually know what they are talking about :-)
TimToady looks around...
PerlJam And this is why functional languages hate side-effects ;)
TimToady and it's why various P6 constructs promise that there aren't side effects, or that you don't care if there are :) 14:43
quotemstr The proto regex facility is neat. 14:44
I think I'll skip the bottom-up parsing though. 14:47
TimToady we don't do much of that, other than operator precedence
quotemstr For practically anything an editor can do, operator precedence doesn't matter, and operator precedence seems to be the primary application of the bottom-up stuff. 14:48
Yeah.
TimToady (for some fancy def of op prec)
quotemstr The one issue I have with :: and ::> is safety though.
PerlJam When your language is full of operators, operator precedence parsing becomes important :)
quotemstr Say we have for-statement <- "for" :: { <statement-list> }, while-statement <- "while" :: { < statement-list> } 14:49
We can write | <foo-statement> <while-statement> and it works fine.
But what if, for some reason, we want to just match a while-statement? 14:50
That is, outside an alternation.
In that case, the :: is harmless.
But what if *that* rule is inside some unrelated alternation?
PerlJam quotemstr: where's the harm there?
TimToady PerlJam: basically, throwing an "exception" to the wrong handler 14:51
quotemstr PerlJam: It might end the LTM part of the enclosing alternation unexpectedly.
sorear quotemstr: exactly what you'd think would happen, will happen
quotemstr: so that definition of for-statement is not that nice
TimToady in STD, I found myself terminating the longest token more often with {} rather than ::
sorear quotemstr: I recommend only using :: if a) in a | in the rule b) in a multi regex c) if you know what you're doing 14:52
TimToady so yes, :: needs to know it's context by convention at that point, in this design
PerlJam Hmm.
sorear quotemstr: have you played with niecza LTM yet?
quotemstr So in that case, you'd split the definitions into while-prefix and while-guts, let's say.
sorear: Not yet. I'm just reading specs.
14:53 jimmy1980 left
quotemstr Also, correct me if I'm wrong, but LTM prefixes can't include rules with recursive portions (which would make the matched language non-regular), right? 14:54
TimToady quotemstr: in general, :: is mostly used in rules that have a proto representing the alternation
14:54 jimmy1980 joined
TimToady so in that case, we know exactly where the alternation point is 14:54
quotemstr TimToady: Fair enough. So they're legal elsewhere and just discouraged. 14:55
TimToady quotemstr: the lexer generator will stop at a left recursion, since a DFA can't do that
quotemstr: it would seem to fall in the category of "Doctor it hurts when I do this" 14:56
quotemstr TimToady: I suppose I'm just concerned that an unrelated change in some distant part of a grammar can cause LTM prefix length to change and cause hard-to-debug spooky action at a distance. 14:57
PerlJam TimToady: so what are some uses where there isn't a rule with a proto representing the alternation? 14:58
TimToady :: is also useful in an alternation that is known because it's in the current rule
PerlJam is suffering a failure of imagination this morning
TimToady quotemstr: we are very much not in favor of spooky action here, having learned our lesson with P5 14:59
PerlJam TimToady: or what I'm going to ask eventually is ... why not some other declarational construct specifically for LTM such that :: and friends aren't needed as terminators?
quotemstr TimToady: Right. I'm inclined to make non-declarative LTM prefixes compile errors and force users to use :: to split things up. 15:00
TimToady but the Perl approach is to not force the user to think about things they don't want to think about, unless they want to, to the extent we can get away with it 15:01
and I think we can get away with an implicit transition here most of the time
quotemstr Fair enough. I think I'll go the other way in my parser though. 15:02
PerlJam I guess in the small universe I just imagined explicit declared LTM would fill regex with <.start_ltm> and <.end_ltm> or some other markers anywya
TimToady "Languages differ not in what you can say, but in what you *must* say." --Roman Jakobson 15:03
15:04 ronoreck left
TimToady the experience with P6 grammars so far would indicate that this is not something worth forcing the user to say 15:04
15:05 shi left
TimToady we give programmers a language that they can learn "small end first" 15:06
quotemstr wonders whether captures can happen inside LTM prefixes.
PerlJam TimToady: that just means that there aren't enough people using Perl 6 grammars to be surprised at the action-at-a-distance that they themselves have accidentally created :) 15:07
15:07 achref joined
TimToady quotemstr: yes, they can; if necessary the dfa merely guides the choices of the nfa 15:07
achref your site is down? 15:08
PerlJam quotemstr: I would think captures are okay as long as there are no backrefs. (but what do I know?)
TimToady the dfa tells the nfa "Here is your fate."
achref rakudo.org/how-to-get-rakudo
quotemstr So you don't like Ville Laurikari's algorithm to automatically generate matches from the DFA?
TimToady it allocated 17 MB on the stack for every token :(
PerlJam achref: thanks.
TimToady that didn't run so well... 15:09
quotemstr PerlJam: You can do it, but it turns out that capturing with a DFA is non-trivial even for POSIX regular expressions, much less Perl 6 ones.
Right. Just running the DFA to figure out which NFA should be run seems like a simpler approach.
PerlJam achref: try again. 15:10
TimToady the original implementation STD actually determined the "fated" choices all the way down the recursive descent, but I think sorear++ is playing with redeciding via DFA at each choice point to see if it goes faster or slower 15:11
achref ok fine
15:12 ronoreck joined
quotemstr TimToady: By "all the way down the recursive descent", do you mean matching each LTM alternative in its entirety, then re-parsing the chosen one? 15:12
TimToady as long as the semantics are conserved, it doesn't matter which way we do it, so we'll go with whatever turns out more efficient
quotemstr TimToady: Of course.
TimToady a given left-most token may be recursively parsed down through several alternations before we "advance" 15:13
the DFA can tell all of the alternations what they well decide in advance if we use the fuller fates model
so the lower alternatives don't even have to think about LTM again 15:14
since it's already implicit in the outer lexer's decisions
15:14 kaare_ left 15:15 kaare_ joined 15:16 Patterner left
quotemstr Right. That makes a lot of sense. 15:17
TimToady we do always do the recursive descent parsing though
15:18 Psyche^ joined, Psyche^ is now known as Patterner
TimToady though there might be ways of faking that too 15:18
quotemstr TimToady: I can see why that approach might not always be a performance win though, especially for a small number of alternatives.
TimToady: Well, if there are no captures, faking it should be easy.
15:18 tzhs left
TimToady well, it's hard to return to some place that never existed :) 15:19
quotemstr TimToady: For backtracking? You just return to the point before you even initialized the DFA, right?
TimToady anyway, we try to nail down the semantics, and optimizers are free to cheat within those constraints
quotemstr Right.
Same here.
TimToady returning not for backtrack, but for success 15:20
there may well be action methods associated with the higher nodes in the tree 15:21
15:21 kaare_ left
quotemstr Shouldn't \N exclude U+0085, U+2028, and U+2029 too? 15:21
TimToady those have to be called as if we did the recursive descent, and are now ascending
quotemstr TimToady: Ah, right. 15:22
TimToady yes, \N is supposed to match a single character anywhere where \n doesn't 15:23
and \n is logical newline, not a concrete char
quotemstr Ah, good. I see that \n now matches the TR18 newlines. 15:24
TimToady the intent is to track Unicode to the point where they go insane, and perhaps a little beyond that point :)
quotemstr ". matches an anything, while \N matches an anything except newline. (The /s modifier is gone.) In particular, \N matches neither carriage return nor line feed." should be ". matches an anything, while \N matches an anything except what \n matches. (The /s modifier is gone.) In particular, \N matches neither carriage return nor line feed."
flussence_ «# got: 'oxy()<0x8609b58>'␤# expected: ' quack'» .oO( this isn't going well... ) 15:25
TimToady quotemstr: that would be clearer 15:26
pmurias sorear: hi
dalek ecs: e7cc2ec | (Daniel Colascione)++ | S05-regex.pod:
Be more explicit about what \N does not match.
15:27
sorear pmurias: hi 15:31
pmurias sorear: i'm thinking of working on niecza during gsoc, what would be a good task? 15:32
15:33 MayDaniel joined
TimToady ablutes & 15:34
[Coke] .d ablute 15:38
quotemstr [Coke]: IME, "ablution" is more common. 15:44
flussence_ argh, I've screwed this indent thing up completely
quotemstr S05 contains a lot of forward references, which makes it hard to read. 15:45
moritz_ quotemstr: it contains enough information that I needed multiple passes (more than 2) anyway 15:48
15:48 dual left
moritz_ and I think I still haven't grokked it all 15:49
still, more readable would be better 15:51
quotemstr I think I'll prefer to have exactly one kind of "aliasing", the explicit named capturing kind.
15:54 cotto left 15:56 madalu joined
quotemstr Hrm. 15:59
Say we have regex a b c (|| x y z)) d e f
We match the first three tokens normally, then hit the alternation.
(Assume backtracking is on.) The alternation has to try x d e f, then y d e f, then z d e f, then fail. 16:00
Also assume we're using the NFA matcher.
How does the current implementation communicate to the alternation what the remainder of the pattern is supposed to be?
Do we just model the sequence as a series of explicit states and let the alternation know what the next state ought to be? 16:01
16:01 woosley left 16:02 achref left
moritz_ quotemstr: your regex is just the same as regex { a b c x y z d e f } 16:02
an alternative with a single branch is a no-op
and the leading empty branch is ignored 16:03
quotemstr moritz_: Err, I typed that wrong. The alternative is supposed to have three branches.
moritz_ so regex { abc (x || y || z) def } ?
quotemstr Yes.
Brain was still in Lisp mode.
16:04 jfried joined
moritz_ the (x || y || z) is just compiled to a routine that returns a lazy list of three cursors 16:04
quotemstr Essentially, when backtracking happens, where is the backtracking *state* stored?
When you backtrack to position P, you also need to restore all the state for that P except the bit that modifies the path taken. 16:05
And the cursor object includes all that state?
moritz_ I think the cursors just stores an integer position, and a reference to the string being matched 16:06
nested backtracking is done by constructing a lazy tree from the lazy lists 16:07
quotemstr The cursor would have to include information about which branch to take.
moritz_ btw your example isn't the best, since (x || y || z) never backtracks, because something that matches 'x' can't match 'y'
quotemstr You get the idea. 16:08
moritz_ just sayin'
well, the cursor needs to include the information which branch it took
16:08 mberends left
sorear most serious implementations use a choice-point stack 16:08
"a" is compiled to backtrack() unless @chars[$pos++] eq 'a' 16:09
sub backtrack() { $pos = @save-pos.pop; goto @save-label.pop } 16:10
[x || y] -> save(O); code_for_x(); goto E; O: code_for_y(); E: 16:11
quotemstr I should read about how choice point stacks work. 16:12
flussence_ my $?TABSTOP = 8; my @ws = ((' ' Xx 0..$?TABSTOP-1) X~ "\t"); [==] @ws».indent(-4); # I can't decide what happens with leading space+tab and the spec doesn't help. Any ideas? 16:13
sorear quotemstr: start here: mitpress.mit.edu/sicp/full-text/sic...ode89.html 16:14
niecza: my $?TABSTOP = 8;
p6eval niecza v3-80-g3cc93a7: OUTPUT«===SORRY!===␤␤Variables with the ? twigil cannot be declared using my; they are created using 'constant'. at /tmp/kkt6QyORCF line 1:␤------> my $?TABSTOP ⏏= 8;␤␤Unhandled exception: Check failed␤␤ at
../home/p6eval/niecza/boot/lib/CORE.setting li…
flussence_ rakudo: constant $?TABSTOP = 8; 16:15
p6eval rakudo 792e86: OUTPUT«===SORRY!===␤Constant type declarator not yet implemented at line 22, near "= 8;"␤»
flussence_ :(
16:15 hudnix left 16:16 hudnix joined
sorear niecza: constant $?TABSTOP = 2; sub foo() { say caller.hints('$?TABSTOP'); }; sub bar(&f) { constant $?TABSTOP = 9; f(); }; bar(&foo); 16:17
p6eval niecza v3-80-g3cc93a7: OUTPUT«9␤»
16:18 kaare_ joined
TimToady supposedly CALLER::<$?TABSTOP> should give you the same thing 16:23
sorear I still haven't formed a complete mental model of how pseudo-packages work 16:24
16:24 hudnix left 16:26 takadonet joined
sorear niecza seems to think the contents of CORE.setting are "Bool::False" 16:26
wtf...
16:27 takadonet left, takadonet joined
sorear oh... 16:28
my ($path, $time, $contents) = (~$p.realpath, $p.modified.to-posix, $p.slurp) 16:29
16:30 sftp joined, hudnix joined
dalek ecza: 7a937de | sorear++ | src/NieczaPathSearch.pm6:
[compiler] Be tolerant of .to-posix returning a list now
16:31
16:37 madalu left 16:41 MayDaniel left
quotemstr sorear: Thanks. 16:42
sorear: My idea was for each parser-function to provide two closures to the "next" parser, on-success and on-failure. 16:43
sorear: Essentially using functions as automaton states.
sorear: The nice thing about that approach is that you can unwind state changes on both paths, and admits the optimizing of using the parent's on-failure closure directly if there's no additional work to be done. 16:46
sorear: It's a spaghetti stack, essentially. Is that equivalent to a choice-point stack?
sorear quotemstr: something like that can probably be made to work, but mind performance 16:50
quotemstr: it's possible to handle unwinding state changes in the choice point model; imagine [ stuff || { restore; } <!> ] 16:51
if stuff backtracks, then restore; will be called and the whole block will backtrack
16:53 plobsing left
sorear quotemstr: also, whatever you decide to implement, S05 requires that regex methods communicate using lazy lists 16:54
quotemstr sorear: Ah, good point. 16:55
sorear: Also, is there anything wrong with thinking of repetition as simply temporal alternation starting with an infinite number of copies, then on backtrack, nr_success - 1, nr_success - 2, ... 0 copies ? 16:56
sorear quotemstr: yes; counting down from infinity takes a while
quotemstr Well, how else can you get a*a to match successfully? 16:57
sorear well, start from "as many as possible"
but it's still subtly wrong
quotemstr The first time through, we match as many times as we can and remember how many times we backtrack. 16:58
The next time throught (on the next choice point, as it were), we subtract one from that value and try to match that many times.
sorear: Thanks for the help, by the way.
16:58 mtk left
sorear niecza: "aaa" ~~ /^ [ [a||a]**3 || [a||a]**2 || [a||a]**1 || <?> ] { say $¢.pos } <!> /; 16:59
p6eval niecza v3-80-g3cc93a7: OUTPUT«1␤1␤1␤1␤1␤1␤0␤»
sorear hrm
niecza: "aaa" ~~ /^ [a||a]**3 { say $¢.pos } <!> /; 17:00
p6eval niecza v3-80-g3cc93a7: OUTPUT«1␤1␤»
sorear niecza: "aaa" ~~ /^ a**3 { say $¢.pos } <!> /; 17:02
p6eval niecza v3-80-g3cc93a7: OUTPUT«1␤»
quotemstr Ah.
quotemstr scratches his head.
sorear don't; I'm trying to get my example to work
17:03 plobsing joined
quotemstr Shouldn't the backtracking always be *inside* the inner group [a||a]? 17:03
And shouldn't the first branch always be taken in that case?
17:03 noganex_ is now known as noganex
sorear niecza: "aaa" ~~ /^ [ [a||a]**3..3 || [a||a]**2..2 || [a||a] || <?> ] { say $¢.pos } <!> /; 17:04
p6eval niecza v3-80-g3cc93a7: OUTPUT«3␤3␤2␤1␤2␤2␤1␤1␤1␤0␤»
17:05 mj41 left
sorear looks like ** is pretty broken 17:05
niecza: "aaa" ~~ /^ [ [a||a][a||a][a||a] || [a||a][a||a] || [a||a] || <?> ] { say $¢.pos } <!> /;
p6eval niecza v3-80-g3cc93a7: OUTPUT«3␤3␤3␤3␤3␤3␤3␤3␤2␤2␤2␤2␤1␤1␤0␤»
sorear this is what you get if you implement repetition like you just suggested
but it's wrong 17:06
niecza: "aaa" ~~ /^ [a||a]* { say $¢.pos } <!> /;
p6eval niecza v3-80-g3cc93a7: OUTPUT«3␤3␤2␤3␤3␤2␤1␤3␤3␤2␤3␤3␤2␤1␤0␤»
quotemstr Is that so?
Ahh.
And the exact ordering of the calls to that action is defined, I imagine. 17:07
(Unlike a semantic predicate.)
sorear well, it makes a big difference if you have cuts
TimToady can probably say why it's critical that it be defined this way 17:08
niecza: my regex x { a { make 1 } || b { make 2 } }; "aaa" ~~ /^ <x=&x>* { say map *.ast, @$<x> } <!> /
p6eval niecza v3-80-g3cc93a7: OUTPUT«Unhandled exception: Unable to resolve method ast in class Any␤ at /tmp/t3UHl1RzW7 line 1 (MAIN C6_ANON @ 1)␤ at line 0 (KERNEL map @ 2)␤ at /tmp/t3UHl1RzW7 line 1 (MAIN C5_ANON @ 2)␤ at /tmp/t3UHl1RzW7 line 1 (MAIN C4_ANON @ 5)␤ at 17:09
../home/p6eval/niecza/lib/CORE.setting line 1…
17:09 TTL joined 17:10 TTL left
quotemstr sorear: Still trying to wrap my head around how that actually works. 17:11
sorear: The first time through the [a||a]* version, we match [a||a]* successfully three times, output 3, and fail. Why do we back up only one position the next time? 17:12
Oh.
I see.
moritz_ because there are two ways to match 'a'
sorear a* = [ a a* || <?> ]
quotemstr Because the most recent choice point was the one created by [a||a]. 17:13
And only if *that* fails do we backtrack to the previous choice point.
Hrm. What
moritz_ if you name them a1 and a2
17:13 plobsing left
moritz_ first you match a1 a1 a1 17:13
quotemstr 's the best Perl 6 implementation I can play with, and where should I get it?
moritz_ then a1 a1 a2
then a1 a2 a1, then a1 a2 a2 etc. 17:14
quotemstr Right. Then a1 a2 a1, then a1 a2 a2, etc.
moritz_ quotemstr: niecza is leading in terms of regexes
quotemstr Okay, that makes sense.
moritz_ github.com/sorear/niecza
clone it, the README has installation instructions 17:15
quotemstr I actually wonder whether the code could just be transliterated. Perl 6 and Emacs are license-compatible.
Thanks.
moritz_ well, niecza targests .NET/mono
if you want your emacs stuff to emit CLR code, go ahead and transliterate :-) 17:16
quotemstr moritz_: Sure, but it'd be the algorithms and data structures. Not a single character of the code would literally survive.
(That kind of construct-for-construct transliteration still triggers copyright though.)
sorear quotemstr: what are you trying to port? 17:19
quotemstr sorear: The rules engine. 17:20
I'm just surprised and pleased that my thinking was leading toward something very much like it.
sorear Which rules engine?
17:21 hercynium joined
quotemstr Actually, I had it backwards: *my* solution would match a1 a1 a1, a1 a1 a2, a1 a2 a1, etc. What Perl 6 does above is backtrack one step in the repetition without trying any inner alternatives. 17:22
sorear: The piece of code that generates parsers for the new Perl 6 "regular" expressions. 17:23
sorear quotemstr: oh, you're trying to port it *to* Emacs?
quotemstr sorear: Yes.
moritz_ alternative route: write a emacs-lisp backend for niecza, bootstrap niecza and leave it as Perl 6 code :-) 17:25
quotemstr I'm not going to require niecza to regenerate grammars though, since the goal is for them to be user-customizable in a way they aren't today.
Say you're using a weird dialect of C at work that requires _In_ or _Out_ before each parameter type in a function declaration's argument list. 17:26
With the current C support, you're out of luck because the grammar is essentially hardcoded into the mode implementation. This is an effort to provide more extensibility by just plugging new syntax into ~/.emacs.
Requiring niecza in order to make these changes would hurt adoption at the very least, unfortunately, so I'd like this facility to be pure elisp. 17:27
Nice idea though. :-)
17:32 donri left
quotemstr Ah, that's a shame. 17:35
Ah, the Artistic 2.0 license *is* GPLv[23]-compatible. 17:37
17:46 dual joined 17:50 plobsing joined 17:52 ymasory joined, ymasory left 17:55 dakkar left 18:09 spq joined 18:10 dsp_ left 18:13 envi left
Juerd More feather rebooting. Sorry. 18:15
18:15 Juerd left 18:19 tadzik left, hugme left, PerlJam left, Util left, hugme joined, ChanServ sets mode: +v hugme 18:20 leprevost left 18:21 Chillance joined, Juerd joined 18:22 madalu joined 18:26 stkowski joined 18:27 dsp_ joined 18:35 tadzik joined 18:46 wallberg joined 18:49 MayDaniel joined, MayDaniel left, MayDaniel joined 18:55 jferrero joined 18:57 fhelmberger left 19:05 donri joined 19:07 Mowah left 19:10 Mowah joined
pmurias quotemstr: there exists a start of a common lisp backend for niecza, i could expand it if you are willing to port it over to emacs lisp ;) 19:13
19:15 risou joined
quotemstr pmurias: I just saw that, actually. 19:16
While that looks good, it'd still equire the niecza engine at grammar-compilation time and so wouldn't suit my purposes.
Thanks anyway though.
19:16 awoodland joined
pmurias quotemstr: if we expand it enough we could bootstrap niecza with it (so instead of in .net the engine itself will be in emacs lisp) 19:18
but it's not the simplest way of achieving what you want
19:19 plainhao left
quotemstr Yeah. It's a neat idea though. 19:19
Besides, elisp lacks some features of CL (like packages and lexical closures) that might increase the cost of such a port.
sorear pmurias: (gsoc) I don't have 3 months of good plans, myself 19:20
Juerd Another reboot coming up. I hope it's the last.
19:20 Juerd left, tadzik left
sorear "multiple dispatch", "BEGIN", "make yapsi work", "make Web.pm work", "JVM port" 19:21
all of those are 2-4 week projects, or more if I try to do them while classes are in session
19:22 Juerd joined
sorear yapsi is probably closer to 1-2, although it depends on MMD working first 19:22
19:23 hugme left 19:24 risou left
pmurias JVM port looks like a more length thing 19:25
19:27 risou joined, snearch joined
pmurias * lengthy 19:27
19:27 MayDaniel left
dalek ecza: 1dc43eb | sorear++ | docs/announce.v4:
Draft v4 release announcement
19:28
sorear except that the JVM and CLR are already quite close 19:31
pmurias so it would be a rather boring port over the differences thing?
sorear yes
the bytecode emitter would need significant refactoring but little actual redesign
a niecza-JVM port might be even easier than 6model/JVM because niecza avoids using delegates 19:32
pmurias do you plan to take part in gsoc this year?
sorear I haven't decided yet - with my current course load I find it hard to think about another long-term thing 19:33
pmurias one thing which seems interesting would be to port over hoopl and write an optimiser using it 19:35
the hoopl library allows combining simple optimalisation pass together 19:36
so one could write container elimination, simple type inference and constant folding and have it combined into a single pass that does all of that 19:37
hoopl is used by ghc so the approach was proved in production 19:39
sorear: what do you think about that? 19:40
19:41 ymasory joined, dolmen left 19:42 masak joined
masak good evening, zebras! 19:43
moritz_ \o
flussence_ masak!
masak has a good feeling about announcing the p6cc winner tonight
19:44 zby_home joined
flussence_ I'm stuck on a thing. What should .indent(3) and .indent(-3) output for " \t \t "? (it's not as obvious as it looks...) 19:46
masak thinks
hm, it's a line with only whitespace? 19:47
and it's mixed, so the rule of mixed whitespace kicks in...
[Coke] what rule about mixed whitespace? 19:48
masak I'd say add $*TABSTOP spaces to the end of the string in the first case, and explode the second \t into $*TABSTOP-2 spaces in the second case.
[Coke]: it's all in the .indent spec in S32/Str.
[Coke] masak: and the word "mixed" isn't used there at all. 19:49
flussence_ [Coke]: ^\t removes indent from the right-hand-side so that it ends up as ^\t if possible. Everything else goes from the left.
19:49 tadzik joined
flussence_ (oh whoops, I asked the wrong question there. indent(3) is easy stuff) 19:50
pmurias masak: who one the overall contest? 19:51
s/one/won/
tadzik try.rakudo.org is broken 19:52
flussence_ I wasn't sure whether outdenting should've done a visual-whitespace outdent, but thinking about it that seems impossibly hard to do well
tadzik: gimme 30 seconds
19:52 madalu left
flussence_ fixed! 19:53
[Coke] I would expect .indent(3) to return " \t \t " and .indent(-3), assuming a TABSTOP of 4, to return " \t "
I'm not sure why masak is saying it should touch the /end/ of the string.
tadzik flussence_: thanks 19:54
flussence_ (I really need to figure out a way of starting that in screen on boot that actually works...)
sorear pmurias: curious but dubious 19:55
pmurias sorear: what's dubious about that? 20:02
quotemstr Is the only difference between <commit> and <cut> that the latter has the side effect of modifying the sequence being matched? 20:03
sorear quotemstr: I beleive so 20:04
pmurias: applicability to niecza 20:07
masak pmurias: I'm planning to announce that tonight. 20:11
[Coke]: I think I arrived at operating on the end of the whitespace prefix being the only sensible option. probably exactly because of the conceptual difficulties flussence_ seems to be having right now. 20:12
[Coke]: sadly, it never made it into the spec. probably should.
[Coke]: basically, the reason to operate on the end of the whitespace prefix is that tab characters jiggle around their widths when one puts spaces before them. and that's not how you'd want an .indent function to work. 20:14
20:14 pjcj left
[Coke] ok. please don't refer me to the spec and then say not to use it. ;) 20:17
sorear the spec .indent was never designed for use with mixed tabs/spaces 20:19
[Coke] then why does it explicitly try to cover it with TABSTOP? 20:20
masak sorear: what makes you say that? I wrote that part, and I thought of the mixed case.
specifically "[added spaces] will be either (1) consistent with subsequent leading whitespace already on the line, if these are all the same, or (2) spaces" 20:21
the (2) denotes the mixed case.
sorear masak: I say that because I wrote it. If you've changed it since then... I can't contribute usefully. 20:22
masak , confused, does a git blame 20:23
flussence_ AIUI, for /^(\s) (\s*) (.*)/, if $0 is a \t, the in/outdent happens at the end of $1, otherwise it's at the beginning of the string
with the general aim of not screwing up someone's existing tab-indent
masak sorear: I haven't changed it since then. the only commits on the .indent spec are two commits on the same day, and they're the original ones. 20:24
flussence_: hm, what's situation where acting at the end of $1 results in something surprising/less than good? 20:25
flussence_ nothing I've come across...
masak I suggest we spec and implement for it to act at the end of $1 always, for consistency. 20:26
pmurias sorear: why do you think it's not applicable?
20:26 Util joined
masak flussence_: it seems to me there's either no way to tell the difference between it acting on the beginning of the whitespace prefix or the end, or there are tabs involved and then it matters that it's at the end. 20:27
pmurias Perl 6 does not give us enough info to work with? trading compile time for runtime performance is not worth it?
masak quotemstr: I think so.
pmurias ghc uses it's for an imperative intermediate language so it's not a functional programming thing
s/it's/it/
flussence_ I think that's a better way to go. All my code for doing stuff at that end passes tests already :) 20:28
masak flussence_++
how about I change the spec a little? try to reduce some confusion rather than change the actual semantics...
20:30 hudnix left
masak sorear: if by "I wrote it" you mean "I implemented .indent in Niecza", I'm less confused than if you meant "I wrote the specification on .indent" ;) 20:30
sorear masak: I either wrote the specification, or wrote the implementation it was based on 20:31
either way, it predates niecza
masak sorear: git blame says 'masak' on the spec. I don't remember basing that text on any implementation.
sorear odd 20:32
masak but yes, 2010-06-03 probably predates niecza.
20:32 Hackbinary left
masak the .indent method was born because pmichaud++ felt it might be a good idea to expose as a method the behavior that was implicit in heredoc outdenting. 20:33
that's what .indent(*) does.
20:33 Mowah left
sorear pmurias: it doesn't seem very suitable for a Perl implementation 20:33
masak: my recollection is that it was born as an implementation factor of the viv -5 pretty printer that we (me and TimToady) decided was general enough that it ought to be made trivial 20:34
I wonder what I'm thinking of
masak me too. :)
20:35 jfried left
masak could be there's a slight parallel universe bleedover in this part of the continuum. 20:35
er. I mean.
might've been there was an .indent method before I wrote it into the spec, but I'm pretty sure I wasn't aware of it at the time. 20:36
20:38 frettled joined
masak frettled! \o/ 20:38
frettled o/
20:48 dsp_ left 20:49 dsp_ joined 20:51 pjcj joined
pmurias sorear: what aspect of Perl do you think makes it unsuitable? 20:52
sorear: i see it very usefull with removing a lot of the overhead 20:53
dalek ecs: dbfdabb | masak++ | S32-setting-library/Str.pod:
[S32/Str] rewrote .indent description

Explained that indentation is in fact added at the end of the whitespace prefix, not at the beginning. (This is in order to make tab characters act sanely.)
Rewrote other parts, but they should be identical in meaning, just
  (hopefully) clearer.
sorear pmurias: dynamic types and lack of optimization for purely-functional code 20:54
pmurias sorear: as we need to optimise out multimethods or otherwise numerics will be horribly slow
masak rakudo: my @foo := 1..3, @foo; .say for @foo[^10]
p6eval rakudo 792e86: OUTPUT«1␤2␤3␤1␤2␤3␤1␤2␤3␤1␤»
masak this is what I expect. 20:55
pmurias sorear: explain what you mean by the second thing?
masak rakudo: my @foo := 1..3, (@foo Z+ 100); .say for @foo[^10]
p6eval rakudo 792e86: OUTPUT«1␤2␤3␤101␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤»
masak that... is not.
can we rely on array binding of the above kind to work?
if yes, is the second eval an expression of a rakudobug?
if no, how are we supposed to explain that some cases work and some not? :/ 20:56
sorear masak: I beleive so on both counts
masak submits rakudobug
sorear I expect "1 2 3 Any() Any() ..." for both of them 20:57
masak flussence_: please let me know if the above spec change was an improvement :)
sorear: ok.
flussence_ reading it now
sorear AIUI, looping like that is specifically a hyperoperator feature
masak sorear: does "1 2 3 Any() Any() ..." have support in the spec over "1 2 3 1 2 3 ..."? 20:58
flussence_ masak++ # that looks a lot better
sorear pmurias: I have an agenda for numerics already which does not involve type inference
masak \o/
sorear pmurias: I think type inference for numerics is a dead end, but I can't explain why well enough to convince anyone else 20:59
20:59 Juerd left, Juerd joined
masak that sounds interesting. jnthn, as far as I know, is going down the type inference road for the common operators. 21:00
so there should be some empiric data on that soonish. 21:01
pmurias sorear: what's your agenda?
sorear masak: S03:4165 says that >>+<< will repeat anything, including simple scalars and Parcels, so repetition as a .. feature is... odd
pmurias m 21:02
masak sorear: it's not an infix:<..> feature, just a feature of infix:<:=> (if it is indeed a feature at all).
flussence_ rakudo: my @foo := @foo; say @foo.perl;
p6eval rakudo 792e86: OUTPUT«(timeout)» 21:03
masak known bug.
flussence_ rakudo: my @foo := @foo; say @foo[^2];
p6eval rakudo 792e86: ( no output )
masak luckily, binding something to itself should be a no-op, so you don't need to do it often in real code. :)
sorear masak: := is defined principally by its lack of magic; for it to do something like that is ... very wrong
masak sorear: understood.
sorear: but then again, I think binding individual array elements or hash keys is sufficiently magical. 21:04
sorear also parameter binding is (iirc) defined as being the same as :=
masak aye.
good point.
moritz_ ::= by default
sorear sub foo(@bar) { .say for @bar }; foo(1..3) # WTF why does this infiniloop
moritz_ perl6: sub foo(@bar) { .say for @bar }; foo(1..3) 21:05
p6eval pugs, rakudo 792e86, niecza v3-82-g1dc43eb: OUTPUT«1␤2␤3␤»
masak \o/
sorear: why would it loop infinitely? I don't follow.
it's not the same situation. in the parameter binding, @bar does not occur in the "RHS".
sorear masak: because it means the same as my @bar ::= 1..3; .say for @bar;
masak right, and that's a *finite* list. 21:06
finite and non-self-referent.
sorear masak: ignore everything I've said in the last 12 minutes; I misread your example as my @foo := 1..3; @foo; .say for @foo[^10] 21:07
masak ah :)
sorear and I was WTFing at the rakudoinsanity
masak :P
masak adds that to the rakudobug
sorear re-reading, the Rakudo behavior is probably correct 21:08
masak for both evals? 21:09
the second one has be confuddled.
21:10 Rotwang joined
sorear rakudo: say (1,2,3 Z+ 5) 21:10
p6eval rakudo 792e86: OUTPUT«6␤»
sorear Z+ truncates to the length of the shorter list.
rakudo: say (1,2,3 »+» 5) # You may have wanted this, instead.
p6eval rakudo 792e86: OUTPUT«128␤»
sorear rakudo: say ((1,2,3) »+» 5) # You may have wanted this, instead. 21:11
p6eval rakudo 792e86: OUTPUT«678␤»
flussence_ rakudo: say (1,2,3 X+ 5)
p6eval rakudo 792e86: OUTPUT«678␤»
masak ah, yes.
rakudo: my @foo := 1, 2, 3, (@foo »+» 100); .say for @foo[^10] 21:12
p6eval rakudo 792e86: OUTPUT«1␤2␤3␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤»
masak hm.
sorear »+» is explicitly not lazy
X+ is better
21:12 PerlJam joined
masak rakudo: my @foo := 1, 2, 3, (@foo X+ 100); .say for @foo[^10] 21:12
p6eval rakudo 792e86: OUTPUT«1␤2␤3␤101␤102␤103␤201␤202␤203␤301␤»
masak \o/
that is so cool. 21:13
unfortunately, X+ can't be used to define @fib. 21:14
sorear Z+ can
pmurias sorear: what would convince you that (partial) type inference is feasible? short of a working implementation?
masak rakudo: my @fib = 1, 1, (@fib Z+ @fib[1..*]); .say for @fib[^20]
sorear @foo X+ 100 is like @foo Z+ (100 xx *)
p6eval rakudo 792e86: OUTPUT«(timeout)»
masak :/
rakudo: my @fib = 1, 1, (@fib Z+ @fib[1..20]); .say for @fib[^20] 21:15
p6eval rakudo 792e86: OUTPUT«1␤1␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤»
21:15 risou left
masak bleh. 21:15
sorear masak: I think @fib[1..*] is trying to calculate the length of the Fibonacci sequence
masak I don't see why, but I think so too.
sorear masak: the list iteration is lazy, but @fib[1..20] is just a term, it's evaluated immediately
masak rakudo: my @fib = 1, 1, (@fib Z+ @fib[1...20]); .say for @fib[^20] 21:16
p6eval rakudo 792e86: OUTPUT«1␤1␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤»
sorear rakudo: my @fib = 1, 1, gather { .take for (@fib Z+ @fib[1..20]) }; .say for @fib[^20]
p6eval rakudo 792e86: OUTPUT«1␤1␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤»
sorear rakudo: my @fib = 1, 1, gather { take $_ for (@fib Z+ @fib[1..20]) }; .say for @fib[^20]
p6eval rakudo 792e86: OUTPUT«1␤1␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤»
sorear rakudo: my @fib = 1, 1, ((1, @fib) Z+ @fib); .say for @fib[^20] 21:17
p6eval rakudo 792e86: OUTPUT«1␤1␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤Any()␤»
sorear rakudo: my @fib := 1, 1, ((1, @fib) Z+ @fib); .say for @fib[^20]
masak rakudo: my @fib = 1, 1, gather { take @fib[$_] + @fib[$_ + 1] for 0..Inf }; .say for @fib[^20]
p6eval rakudo 792e86: OUTPUT«1␤1␤2␤2␤3␤4␤5␤7␤9␤12␤16␤21␤28␤37␤49␤65␤86␤114␤151␤200␤» 21:18
rakudo 792e86: OUTPUT«(timeout)initialized value in numeric context in <anon> at line 22:/tmp/0JnwZFJQH8␤Use of uninitialized value in numeric context in <anon> at line 22:/tmp/0JnwZFJQH8␤Use of uninitialized value in numeric context in <anon> at line 22:/tmp/0JnwZFJQH8␤Use of uninitialized
..value in …
21:18 cxreg2 joined
masak rakudo: my @fib := 1, 1, gather { take @fib[$_] + @fib[$_ + 1] for 0..Inf }; .say for @fib[^20] 21:18
21:18 d4l3k_ joined
p6eval rakudo 792e86: OUTPUT«1␤1␤2␤3␤5␤8␤13␤21␤34␤55␤89␤144␤233␤377␤610␤987␤1597␤2584␤4181␤6765␤» 21:18
21:18 y3llow_ joined
masak \o/ 21:18
rakudo: my @fib := 1, 1, gather (take @fib[$_] + @fib[$_ + 1] for 0..Inf); .say for @fib[^20] 21:19
21:19 frettled_ joined
p6eval rakudo 792e86: OUTPUT«1␤1␤2␤3␤5␤8␤13␤21␤34␤55␤89␤144␤233␤377␤610␤987␤1597␤2584␤4181␤6765␤» 21:19
21:19 snearch left 21:20 frettled left
masak rakudo: my @fib := 1, 1, map { @fib[$_] + @fib[$_ + 1] }, 0..Inf; .say for @fib[^20] 21:20
21:20 y3llow_ is now known as y3llow, d4l3k_ is now known as dalek, ChanServ sets mode: +v dalek
p6eval rakudo 792e86: OUTPUT«1␤1␤2␤3␤5␤8␤13␤21␤34␤55␤89␤144␤233␤377␤610␤987␤1597␤2584␤4181␤6765␤» 21:20
masak \o/ \o/
sorear eagerly (without {} blocks) self-referential binding will never work 21:21
because all occurrences of @fib in the RHS will be resolved to the old container, which is discarded by the binding
eagerly self-referential *assignment* may work in some cases
masak rakudo: my @selfref := 1, 2, 3, @selfref; .say for @selfref[^10] 21:22
p6eval rakudo 792e86: OUTPUT«1␤2␤3␤1␤2␤3␤1␤2␤3␤1␤»
masak sorear: how come that works, then?
sorear masak: rakudo's broken binding model
masak :(
sorear perl6: my $x = 1; my $y := $x; $x := 3; say $y;
p6eval pugs, niecza v3-82-g1dc43eb: OUTPUT«1␤» 21:23
..rakudo 792e86: OUTPUT«3␤»
masak that is indeed broken.
wow.
sorear rakudo: my $x; my $y; $x := $y; $y := $x; say $x;
p6eval rakudo 792e86: ( no output )
sorear rakudo: my $x; my $y; $x := $y; $y := $x; say $x; say "alive"; 21:24
p6eval rakudo 792e86: ( no output )
21:24 MayDaniel joined 21:25 TiMBuS joined 21:29 jfried joined, jfried left, hercynium left 21:32 mj41 joined, benabik joined
masak would it be a bad idea to make $0.succ default to $0.Str.succ? 21:39
or, in other words, to have Match objects behave as Str in the case of .succ and .pred 21:40
21:40 alester left
moritz_ not a bad idea at all 21:40
sorear The point is not obvious 21:41
21:41 Lorn joined
masak no, it isn't. 21:41
a colleague at client was surprised when it didn't have that default. 21:42
s/client/$client/
moritz_ ===SORRY!=== 21:43
Symbol '$client' not predeclared in <anonymous>
masak :P
moritz_ SCNR
21:44 bacek joined
masak rakudo: my @fib = (1,1,*+*...*)[^10]; say diff(@fib).perl given my &diff := sub (@a) { @a[1..*-1] Z- @a } 21:45
p6eval rakudo 792e86: OUTPUT«(0, 1, 1, 2, 3, 5, 8, 13, 21)␤»
masak rakudo: my @fib = (1,1,*+*...*)[^10]; say diff(@fib).perl given my &diff := sub (@a) { @a[1..*] Z- @a }
how come one works and the other one times out?
p6eval rakudo 792e86: OUTPUT«(timeout)»
sorear rakudo: my @foo = <a b c d>; say @foo[1..*] 21:47
p6eval rakudo 792e86: OUTPUT«(timeout)»
sorear rakudo: my @foo = <a b c d>; say @foo[1..*-1] 21:48
p6eval rakudo 792e86: OUTPUT«bcd␤»
Juerd Hm, let's do a feather dist-upgrade. 21:50
pmurias sorear: if i wrote a simple proof of concept in haskell that loads up nam, does some simple type inference, constant folding and maybe if 0 {...} and if 1 {...} handling would you believe type inference for Perl 6 is feasible? 21:58
22:04 kaare_ left 22:15 hudnix joined
sorear pmurias: oh, I absolutely beleive it's feasable 22:15
pmurias: I just don't beleive it's _useful_ 22:16
22:17 MayDaniel left 22:20 gbacon left 22:22 awwaiid left 22:23 awwaiid joined
pmurias sorear: explain 22:24
22:25 donri left
pmurias sorear: how do you intend to implement addition fast without type inference? 22:26
sorear The most important thing is not going through the general procedure call interface 22:27
We know CORE::<&infix:<+>> takes two arguments and doesn't need &take, so the C# code can be called directly, avoiding two trampoline bounces, a frame construction, and the interpretive binder loop 22:29
22:31 Hackbinary joined
sorear type inference buys us the ability to bypass a couple of if statements in Builtins.cs 22:31
it doesn't buy us the ability to bypass the general dispatcher, because we already have that 22:32
moritz_ even if the user defines his own infix:<+> multis?
sorear then type inference becomes relevant 22:33
pmurias type inference also buys as the ability to bypass a container fetch and a junction check
sorear type inference is doable and useful to have, but it is not even close to the most important performance feature 22:34
pmurias what's the most important performance feature? 22:35
masak finished adding up scores. turning to blogging.
pmurias profiling?
sorear by "useful to have" I mean that it will improve error quality a lot
masak hopes to whip up some small bit of excitement over the winner announcement
this is a prestigious contest, you know. :) 22:36
the winner gets 1e3 EUR in books.
sorear my Num $foo; say $foo.cps; # Blows up or at least warns at compile time, because the method is spelled cos
Wasn't it 2e2 previously?
masak no.
but I suspect it'll be 2e3 next year around. 22:37
sorear wonders where masak is getting 2e3 EUR/yr to spend on prizes (TPF?)
pmurias masak: you founded the competition out of your own money?
masak pmurias: aye.
so worth it :)
er wait. 22:38
1e2 this year and 2e2 next year.
:)
was thinking SEK, not EUR.
22:39 am0c left
masak writes that blog post 22:39
22:43 whiteknight joined 22:44 dorlamm joined
masak sorear: I probably would be hard pressed to spend 2e3 EUR/yr on the contest, true. :) maybe some day. 22:47
22:49 cosimo joined 22:58 icwiener left 23:00 icwiener joined, dorlamm left 23:02 mj41 left
masak strangelyconsistent.org/blog/announ...f-p6cc2010 23:08
23:10 pmurias left
tadzik moritz_++! 23:15
oh wait, that's a spoiler :)
masak :P 23:16
the cat being now out of the bag, I'm not sure it matters much.
I'd like to say colomon++ too. the gap between 1st and 2nd place, while not small, was smaller than the gap between 2nd and 3rd place. 23:17
sorear hmm, I should implement that POD parser we talked about some months ago... :)
masak what made you think of that? :) 23:20
23:24 HarryS left 23:26 hercynium joined 23:27 PacoLinux left
[Coke] that's 1e2, not 10e2, yes? ;) 23:27
23:28 PacoLinux joined
[Coke] hurm. even that is a lot. masak++ 23:28
I think I slipped a digit, and also, need another drink. ;) 23:29
23:32 dsp_ left, woosley joined 23:35 arlinius joined 23:41 dsp_ joined, ymasory left 23:48 wallberg left 23:50 mjk joined, mjk left 23:57 hercynium left