Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • I totally agree with you, I think that it is backwards that it doesn't DWIM. The other comments are just the typical lame gut reaction by people who don't get it comments.
    --
    sky
    • I don't think it's a gut reaction, lame or otherwise. The proponents seem to be the ones who haven't thought things through. It's not at all clear what DWIM behavior is in this case. It has to handle nonempty arrays as well:

      my @foo = 1 .. 3;
      $foo[10] = "foo"; # legal
      $foo[-10] = "foo"; # illegal, but what do you expect?
      • In fine tradition with language design flames I am going to point out that dbjerg points out exactly what he expects and I get this, you however do not.

        Therefore I don't see any reason to tell you what I expect, because I expect what dbjerg already said and you didn't get that.
        --
        sky
        • I'm sorry, but I see nothing in djberg96's posts that addresses nonempty arrays at all. Both rjbs and jsmith have raised the issue, but neither has received an answer.
          • See, I get what he means, you don't.

            djberg96> In that case, I would expect it to act like a positive
            djberg96> integer, only in reverse. Thus, $array[-3] would result
            djberg96> in an array ("foo",undef,undef).

            Easy eh?
            --
            sky
            • I assumed he was talking about starting with an empty array there. I'm talking about when the array already has something in it. Do you really mean to say that after this

              my @foo = 1 .. 3;
              $foo[-4] = 'foo';

              you would expect to lose what had been in the array before and be left with just ('foo', undef, undef, undef)?