Saturday, November 7, 2009

Arrrgh!

Very briefly got out SVG output for a NUBS curve yesterday. Tried to make it a bit nicer looking, and had it promptly dissolve in a hail of bus errors. (And occasional "too many positional arguments: 3 passed, 1 expected" errors that I think must be incorrect.) It's now reminding me of my attempt to write an Euclidean geometry proof generator in Lisp back in '92 -- seemingly minor, innocent changes in the code lead to crazy changes in where it crashes.

Anyone have hints for how to approach debugging this sort of thing in Rakudo? I know it's just part of the frustration expected for an early Perl 6 adopter, but I'd really like to get this thing working...

3 comments:

  1. If I run it under valgrind, the bus error goes away, but the "too many positional arguments" error remains.

    ReplyDelete
  2. Yes, this is very much part of the early adopter frustration. The only defense against it (that I've found) is programming under a regime of some sort. TDD certainly helps. For debugging, something which I like to call "a boatload of print statements" has been known to help.

    Most of all, making sure your changes really are minor is probably the most successful advice of all. It's hard to follow in practice, but it's also the most effective.

    ReplyDelete
  3. Unfortunately I was doing all of those things in this case. Vector & co. have a bunch of tests, and the particular change that triggered the problem was changing the number 10 to 40. Also, the littered says are what show the error is happening in different places. :(

    ReplyDelete