Thanks for the response.

I downloaded parrot onto my office machine (35397), and tested as you suggested. All worked and in fact I couldnt reproduce the bug!!! :((

I will try again with parrot at home with version 35286

This happened to me before - I got a segmentation fault working with a Hash; inserted a correct line of code and the fault disappeared; updated parrot and the initial fault could not be reproduced.

If it happens again, I will try parrot directly and let you know.

What is annoying is that I cant find a way to reproduce the fault with more generic code.

By the way, I have asked on the perl6-users list what the %player.sort: {.value} means, or rather what the ':' in that code means. I copied the idiom from Patrick's blog, but I cant find a description why it works in the Synposes.

Richard

Patrick R. Michaud via RT wrote:
On Sat Jan 10 12:19:38 2009, richardh wrote:
Getting a wierd segmentation fault with the following program (also
attached).

I am using rakudo from parrot 35286
[...]

Try running the script using parrot directly instead of the "perl6"
binary, and let us know if you still see the segfault.  (The perl6
binary is known to have some issues with segfaulting, and is really more
of a Parrot issue than a Rakudo one.)

For the record, on my system the program works as expected with the
"say" line uncommented:

  $ ./parrot perl6.pbc skatersv2.pl
  Use of uninitialized value
  Gold Medal: , Guido Chuffart    94.2
  Gold Medal: Guido Chuffart      94.2
  Use of uninitialized value
  Silver Medal: , Chase Carpenter 91.8
  Silver Medal: Chase Carpenter   91.8
  Use of uninitialized value
  Bronze Medal: , Cecilia Cornejo 91.6
  Bronze Medal: Cecilia Cornejo   91.6
  $

The uninitialized value warnings come from the code:

my @ranking = %players.sort: { .value };
for <Gold Silver Bronze> -> $m {
    given pop @ranking {
    say "$m Medal: " ~ %players{$_} ~ ', ' ~ $_;
#    say "$m Medal: $_";
    };
};

After sorting %players by .value, @ranking is left as a list of Pair
objects.  Thus "pop @ranking" returns a Pair, and the uninitialized
value comes from using the Pair as a key in %players{$_} .

Let us know if you still see the segmentation fault when run with
"parrot perl6.pbc" instead of the perl6 binary.

Thanks!

Pm


Reply via email to