Camelia, the Perl 6 bug

IRC log for #cardinal, 2011-02-22

| Channels | #cardinal index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
02:38 whiteknight left #cardinal
03:11 bubaflub joined #cardinal
03:37 bubaflub Tene: ping?
03:37 Tene bubaflub: pong
03:38 bubaflub Tene: i'm still working on some of this stuff for the range
03:38 bubaflub and i'm getting some strange errors
03:39 Tene That's unfortunate.  Paste some shit about it in the channel, and I'd be glad to speculate wildly.
03:39 Tene :)
03:39 bubaflub hahahaha
03:39 bubaflub i've changed all of the if ____ > 0 goto ____ to if ___, ____
03:40 Tene Sounds good to me.
03:41 bubaflub and i have a range like this:
03:42 bubaflub r=1..3
03:42 bubaflub r.from is 1, r.to is 3
03:42 bubaflub but when you do r.each() do |i| puts i; end you only get 2
03:42 Tene sounds like it's excluding the endpoints.
03:43 bubaflub yeah, i thought i handled that right
03:43 bubaflub i think i'll check the !to_test and !from_test stuf
03:45 tadzik bubaflub: it's shift not working correctly, iirc
03:45 bubaflub tadzik: ok, i'm putting some debugging code to double check that
03:46 tadzik I was looking at this on sunday, let me peek into the code once again
03:47 bubaflub tadzik: ok, thanks
03:49 tadzik bubaflub: are you sure removing the > 0 is a good idea? It was a cause of numerous bugs, or did I fail to understand you?
03:49 tadzik bubaflub: each.t passes for me
03:49 bubaflub tadzik: yeah, i thought we could have removed them because those values are 'false' or a number now
03:50 bubaflub but if HEAD works, i'll revert these changes for now
03:50 tadzik are they? Integer 0 is true in Ruby, isn't it?
03:50 * tadzik confused
03:50 bubaflub tadzik: i was thinking what if we actually have a range like -3...0
03:51 bubaflub tadzik: i could be very very wrong
03:51 bubaflub in which case we should just revert my commit
03:51 tadzik bubaflub: works for me
03:51 Tene erm
03:51 bubaflub ruh roh
03:52 tadzik crb(main):001:0> r = -3..0; r.each do |i| print i, " "; end; puts
03:52 tadzik -3 -2 -1 0
03:52 Tene the idea is that instead of fetching an integer, we just use truth directly
03:52 tadzik bubaflub: are you sure you are on the fresh cardinal?
03:52 bubaflub i might not be, lemme check
03:53 bubaflub tadzik: i am, but i have some local modifications that remove the > 0 stuff
03:53 Tene we shouldn't be using 0 to indicate falsity anywhere in cardinal; we should use false
03:53 Tene although we may currently be using zero in some cases still; I expect we probably are.
03:53 bubaflub tadzik: so i have, for example, toexc = getattribute self, '$!to_exclusive'
03:53 bubaflub if toexc, exclusive test
03:53 bubaflub instead of
03:53 bubaflub if toexc > 0 goto exclusive_test
03:54 tadzik bubaflub: you sure that's correct? Remember that get_bool on CardinalInteger is Always True
03:54 Tene tadzik: we should be storing integers in toexec; we should be storing a bool
03:54 Tene although, looking at the initialize method, we're storing integers in there now
03:54 bubaflub tadzik and Tene: ahhhhhhhh now i understand
03:54 Tene so, the initialize method needs to be fixed
03:54 bubaflub i'll rip out storing numbers
03:55 bubaflub and store true and false
03:56 Tene In the cases where we *are* using integers, btw, we *should* be comparing against zero explicitly
03:56 Tene this from the initialize method is wrong, for example:     if $I0 goto default
03:56 bubaflub Tene: so should from_exclusive and to_exclusive be just true/false
03:56 Tene should be, is $I0 > 0
03:56 Tene bubaflub: That's what I expect, yes.
03:57 bubaflub Tene: ok
03:57 Tene Keep in mind, I don't actually know ruby, so there may be cases we encounter where something is actually part of the ruby language or something... I don't think this is one of them.
03:57 Tene so, yes, just get_hll_global 'true' or 'false' and stick it in there
03:58 bubaflub ok, recompiling it now
03:58 tadzik Tene: are you aware what rule 'arg' is optable { ... } meant in PGE?
03:58 tadzik it's not working in nqprx anymore
03:59 Tene tadzik: remove that rule, and s/<arg>/<EXPR>/g everywhere
04:00 Tene tadzik: also, s/<term>/<EXPR>/ I expect... not quite sure why that's in use directly
04:01 tadzik oh, operators hell
04:01 tadzik proto 'infix:=' is precedence('1') is pasttype('copy') is lvalue(1)
04:01 Tene Haha, I kind of expected that.
04:01 tadzik and such
04:02 Tene Yeah, that probably needs to be changed.  Look at nqp-rx's grammar to see how to do that.
04:02 Tene Lemme find it...
04:02 Tene https://github.com/perl6/nqp-rx/bl​ob/master/src/NQP/Grammar.pm#L455
04:02 Tene starting there
04:03 bubaflub Tene, i'm going to gist you my diff of src/classes/Range.pir - can you tell me what i'm missing?
04:03 Tene you first set up precedence levels and default attributes by calling the O method in an INIT block, and then you reference those precedence categories in the individual terms etc.
04:03 Tene bubaflub: I'll check it out; sure
04:03 Tene bubaflub: what behaviour are you seeing that shows you you're missing something?
04:04 bubaflub range still only shows 2; though i've made the changes to each and a lot of the places that > 0 and the initialize function
04:04 Tene yeah, paste it
04:04 tadzik Tene: <keys=args> -- is that supposed to be $<keys>=<args>?
04:04 tadzik is the former legal in nqprx?
04:06 bubaflub Tene: https://gist.github.com/838208
04:06 Tene tadzik: I don't know whether the former is legal in nqp-rx or not.  It's legal perl 6, at least, and was falid in pge.  It means the same thing as the latter.
04:06 Tene Feel free to change it if you'd like.
04:06 tadzik I did, Justin Case
04:07 * tadzik dives into infix hell
04:09 Tene tadzik: there's at least one place in the grammar where some evil bug is lurking; I only managed to find symptoms of it once, but I wasn't able to figure out what was actually wrong.
04:09 tadzik I wonder if what I did still works if treated as PGE code
04:09 Tene The current grammar relies heavily on the order that some things are actually tested in.  If you change the order of a few rules, you'll get infinite recursion.
04:10 Tene so, just a warning...
04:11 Tene I don't think that the operators are one of those places.
04:13 Tene bubaflub: I figured it out, I think...
04:14 Tene bubaflub: check out the return value of from_test and to_test
04:14 Tene it's currently returning integers
04:14 tadzik Tene: what does those :prec<x=> mean?
04:14 Tene you need to change that to true/false
04:14 bubaflub ah, return bool($I0)
04:14 bubaflub or whoops
04:14 bubaflub tailcall
04:14 Tene tadzik: the precedence levels are just sorted alphabetically, is all
04:21 bubaflub Tene: another silly question.  we've got a bool method which does exactly what we want in src/builtins/cmp.pir
04:21 bubaflub can i just .tailcall bool($I0) on from_test and to_test?
04:21 Tene Okay, I'm looking at nqp now to investigate 6model.
04:21 bubaflub or do i need to explicitly include that file
04:22 Tene bubaflub: right now, everything is concatenated into a big pir file, basically, iirc.  The standard I was using was to name internal-ish helper functions with a ! at the start, so they wouldn't confict with normal ruby functions.
04:22 Tene So... probably.
04:22 bubaflub Tene: ok
04:23 tadzik Tene: so, just in case I got it all wrong: the tighter of will have a letter with higher ascii code?
04:24 Tene tadzik: honestly, I can never keep it straight which way is which, and what tighter/looser means.  I recommend you look at the math ops here:
04:24 Tene NQP::Grammar.O(':prec<u=>, :assoc<left>', '%multiplicative');
04:24 Tene NQP::Grammar.O(':prec<t=>, :assoc<left>', '%additive');
04:24 Tene 1+2*3 parses as 1+(2*3)
04:24 Tene and multiplicative(u) is alphabetically later than additive (t)
04:24 Tene so... yes
04:24 tadzik good
04:25 tadzik it's fun working on the code that may not run at all anyway
04:25 Tene YEah, I love it :)
04:30 bubaflub Tene: i'm getting close to fixing this range stuff... (i think)
04:30 Tene Awesome
04:31 tadzik last 30 lines... :)
04:36 tadzik Tene: what is "is parsed(&primary)"?
04:36 tadzik I mean proto 'term:', looks weird btw
04:40 tadzik OH MY, IT COMPILED
04:40 bubaflub tadzik++
04:41 tadzik now, my favourite "Parent isn't a Class" error. I fixed it once or twice alredy and still don't remember HOW
04:43 Tene tadzik: that gives the parsing rule used for the term: proto
04:43 Tene or something
04:44 Tene the operator parser looks for the term: rule to find terms
04:44 Tene that says it should go to the primary rule instead, I think
04:45 Tene The current grammar was a rough translation of the "real" ruby grammar...
04:45 Tene I've wanted to rewrite it to be more like a native perl grammar, with protoregexes etc... but I haven't yet.
04:45 Tene I'm reading some articles about the ruby metamodel right now... interesting stuff
04:47 tadzik Linked: installable_cardinal
04:48 tadzik Ladies and gents, on nqp-rx
04:48 tadzik Shame it doesn't run, but I can push it to a branch, as I'll have to start my day soon
04:50 Tene Yes, definitely push to a branch.
04:50 tadzik done
04:51 tadzik not reported to #cardinal though
04:51 Tene That can't happen until someone with admin privs ont he cardinal repo sets a commit hook
04:51 Tene or push hook, I guess
04:51 Tene I don't have those; I need to get them from dukeleto, I think.
04:52 tadzik wasn't sorear who's caring about dalek?
04:52 Tene Right.
04:52 Tene dalek is configured just fine
04:52 Tene but the cardinal repo needs to be configured to push commits to dalek
04:52 tadzik ah, I see
04:52 Tene is what i last heard
04:54 tadzik hah, moving cardinal to nqp-rx was the first task dukeleto gave me. I thought it'd be a piece of cake then, I'm glad there's finally some moving forward :)
04:54 tadzik I'll have to "wake up
04:54 Tene Me too.
04:54 tadzik at least my insomnia is useful sometimes
04:58 Tene once we get cardinal on a new metamodel, we can start writing large sections of the setting in ruby
04:58 Tene which would be great
05:04 tadzik Yeah
05:04 tadzik and which will force me to learn Ruby :)
05:06 bubaflub and we can steal some stuff from other implementations
05:11 tadzik aye
05:13 bubaflub ok Tene, one more gist of my diff
05:16 bubaflub Tene: same gist, https://gist.github.com/838208
05:29 Tene bubaflub: does it work?
05:29 bubaflub Tene: no, lamentably
05:29 Tene Huh.
05:29 bubaflub yeah.
05:29 bubaflub i can't figure it out
05:29 bubaflub i wonder if a 0 is still coming in somewhere
05:30 Tene Probably.  I recommend adding a ton of debugging statements everywhere.
05:31 bubaflub Tene: way ahead of ya.  i'll add this stuff in and recompile
05:42 bubaflub Tene: all the logic looks right, just the from_exclusive and to_exclusive being set
05:45 Tene I might be able to look at it tomorrow.
05:45 Tene I'm just a bit busy tonight.
05:46 bubaflub Tene: i figured it out
05:46 bubaflub $P1 = hash["$!from_exclusive"]
05:46 bubaflub defined $I0, $P1
05:46 bubaflub $P1 is set to false
05:46 bubaflub but defined
05:47 bubaflub (in the initialize sub)
05:58 bubaflub Tene: well, that fixes one problem, but not more
05:58 bubaflub i'm closing up for hte night
05:58 bubaflub i'll hack this some more later
05:58 Tene That's good progress.
05:58 Tene If it's not better yet, just commit to a branch
05:58 bubaflub yeah, the way some of the tests break
05:58 bubaflub it might not look like progress
06:06 bubaflub left #cardinal
23:20 whiteknight joined #cardinal
23:44 Tene whiteknight: Nice to see you here.  Do you have any specific interests in cardinal, or just observing?

| Channels | #cardinal index | Today | | Search | Google Search | Plain-Text | summary